akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
 
//setbase - cout << setbase (16); cout << 100 << endl; Prints 64
//setfill -   cout << setfill ('x') << setw (5); cout << 77 << endl; prints xxx77
//setprecision - cout << setprecision (14) << f << endl; Prints x.xxxx
//cout.precision(x)  cout<<fixed<<val;  // prints x digits after decimal in val

#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define repa(i,arr,n) for(int i=arr;i<=n;i++)
#define repd(i,arr,n) for(int i=arr;i>=n;i--)
#define trav(arr,x) for(auto& arr:x)
#define all(c) c.begin(), c.end()
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define sz(arr) arr.size()
#define pi 3.14159265358979323846
#define MAX (1000*1000*1000+7)
#define vi vector<int>
#define pii pair<int,int>
#define pqueue priority_queue<int>
#define pdqueue priority_queue<int,vi,greater<int> >

int32_t main()
{
    fast;
    stack<char> s;
    string str;
    cin>>str;
    int ans=0;

    rep(i,sz(str))
    {
        if(s.empty())
        {
            s.push(str[i]);
        }
        else
        {
            char ch=s.top();
            if(ch==str[i])
                s.push(str[i]);
            else
            {
                s.pop();
                ans+=2;
            }
        }
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 512
package main

import (
	"fmt"
)

func main() {
	var x, y, z int
	fmt.Scanf("%d %d %d", &x, &y, &z)
	var five, seven int
	if x == 5 {
		five++
	} else if x == 7 {
		seven++
	}
	if y == 5 {
		five++
	} else if y == 7 {
		seven++
	}
	if z == 5 {
		five++
	} else if z == 7 {
		seven++
	}
	if five == 2 && seven == 1 {
		fmt.Println("YES")
	} else {
		fmt.Println("NO")
	}
}


Measured memory_bytes: 512
using System;
using System.Collections.Generic;
using System.Linq;
class Program
{
    static void Main(string[] args)
    {
        int first = 1;
        int a = Read.Int();
        int b = Read.Int();
        for(int i = 0; i < a; i++)
        {
            first += first < b ?first:b;
        }
        Console.WriteLine(first);
        Console.ReadLine();
    }
    public static long gcd(long a, long b)
    {
        while (true)
        {
            if (a == 0) { return b; }
            if (b == 0) { return a; }
            if (a > b) { a -= b; }
            else { b -= a; }
        }
    }
    public static long lcm(long a, long b) { return a / gcd(a, b) * b; }
    public static bool IsPrime(long n)
    {
        if (n < 2) return false;
        if (n == 2) return true;
        for (long i = 2; i < n; i++) { if (n % i == 0) return false; }
        return true;
    }
}
public static class Read
{
    public static void outl(string n = "") { Console.WriteLine(n); return; }
    public static long Long() { return long.Parse(Console.ReadLine()); }
    public static long[] longs() { return Console.ReadLine().Split().Select(long.Parse).ToArray(); }
    public static int Int() { return int.Parse(Console.ReadLine()); }
    public static int[] ints() { return Console.ReadLine().Split().Select(int.Parse).ToArray(); }
    public static string Str() { return Console.ReadLine(); }
    public static string[] Strs() { return Console.ReadLine().Split(); }
}

Measured memory_bytes: 11092
#include <bits/stdc++.h>
#define REP(i, N) for (int i = 0; i < (N); ++i)
#define ALL(x) (x).begin(), (x).end()
#define MOD 1000000007
#define PB push_back
#define MP make_pair
using namespace std;
typedef long long ll;
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }

//++時計回り --反時計回り
// int dx[4] = {1, 0, -1, 0};
// int dy[4] = {0, 1, 0, -1};

int main() {
  int N;
  cin >> N;
  int A[N];
  int _max = 0;
  int _max2 = 0;
  REP(i, N) {
    cin >> A[i];
    _max = max(_max, A[i]);
  }
  int count = 0;
  REP(i, N) {
    if (A[i] == _max) count++;
  }
  if (count == 1) {
    REP(i, N) {
      if (A[i] < _max) _max2 = max(_max2, A[i]);
    }
  }
  else _max2 = _max;
  REP(i, N) {
    int ans;
    if (A[i] == _max) ans = _max2;
    else ans = _max;
    cout << ans << '\n';
  }
}


Measured memory_bytes: 2432
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
typedef long long ll;
typedef unsigned int uint;
using namespace std;

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

    int N;
    cin >> N;
    ll A[N];
    for (int i = 0; i < N; i++) {
        cin >> A[i];
    }

    ll sm = A[0];
    ll ans = N;
    int l = 0, r = 1;
    while (r < N) {
        if ((sm^A[r]) == sm+A[r]) {
            sm += A[r];
            ans += r - l;
            r++;
        } else {
            sm -= A[l];
            l++;
        }
    }

    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 1792
// {{{
#include <iostream>
#include <iomanip>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <complex>
#include <vector>
#include <list>
#include <set>
#include <queue>
#include <stack>
#include <map>
#include <string>
#include <algorithm>
#include <numeric>
using namespace std;

#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define FOR(i, a, b) for(ll i = static_cast<ll>(a); i < static_cast<ll>(b); i++)
#define FORR(i, a, b) for(ll i = static_cast<ll>(a); i >= static_cast<ll>(b); i--)
#define REP(i, n) for(ll i = 0ll; i < static_cast<ll>(n); i++)
#define REPR(i, n) for(ll i = static_cast<ll>(n); i >= 0ll; i--)
#define ALL(x) (x).begin(), (x).end()

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> IP;
typedef pair<ll, LP> LLP;

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

constexpr int INF = 100000000;
constexpr ll LINF = 10000000000000000ll;
constexpr int MOD = static_cast<int>(1e9 + 7);
constexpr double EPS = 1e-9;
// }}}

int a[5], k;

void init()
{
}

void solve()
{
    REP(i, 5){
        FOR(j, i, 5){
            if(abs(a[i] - a[j]) > k){
                cout << ":(" << endl;
                goto END;
            }
        }
    }
    cout << "Yay!" << endl;
END:
    return;
}

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    REP(i, 5) cin >> a[i];
    cin >> k;
    solve();
    return 0;
}

// vim:set foldmethod=marker:


Measured memory_bytes: 256
#include<stdio.h>

#define MAX 10000
#define NIL -1

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

Node T[MAX];
int n;

void preParse( int u ){
	
	if( u == NIL ){
		return;
	}
	printf( " %d" , u );
	preParse( T[u].l );
	preParse( T[u].r );
}

void inParse( int u ){
	
	if( u == NIL ){
		return;
	}
	inParse( T[u].l );
	printf( " %d" , u );
	inParse( T[u].r );
}

void postParse( int u ){
	
	if( u == NIL ){
		return;
	}
	postParse( T[u].l );
	postParse( T[u].r );
	printf( " %d" , u );
}

int main( void ){
	
	int i , v , l , r , root;
	
	scanf( "%d" , &n );
	
	for( i = 0; i < n; i++ ){
		T[i].p = NIL;
	}
	
	for( i = 0; i < n; i++ ){
		scanf( "%d " , &v );
		scanf( "%d " , &l );
		scanf( "%d " , &r );
		T[v].l = l;
		T[v].r = r;
		if( l != NIL ){
			T[l].p = v;
		}
		if( r != NIL ){
			T[r].p = v;
		}
	}
	
	for( i = 0; i < n; i++ ){
		if( T[i].p == NIL ){
			root = i;
		}
	}
	
	printf( "Preorder\n" );
	preParse( root );
	printf( "\n" );
	printf( "Inorder\n" );
	inParse( root );
	printf( "\n" );
	printf( "Postorder\n" );
	postParse( root );
	printf( "\n" );
	
	return 0;
}


Measured memory_bytes: 2104
n = int(input())
c0, c1, c2, c3 = [0 for i in range(4)]
for j in range(n):
  judge = input()
  if judge == "AC":
    c0 += 1
  elif judge == "WA":
    c1 += 1
  elif judge == "TLE":
    c2 += 1
  else:
  	c3 += 1

print("AC x " + str(c0))
print("WA x " + str(c1))
print("TLE x " + str(c2))
print("RE x " + str(c3))

Measured memory_bytes: 9068
"use strict"
function Main(input) {
  input = input.trim().split('\n');
  const N = input[0];
  const A = input[1].trim().split(' ').map(Number).sort((a,b) => b-a);

  let a = 0;
  let b = 0;
  for(let i=0; i<N; i++){
    if(i % 2 === 0){
      a += A[i];
    } else {
      b += A[i];
    }
  }

  console.log(a-b);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 7500
#include<bits/stdc++.h>
using namespace std;
const int M=1e5+5;
vector<int>mmp[M];
int col[M],du[M],val[M],dp1[M],dp2[M],n,rt,tot,more;
bool allb[M];
char ch[M];
void in()
{
    int a,b;
    scanf("%d",&n);
    for(int i=1;i<n;++i)
    scanf("%d%d",&a,&b),mmp[a].push_back(b),mmp[b].push_back(a);
    scanf("%s",ch+1);
    for(int i=1;i<=n;++i)col[i]=ch[i]=='W'?0:1,rt=col[i]?rt:i;
}
void dfs(int v,int f)
{
    allb[v]=col[v];int to;
    for(int i=mmp[v].size()-1;i>=0;--i)
    {
        to=mmp[v][i];if(to==f)continue;
        dfs(to,v);
        if(!allb[to])++du[v],++du[to];
        allb[v]&=allb[to];
    }
}
void dp(int v,int f)
{
    tot+=du[v];
    if((du[v]+col[v])&1)val[v]=0;
    else val[v]=2,++tot;
    int mx1=0,mx2=0,to;bool flag=0;
    for(int i=mmp[v].size()-1;i>=0;--i)
    {
        to=mmp[v][i];if(to==f||allb[to])continue;
        flag=1;dp(to,v);
        more=max(more,max(dp1[to]+mx2+val[v],dp2[to]+mx1+val[v]));
        mx1=max(dp1[to],mx1);mx2=max(dp2[to],mx2);
    }
    dp1[v]=mx1+val[v];dp2[v]=flag?mx2+val[v]:-INT_MAX;
}
void ac()
{
    dfs(rt,0);dp(rt,0);
    if(rt)printf("%d",tot-more);
    else printf("0");
}
int main()
{
    in();ac();
    return 0;
}


Measured memory_bytes: 15616
#include <iostream>
#include <algorithm>
using namespace std;
int n, a[100], ans = 9999999999;
void dfs(int g, int p, int now) {
	if (now == n) {
		ans = min(abs(g - p), ans);
		return;
	}
	dfs(g + a[now], p, now + 1);
	dfs(g, a[now] + p, now + 1);
	return;
}
int main() {
	while (1) {
		cin >> n;
		if (n == 0) return 0;
		ans = 9999999999;
		for (int i = 0; i < n; i++) cin >> a[i];
		dfs(0, 0, 0);
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 3048
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>

using namespace std;

int main()
{
    int N;
    cin >> N;
    vector<int> A(N);
    for(int i=0;i<N;++i){
        cin >> A[i];
    }
    bool flag = true;
    for(int i=0;i<N;++i){
        if(A[i] % 2 == 0){
            if(!(A[i] % 3 == 0 or A[i] % 5 == 0)){
                flag = false;
            }
        }
        if(!(flag)) break;
    }
    if(flag) cout << "APPROVED" << endl;
    else cout << "DENIED" << endl;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <stdlib.h>
#define MAX 40
int n, preorder[MAX],inorder[MAX],post[MAX],n_post,pos;

void rec(int l, int r)
{
	if (l >= r){return;}
	int root = preorder[pos++];
	int m = distance(root);
	rec(l, m);
	rec(m+1,r);
	post[n_post++] = root;
}


int distance(int x)
{
	int i;
	for (i = 0; i < n; ++i){
		if (inorder[i] == x)
			return i;
	}
	return -1;
}


void solve()
{
	int i;
	rec(0, n);
	for (i = 0; i < n_post; ++i)
		printf("%d%c", post[i], (i != n_post - 1) ? ' ' : '\n');
}

int main(int argc, char** argv)
{
	int i;
	n_post = 0;
	scanf("%d", &n);
	for (i = 0; i < n; ++i){scanf("%d", &preorder[i]);}
	for (i = 0; i < n; ++i){scanf("%d", &inorder[i]);}
	solve();

	return 0;
}



Measured memory_bytes: 2120
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
// ll mod=1000000007;
int main(){
    ios_base::sync_with_stdio(false); 
    cin.tie(NULL);
    cout.tie(NULL);
    ll t,i,j,temp,temp2,x,y,sum=0,o,n,m;
    cin >>n;
    vector <ll> a(n);
    vector <ll> b(n);
    for(i=1;i<n;i++){
        cin  >> a[i];
        b[a[i]-1]++;
    }
    for(i=0;i<n;i++){
        cout << b[i] << endl;
    }
}


Measured memory_bytes: 6364
def main():
    N = str(input())
    B_count = 0
    result = 0
    for i in range(0, len(N)):
        target = N[i]
        if target == 'W':
            result = result + B_count
        else:
            B_count = B_count + 1        
    print(result)

if __name__ == "__main__":
    main()

Measured memory_bytes: 3500
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
using ll = long long;
int main(){
    int a, b, c;
    cin >> a >> b >> c;
    if(a > b && a > c) cout << b * c / 2 << endl;
    else if( b > c && b > a) cout << a * c /2 << endl;
    else cout << a * b /2 << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
        public static void main(String[] args) {
                Scanner scan = new Scanner(System.in);
                int numN = scan.nextInt();
                int[] Length = new int[numN];
                int sum = 0;
                int max=0;
                int tmp=0;

                for (int i=0; i<numN; i++) {
                    Length[i] = scan.nextInt();
                    if ( i == 0 ) {
                        max = Length[i];
                    }
                    else {
                        if ( max < Length[i] ) {
                            tmp = max;
                            max = Length[i];
                            sum = sum + tmp;
                        }
                        else {
                            sum += Length[i];
                        }
                    }
                }

                if ( max < sum ) {
                    System.out.println( "Yes" );
                }
                else {
                    System.out.println( "No" );
                }
                
                scan.close();
        }
}


Measured memory_bytes: 22868
n = int(raw_input())
a = map(int, raw_input().split(" "))

y1 = 0
for i in range(0, len(a)):
    if i % 2 == 0:
        y1 += a[i]
    else:
        y1 -= a[i]

y = []
y.append(y1)

for i in range(1, n):
    tmp = 2 * a[i - 1] - y[i - 1]
    y.append(tmp)

print(" ".join(map(str, y)))


Measured memory_bytes: 18124
#include<cstdio>
#include<iostream>
#include<string>
#include<algorithm>
#include<stdio.h>
#include<locale.h>
#include<set>
#include<stack>
#include<queue>
#include<math.h>
using namespace std;

int main()
{
 long long int x,y;
 scanf("%lld %lld",&x,&y);
 y/=x;
 int ans=0;
 for(;;)
 {
	ans++;
	y/=2;
//	printf("%d %d\n",ans,y);
	if(y==0){break;}
 }
 printf("%d",ans);
}



Measured memory_bytes: 3812
import sys
sys.setrecursionlimit(1000000)

N = int(input())

e = [ [] for i in range(N)]
for i in range(N-1):
    a,b = map(int,input().split())
    a-=1
    b-=1
    e[a].append(b)
    e[b].append(a)

col = [ -1 for i in range(N)]
col[0] = 0

p = []
path = [ 0 for i in range(10**5+1)]
def dfs(n,c):
    global p
    if n == N - 1:
        p = path
    path[c] = n
    for v in e[n]:
        if col[v] == -1:
            col[v] = c + 1
            dfs(v,c+1)
            if p:
                return
dfs(0,0)

t = col[N-1] + 1
if t % 2 ==0:
    sn = p[t//2]
else:
    sn = p[t//2+1]


colfn = [ -1 for i in range(N)]
colfn[0] = 0
def dfs2(n,c):

    for v in e[n]:
        if v == sn:
            continue
        elif colfn[v] == -1:
            colfn[v] = c + 1
            dfs2(v,c+1)

dfs2(0,0)

fennec = -1
for i in range(N):
    if colfn[i] != -1:
        fennec += 1

snuke = N - fennec - 2
if fennec > snuke:
    print("Fennec")
else:
    print("Snuke")

Measured memory_bytes: 118412
#define rep(i, a, b) for(int i = a; i < (int)(b); i++)
#include <bits/stdc++.h>

typedef long long ll;
using namespace std;
template<class T> inline void chmax(T &a, const T &b) {if(a < b) a = b;}
template<class T> inline void chmin(T &a, const T &b) {if(a > b) a = b;}
const long long INF = 1LL<<60;
const long long MOD = (ll)1e9+7;
const long long MAX = (ll)1e5+100;


int main(void) {
   ll N,K;
   cin>>N>>K;
   ll ans = 0;
   rep(i,K+1,N+1) {
      int b = i;
      int r = N/b;
      if (K==0) ans--;
      ans += r * (b-K);
      if (N >= r*b+K) ans += N - (r*b+K)+1;
      // if (i<=100)cout<<i<<" "<<ans<<endl;
   }
   cout<<ans<<endl;

   return 0;
}

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

public class Main {

  public static void main(String args[]) throws IOException {

    final int F = 500; // 500円

    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    String[] sa = br.readLine().split(" ");
    int k = Integer.parseInt(sa[0]); // 枚数
    int x = Integer.parseInt(sa[1]); // 円
    br.close();

    if (F * k >= x) {
      System.out.println("Yes");
    } else {
      System.out.println("No");
    }
  }
}


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

int main() {
    int at[3][10] = {0};
    int bt[3][10] = {0};
    int ct[3][10] = {0};
    int dt[3][10] = {0};
    int n, a, b, c, v;
    cin >> n;
    for(int i = 0; i < n; i++) {
        cin >> a >> b >> c >> v;
        if(a == 1) {
            at[b - 1][c - 1] += v;
        } else if(a == 2) {
            bt[b - 1][c - 1] += v;
        } else if(a == 3) {
            ct[b - 1][c - 1] += v;
        } else if(a == 4) {
            dt[b - 1][c - 1] += v;
        }
    }

    for(int i = 0; i < 3; i++) {
        for(int j = 0; j < 10; j++) {
            cout << " " << at[i][j];
        }
        cout << endl;
    }
    cout << "####################" << endl;
    for(int i = 0; i < 3; i++) {
        for(int j = 0; j < 10; j++) {
            cout << " " << bt[i][j];
        }
        cout << endl;
    }
    cout << "####################" << endl;
    for(int i = 0; i < 3; i++) {
        for(int j = 0; j < 10; j++) {
            cout << " " << ct[i][j];
        }
        cout << endl;
    }
    cout << "####################" << endl;
    for(int i = 0; i < 3; i++) {
        for(int j = 0; j < 10; j++) {
            cout << " " << dt[i][j];
        }
        cout << endl;
    }


    return 0;
}


Measured memory_bytes: 3080
#include <bits/stdc++.h>
#include <unordered_map>
#define mem(ara, a) memset(ara, a, sizeof(ara))
#define fo freopen("output.txt", "w", stdout)
#define fi freopen("bruh.txt", "r", stdin)
#define int long long
#define sp " "
#define pb push_back
#define ff first
#define sz(x) x.size();
#define len(x) x.length();
#define ss second
#define vi vector<int>
#define double long double
#define all(x) x.begin(), x.end()
#define allr(x) x.rbegin(), x.rend()
#define pii pair<int, int>


long long inf = 2e18;
long long minf = -inf;
int ans = 0;
using namespace std;

signed main()
{
string s;
cin >> s;
if (s=="ABC"){
    cout << "ARC" << endl;
}
else {
    cout << "ABC" << endl;
}
}


Measured memory_bytes: 3620
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <cassert>
#include <iostream>
#include <iomanip>
#include <sstream>
#include <algorithm>
#include <numeric>
#include <complex>
#include <stack>
#include <queue>
#include <list>
#include <set>
#include <map>
#include <bitset>
#include <functional>
#include <iterator>

using namespace std;

#define dump(n) cout<<"# "<<#n<<'='<<(n)<<endl
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define peri(i,a,b) for(int i=int(b);i-->int(a);)
#define rep(i,n) repi(i,0,n)
#define per(i,n) peri(i,0,n)
#define iter(c) __typeof__((c).begin())
#define foreach(i,c) for(iter(c) i=(c).begin();i!=(c).end();++i)
#define all(c) (c).begin(),(c).end()
#define mp make_pair

typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<string> vs;
typedef pair<int,int> pii;

const int INFTY=1<<29;
const double EPS=1e-9;

template<typename T1,typename T2>
ostream& operator<<(ostream& os,const pair<T1,T2>& p){
	return os<<'('<<p.first<<','<<p.second<<')';
}
template<typename T>
ostream& operator<<(ostream& os,const vector<T>& a){
	os<<'[';
	rep(i,a.size()) os<<(i?" ":"")<<a[i];
	return os<<']';
}

struct Edge{
	int src,dst,weight;
	Edge(){}
	Edge(int s,int d,int w):src(s),dst(d),weight(w){}
	bool operator<(const Edge& e)const{return weight<e.weight;}
	bool operator>(const Edge& e)const{return weight>e.weight;}
};

struct UnionFind{
	vi data;
	UnionFind(int size):data(size,-1){}
	int Find(int n){
		return data[n]<0?n:(data[n]=Find(data[n]));
	}
	void Unite(int a,int b){
		int ra=Find(a),rb=Find(b);
		if(ra!=rb){
			if(-data[ra]<-data[rb])
				swap(ra,rb);
			data[ra]+=data[rb];
			data[rb]=ra;
		}
	}
	int Size(int n){
		return -data[Find(n)];
	}
};

int main()
{
	for(int n;cin>>n;){
		vector<Edge> es(n-1);
		for(Edge& e:es) cin>>e.src>>e.dst>>e.weight;
		
		sort(all(es));
		UnionFind uf(n);
		
		ll res=0;
		for(Edge e:es){
			res+=(ll)e.weight*uf.Size(e.src)*uf.Size(e.dst);
			uf.Unite(e.src,e.dst);
		}
		
		cout<<res<<endl;
	}
	
	return 0;
}

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

int main()
{
	unsigned long n = 0;
	long a = 0, b = 0, pf = 0;

	cin >> n;
	cin >> a;

	b = a;
	pf = - a;

	for (unsigned long i = 0; i < n - 1; i++) {
		cin >> a;

		if (a - b >= pf)
			pf = a - b;
		if (a < b)
			b = a;
	}

	cout << pf << endl;
		
	return 0;
}

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

#define rep(i,n) rep2(i,0,n)
#define rep2(i,m,n) for(int i=(m);i<(n);i++)
#define sz(x) ((x).size())

typedef vector<long long> vi;
typedef vector<vi> mat;

int N,M,A,B,C,T,S[55];

mat mul(mat& A,mat& B){
	int n=sz(A);
	mat C(n,vi(n));
	rep(i,n)rep(j,n)rep(k,n){
		C[i][j]=(C[i][j]+A[i][k]*B[k][j])%M;
	}
	return C;
}

mat pow(mat A,int e){
	int n=sz(A);
	mat B(n,vi(n));
	rep(i,n)B[i][i]=1;
	while(e){
		if(e&1)B=mul(B,A);
		A=mul(A,A);
		e>>=1;
	}
	return B;
}

int main2(){
	mat a(N,vi(N));
	rep(i,N){
		if(i>0)a[i][i-1]=A;
		a[i][i]=B;
		if(i<N-1)a[i][i+1]=C;
	}
	a=pow(a,T);
	rep(i,N){
		long long res=0;
		rep(j,N)res+=S[j]*a[i][j];
		cout<<res%M<<(i==N-1?"\n":" ");
	}
}

int main(){
	while(cin>>N>>M>>A>>B>>C>>T && N){
		rep(i,N)cin>>S[i];
		main2();
	}
}

Measured memory_bytes: 1300
'use strict'
function Main(input) {

  let ptn = input.trim();
  // console.log({ ptn });
  let ZOCount = 0;
  let OZCount = 0;

  for (let i = 0; i < ptn.length; i++) {
    if (ptn[i] !== (i % 2 === 1 ? '0' : '1')) {
      ZOCount += 1;
    }
    if (ptn[i] !== (i % 2 === 0 ? '0' : '1')) {
      OZCount += 1;
    }
  }
  // console.log({ ZOCount, OZCount });

  console.log(Math.min(ZOCount, OZCount));

}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 7372
n = int(input())
A = list(map(int, input().split()))

INF = 10**6

dp = [[0] * 2 for i in range(n+1)]
dp[0][0] = 0
dp[0][1] = -INF
for i in range(0, n):
    dp[i+1][0] = max(dp[i][0]+A[i], dp[i][1]-A[i])
    dp[i+1][1] = max(dp[i][1]+A[i], dp[i][0]-A[i])
print(dp[n][0])


Measured memory_bytes: 25572
// author: Saman Mahdanian
#include <bits/stdc++.h>

using namespace std;
const int N = 5e5 + 10;
const int MOD = 1e9 + 7;

int _sum (int, int);
int _mul (int, int);
int _pow (int, int);

int a[N], b[N];

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

	int n;
	cin >> n;
	for (int i = 0; i < n; i++)
		cin >> a[i];
	sort (a, a + n);

	for (int i = 0; i < n; i++)
		b[i] = min(a[n - 1] - a[i], a[i]);
	cout << a[n - 1] << ' ' << a[max_element(b, b + n) - b] << endl;
}

// int choose (int r, int k) {
// 	return _mul (f[k], _mul(inv[r], inv[k - r]));
// }

int _sum (int a, int b) {
	return a + b - (a + b >= MOD? MOD : 0);
}

int _mul (int a, int b) {
	return 1LL * a * b % MOD;
}

int _pow (int a, int b) {
	if (!b) 
		return 1;
	int res = _pow (a, b >> 1);
	res = _mul (res, res);
	if (b & 1)
		res = _mul (res, a);
	return res;
}

// SamMHD :: Jun27-2019 :: Another Day with Shayan...

Measured memory_bytes: 1024
#include <iostream>
#include <algorithm>

using namespace std;

int v[51];

int main(){
	
	int N;
	cin >> N;
	for(int i = 0; i < N; i++)
		cin >> v[i];

	sort(v, v+N);

	double max = (double) (v[0] + v[1])/2;

	for(int j = 2; j < N; j++){
		max = (double) (v[j] + max)/2;
	}

	cout << max << '\n';

	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
struct ball
{char name[12];
int n;
};
int main()
{struct ball t[2];
char s[12];
scanf("%s %s",t[0].name,t[1].name);
scanf("%d %d",&t[0].n,&t[1].n);
scanf("%s",s);
if(strcmp(s,t[0].name)==0)
	t[0].n=t[0].n-1;
if(strcmp(s,t[1].name)==0)
	t[1].n=t[1].n-1;
printf("%d %d",t[0].n,t[1].n);
}

Measured memory_bytes: 128
#include<stdio.h>
#include<stdlib.h>
 
#define NMIN 1
#define NMAX 36
 
struct Number{
char mark;
char value;  
};
 
 
void bubble(struct Number A[],int N){
  int i,j;
 struct Number t;
  for(i=0;i<N;i++){
for(j=N-1;j>=i;j--){
  if(A[j].value<A[j-1].value){
    t=A[j];
    A[j]=A[j-1];
    A[j-1]=t;
  }
}    
  }
}
 
void selections(struct Number A[],int N){
  int i,j,minj;
 struct Number t;
  for(i=0;i<N;i++){
minj=i; 
for(j=i;j<N;j++){
  if(A[j].value<A[minj].value) minj=j;
}
t=A[i];
A[i]=A[minj];
A[minj]=t;
  }
}
 
void print(struct Number A[],int N){
int i;
for(i=0;i<N;i++){
  if(i>0) printf(" ");
  printf("%c%c",A[i].mark,A[i].value);
}
 printf("\n");
}
 
int isStable(struct Number N1[],struct Number N2[],int N){
int i;
  for(i=0;i<N;i++){
    if(N1[i].mark != N2[i].mark) return 0;
  }
  return 1;
}
 
 
 
int main(){
int N,i,j;
struct Number N1[NMAX],N2[NMAX];
char ch;
scanf("%d",&N);
if(N<NMIN||N>NMAX) exit(1);
for(i=0;i<N;i++){
  scanf(" %c%c",&N1[i].mark,&N1[i].value);
}
for(i=0;i<N;i++){
N2[i]=N1[i];
}
bubble(N1,N);
selections(N2,N);
 
print(N1,N);
printf("Stable\n");
print(N2,N);
if(isStable(N1,N2,N)==1){
  printf("Stable\n");
}
else{
  printf("Not stable\n");
}
  return 0;
}



Measured memory_bytes: 2108
#include<iostream>
#include<iomanip>
#include<math.h>
#include<vector>
using namespace std ;

int main(){
    using ld = long double ;
    int n ;
    while(1){
        cin >> n ;
        if(n==0) break ;
        vector<ld> s(n) ;
        ld ave = 0 ;
        for(int i=0;i<n;i++){
            cin >> s.at(i) ;
            ave += s.at(i) ;
        }
        ave /= (ld)n ;
        ld sum = 0 ;
        for(int i=0;i<n;i++){
            sum += (s.at(i)-ave)*(s.at(i)-ave) ;
        }
        sum /= (ld)n ;
        cout << fixed << setprecision(10) << sqrt(sum) << endl ;
    }
}


Measured memory_bytes: 3264
#include<bits/stdc++.h>
 
using namespace std;
using S = set<long long>;
using D = deque<long long>;
using L = vector<long long>;
using M = map<int,long long>;
using A = vector<vector<long long>>;
using Q = priority_queue<long long>;
using U = unordered_map<int,long long>; //mapとの違いはkeyの順番を保持していない

#define sorted(vector) sort(vector.begin(),vector.end()) //O(nlongn)
#define sortedreverce(vector) sort(vector.rbegin(),vector.rend()) //O(nlongn)
#define vmin(vector) *min_element(vector.begin(),vector.end()) //O(N)
#define vmax(vector) *max_element(vector.begin(),vector.end()) //O(N)
#define vsum(vector) accumulate(vector.begin(),vector.end(),0) //O(N)
#define vcount(vector,a) count(vector.begin(), vector.end(),a) //O(N)
#define bisect_left(vector,a) (lower_bound(vector.begin(),vector.end(),a)-vector.begin())
#define bisect_right(vector,a) (upper_bound(vector.begin(),vector.end(),a)-vector.begin())
#define vfind(vector,a) find(vector.begin(), vector.end(), a) != vector.end() //遅いからあんまり使うな
#define inf 1000000000000000000+10
//存在確認はmap!!!!!!!!!!!!!か配列に埋め込んでcontinueで回避
//__gcd(a,b)はコンパイラがGCC時のみ
//printf("%.16f", ans); 誤差落ち対応君

int main(){
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); //printfとかと混ぜるな！
    long long n;
    string s;
    cin>>n>>s;
    long long r=vcount(s,'.');
    L ans;
    ans.push_back(r);
    for(int i=0  ;i<n  ;i++){
        if (s[i]=='#'){
            r++;
        }else{
            r--;
        }
        ans.push_back(r);
    }
    cout<<vmin(ans)<<endl;
}

Measured memory_bytes: 2700
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll mod = 1000000007;
const int INF = 1001001001;

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

template<class Type>
Type gcd(Type x, Type y)
{
	Type r;
	if (x < y) swap(x, y);

	while (0 < y) {
		r = x % y;
		x = y;
		y = r;
	}
	return x;
}

template<class Type>
Type lcm(Type x, Type y)
{
	return x * y / gcd(x, y);
}

template<class Type>
bool is_prime(Type x)
{
	if (x == 2) return true;
	if (x < 2 || x % 2 == 0) return false;

	for (Type i = 3; i <= sqrt(x); i += 2) {
		if (x % i == 0) return false;
	}
	return true;
}

template<class Type>
vector<bool> eratos(Type n)
{
	vector<bool> isPrime(n + 1, true);
	isPrime[0] = isPrime[1] = false;
	for (Type i = 2; i <= n; i++) {
		if (isPrime[i]) {
			Type j = i + i;
			while (j <= n) {
				isPrime[j] = false;
				j = j + i;
			}
		}
	}
	return isPrime;
}

bool binary_search_judge(vector<int> a, int index, int key)
{
	if (key <= a[index]) return true;
	else return false;
}

int binary_search(vector<int> a, int key)
{
	int ng = -1;
	int ok = a.size();
	while (1 < abs(ng - ok)) {
		int mid = (ng + ok) / 2;
		if (binary_search_judge(a, mid, key)) ok = mid;
		else ng = mid;
	}
	return a[ok] == key;
}

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

	if (a == b && a != c || b == c && b != a || c == a && c != b) {
		cout << "Yes" << endl;
	}
	else cout << "No" << endl;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
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;
    sort(S.begin(), S.end());
    if (S[0] == S[1] && S[1] != S[2] && S[2] == S[3]) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }

    return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Diagnostics;
using System.IO;

class Program
{
    static Tuple<int[], int[]> Solve(int N, int[] p)
    {
        int[] a = new int[N];
        int[] b = new int[N];
        for (int i = 0; i < N; ++i)
        {
            a[i] = (i + 1) * 25000;
            b[N - i - 1] += (i + 1) * 25000;
            b[p[i] - 1] += i;
        }
        return new Tuple<int[], int[]>(a, b);
    }
    static void Main(string[] args)
    {
        int N = int.Parse(Console.ReadLine());
        int[] p = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
        var res = Solve(N, p);
        Console.WriteLine(string.Join(" ", res.Item1));
        Console.WriteLine(string.Join(" ", res.Item2));
    }
}


Measured memory_bytes: 8920
#include <bits/stdc++.h>
#define int long long
const int INF = 1e18L + 5;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
using namespace std;

signed main() {

    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    int n; cin >> n;
    vector<int> a(n);
    rep(i,n) cin >> a[i];
    int ans; //最大値のオフセット
    int mx = a[0]; //最大値
    rep(i,n) {
        if (mx <= a[i]) {
            mx = a[i];
            ans = i;
        }
    }
    int ans2; //二番目に最大のオフセット
    int mx2 = 0;
    rep(i,n) {
        if (i == ans) continue;
        else if (mx2 <= a[i]) {
            mx2 = a[i];
            ans2 = i;
        }
    }
    rep(i,n) {
        if (i == ans) cout << mx2 << endl;
        else cout << mx << endl;
    }

    return 0;
}

Measured memory_bytes: 3200
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0; i<(n); i++)
#define REP2(i,x,n) for(int i=x; i<(n); i++)
#define ALL(n) begin(n),end(n)
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
int main()
{
    string S;
    cin >> S;
    cout << ( S == "000" ? 0 : S == "111" ? 3 : S == "001" || S == "010" || S == "100" ? 1 : 2 ) << endl;
    return 0;
}

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

using namespace std;

struct SegmentTree {
    vector<int> node;
    int n = 1;

    explicit SegmentTree(int sz) {
        while (n < sz) {
            n *= 2;
        }

        node.resize(2 * n - 1);
    }

    void Update(int k, int a) {
        k += n - 1;
        node[k] += a;

        while (k > 0) {
            k = (k - 1) / 2;

            node[k] = node[k * 2 + 1] + node[k * 2 + 2];
        }
    }

    void GetSum(int a, int b, long long int &sum, int k = 0, int l = 0, int r = -1) {
        if (r < 0) {
            r = n;
        }

        if (r <= a || b <= l) {
            return;
        }
        if (a <= l && r <= b) {
            sum += node[k];
            return;
        }

        GetSum(a, b, sum, k * 2 + 1, l, (l + r) / 2);
        GetSum(a, b, sum, k * 2 + 2, (l + r) / 2, r);
    }
};

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

    int n, q;
    cin >> n >> q;

    SegmentTree seg(n);

    while (q--) {
        int com, x, y;
        cin >> com >> x >> y;
        --x;

        if (com == 0) {
            seg.Update(x, y);
        }

        else {
            long long int sum = 0;
            seg.GetSum(x, y, sum);

            cout << sum << '\n';
        }
    }

    return 0;
}


Measured memory_bytes: 3868
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <vector>
using namespace std;
const int N=200010,Mo=1000000007;
vector <int> q[N];
int a[N],b[N],v[N],id[N],f[N],L[N],d[N];
inline int gi() {
    int x=0,o=1;
    char ch=getchar();
    while(ch!='-'&&(ch<'0'||ch>'9')) ch=getchar();
    if(ch=='-') o=-1,ch=getchar();
    while(ch>='0'&&ch<='9') x=x*10+ch-'0',ch=getchar();
    return x*o;
}
inline bool cmp(const int &x,const int &y) {return a[x]<a[y];}
int main() {
    int n,s=0;
    cin>>n;
    for(int i=1;i<=n;i++) a[i]=gi(),b[i]=v[i]=gi(),id[i]=i;
    sort(v+1,v+1+n);
    for(int i=1;i<=n;i++) b[i]=lower_bound(v+1,v+1+n,b[i])-v;
    sort(id+1,id+1+n,cmp);
    for(int i=1,j=0;i<=n;i++)
	j=max(j,b[id[i]]),L[i]=j;
    for(int i=n,j=n;i;i--)
	j=min(j,b[id[i]]),q[L[i]].push_back(j);
    d[0]=f[0]=1;
    for(int i=1;i<=n;i++) d[i]=2*d[i-1]%Mo;
    for(int i=1;i<=n;i++) {
	sort(q[i].begin(),q[i].end());
	for(int j=0;j<q[i].size();j++)
	    f[i]=(f[i]+1LL*(f[q[i][j]-1]+s)*d[q[i].size()-1-j])%Mo;
	s=(s+f[i])%Mo,f[i]=(f[i]+Mo-s)%Mo;
    }
    cout<<(f[n]+s)%Mo;
    return 0;
}

Measured memory_bytes: 16640
package main

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

var sc = bufio.NewScanner(os.Stdin)

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

func altjoin(s1, s2 string) string {
	runes1 := []rune(s1)
	runes2 := []rune(s2)
	var s3 string
	len1 := len(runes1)
	len2 := len(runes2)

	if len1 > len2 {
		for i := 0; i < len1-1; i = i + 1 {
			s3 += string(runes1[i])
			s3 += string(runes2[i])
		}
		last := string(runes1[len1-1])
		return s3 + last
	} else {
		for i := 0; i < len1; i = i + 1 {
			s3 += string(runes1[i])
			s3 += string(runes2[i])
		}
		return s3
	}
}

func main() {
	odd := nextLine()
	even := nextLine()
	fmt.Print(altjoin(odd, even))
}


Measured memory_bytes: 640
from collections import deque
h, w = map(int, input().split())
s = []
for _ in range(h):
    s.append(input())
q = deque([(0, 0)])
INF = 10**5
dist = [[INF]*w for _ in range(h)]
dist[0][0] = 0
dxdy = [(-1,0), (0,-1), (0,1), (1,0)]
while q:
    x, y = q.popleft()
    for dx, dy in dxdy:
        if not(0<=x+dx<w and 0<=y+dy<h):
            continue
        if s[y+dy][x+dx]=='#' or dist[y+dy][x+dx]<INF:
            continue
        dist[y+dy][x+dx] = dist[y][x] + 1
        q.append((x+dx, y+dy))
if dist[h-1][w-1]==INF:
    print(-1)
else:
    white = 0
    for r in s:
        white += r.count('.')
    print(white-dist[h-1][w-1]-1)

Measured memory_bytes: 3316
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int length = sc.nextInt();
		sc.nextLine();
		String[] array = new String[length];
		for (int i = 0; i < length; i++) {
			//System.out.println(i);
			array[i] = sc.nextLine();
			//System.out.println(array[i]);
			if (i == 0) {
				continue;
			}

			//デバッグ用メソッド
			//System.out.println(i);

			//System.out.println(array[i].substring(0, 1));
			//System.out.println(array[i - 1].length() - 1);

			if (!(array[i].substring(0, 1)).equals(array[i - 1].substring(array[i - 1].length() - 1))) {
				System.out.println("No");
				return;
			}
		}
		//uniqueチェック
		for (int i = 0; i < length - 1; i++) {
			for (int j = i + 1; j < length; j++) {
				if (array[i].equals(array[j])) {
					System.out.println("No");
					return;
				}
			}
		}
		System.out.println("Yes");
	}

}

Measured memory_bytes: 22868
#include <iostream>
#include <cmath>
#include <vector>
#include <string>
#include <ctime>
#include <climits>
#include <iomanip>
#include <fstream>
#include <sstream>
#include <algorithm>
#include <utility>
#include <cstdlib>

using namespace std;
long int pow107 = (int)pow(10, 9) + 7;
int ilimit = INT_MAX;
long int llimit = LONG_MAX;

bool comp(pair<int, string> a, pair<int, string> b){
    if(a.first != b.first) return a.first > b.first;
    else return a.second < b.second;
}

long int jou(long int x, long int y){
    long int f = 1;
    for(int i = 0; i < y; ++i){
        f = f * x % pow107;
    }
    return f;
}

bool pn(long int x){
    if(x != 2 && x % 2 == 0)
        return false;
    for(int i = 3; i < x; ++i){
        if(x != i && x % i == 0)
            return false;
    }
    return true;
}

long int factorial(long int n){
    long int f = 1;
    for(long int i = 1; i <= n; ++i){
        f = f * i % pow107;
    }
    return f;
}

int Func2(int n,int m){
    long int s2 = 1,
        r = 1;


    for(int i = 1; i <= m; ++i){
        s2 = (s2*(n - (i - 1))/i) % pow107;
    }

    return s2;
}

//long intの最大llimit
//intの最大ilimit
//10^9+7    pow107
//素数pn
//n乗jou
//階乗factorial
//コンビネーションFunc2

int main(){
    int a,b,c;
    cin >> a >> b >> c;
    if(a < b)swap(a,b);
    if(a < c)swap(a,c);
    if(b < c)swap(b,c);

    cout << b + c << endl;

}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <cmath>
#include <string>
#include <vector>
#include <utility>
#include <iostream>
#include <algorithm>
#include <unordered_map>
#include <numeric>
#include <array>
#include <float.h>
#include <memory>
#include <functional>
#include <iomanip>
#include <queue>
#include <random>
#include <map>
#include <set>

#pragma warning(disable:4996)

using namespace std;

int main() {
  char a, b;
  bool ans = true;
  cin >> a >> b;
  if (a == 'H' && b=='D') {
    ans = false;
  }
  else if (a == 'D'&&b == 'H') {
    ans = false;
  }
  cout << (ans ? 'H' : 'D') << endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define RI(a) scanf("%d",&a)
#define RII(a,b) scanf("%d%d",&a,&b)
#define RIII(a,b,c) scanf("%d%d%d",&a,&b,&c)
#define IOS ios_base::sync_with_stdio(0); cin.tie(0)
#define ALL(a) a.begin(),a.end()
#define F first
#define S second
#define REP(i,n) for(int i=0;i<(n);i++)
#define pb push_back
#ifdef leowang
#define debug(...) do{\
	fprintf(stderr,"%s - %d : (%s) = ",__PRETTY_FUNCTION__,__LINE__,#__VA_ARGS__);\
	_DO(__VA_ARGS__);\
}while(0)
template<typename I> void _DO(I&&x){cerr<<x<<endl;}
template<typename I,typename...T> void _DO(I&&x,T&&...tail){cerr<<x<<", ";_DO(tail...);}
#else
#define debug(...)
#endif
//}}}
const ll maxn=100005;
const ll maxlg=__lg(maxn)+2;
const ll INF64=8000000000000000000LL;
const int INF=2000000000;

int n; 
int a[maxn];

int main()
{
	cin>>n;
	REP(i,n) scanf("%d",a+i);
	int ans=0;
	for(int i=0;i<n-1;i++){
		if(a[i]==i+1){
			swap(a[i],a[i+1]);
			ans++;
		}
	}
	if(a[n-1]==n) ans++;
	cout<<ans;
	return 0;
}


Measured memory_bytes: 640
n,m =map(int,(input().split()))
a=list(map(int,input().split()))
count = 0
total = 0

for i in range(n):
	total=total+a[i]
th=total/(4*m)
#print(total,th)

for i in range(n):
  if(a[i]>=(th)):
    count=count+1
#print(count)
if(count>=m):
  print("Yes")
else:
  print("No")
  
          

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

using namespace std;

int main(){
  int N;
  cin >> N;
  int A[N];
  int B[N];
  int C[N];
  //input
  for(int i = 0; i < N; i++) cin >> A[i];
  for(int i = 0; i < N; i++) cin >> B[i];
  for(int i = 0; i < N; i++) cin >> C[i];

  //sort
  sort(A,A+N);
  sort(B,B+N);
  sort(C,C+N);

  long long ans = 0;
  for(int i = 0; i < N; i++){
    ans += (lower_bound(A, A+N, B[i]) - A) * (N - (upper_bound(C,C+N, B[i]) - C));
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 1408
#include <iostream>
#include <stdio.h>
using namespace std;
int main(){
	int n;
	while(scanf("%d",&n) != EOF){
		cout<<"3C";
		if(n%39==0) cout<<"39"<<endl;
		else if(n%39<10 && n%39>0) cout<<"0"<<n%39<<endl;
		else cout<<n%39<<endl;
	}
	return 0;
}

Measured memory_bytes: 1204
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin >> n;
    set<int> st;
    for(int i = 0;i < n;i++)
    {
        int x;
        cin >> x;
        st.insert(x);
    }    
    if(st.size() % 2 == 0)
    {
        cout << st.size() - 1;
    }
    else
    {
        cout << st.size();
    }

    return 0;
}

Measured memory_bytes: 4992
#include <bits/stdc++.h>
using namespace std;
int n, m, sum = 0;
const int maxn= 1e6 + 100;
const int p = 1e9 + 7;

int f[maxn+10];
void init(){//阶乘
    f[0]=1;
    for(int i=1;i<=maxn;i++){
        f[i]=(long long)f[i-1]*i%p;
    }
}

int fast(int a,int n){
    if(n==0)return 1;
    if(n%2)return (long long)a*fast(a,n-1)%p;
    int tmp=fast(a,n/2);
    return (long long)tmp*tmp%p;
}

int C(int n,int m){
    if(n==m||m==0)return 1;
    return ((long long)f[n]*fast(f[m],p-2)%p)*fast(f[n-m],p-2)%p;
}

int main(){
	int x, y;
	while(cin >> x >> y){	
		n = (x * 2 - y);
		m = (y * 2 - x);
		if(n % 3 != 0 || m % 3 != 0 || n < 0|| m < 0){
			printf("0\n");
		}
		else{
			init();
			n /= 3;
			m /= 3;
			printf("%lld\n",C(n+m,m));
		}
	}
	return 0;
} 

Measured memory_bytes: 4096
#include <bits/stdc++.h>
#define INF 2e9
#define MOD 1000000007
#define MOD9 998244353
#define intMAX 51000;
#define PI 3.14159265359
using namespace std;
typedef long long llong;
typedef long double ldouble;

using Graph = vector<vector<int>>;

int main(){
	string S;
  cin >> S;
  int ans = 0;
  if(S=="RRR") ans = 3;
  else if(S=="RRS" || S=="SRR") ans = 2;
  else if(S=="SSS") ans = 0;
  else ans = 1;
  cout << ans << endl;
}

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

int main(){
  int N;
  int c = 200;
  cin >> N;
  
  for(int i = 0;i < N;i++){
    int A;
    int a, tmp = 0;
    cin >> A;
    a = A;
    for(int j = 0;;){
      if(a % 2 == 0){
      	tmp++;
        a /= 2;
      }
      else{
        if(tmp < c) c = tmp;
        break;
      }
    }
  }
  
  cout << c << endl;
  return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		int n = stdIn.nextInt();
		int max_idx = -1;
		int max = -1;
		for(int i=0;i<n;i++){
			int a = stdIn.nextInt();
			int b = stdIn.nextInt();
			if(max<b){
				max_idx = a;
				max = b;
			}
			else if(max==b&&max_idx>a){
				max_idx = a;
			}
		}
		System.out.println(max_idx+" "+max);
	}
}

Measured memory_bytes: 17192
# include <iostream>
# include <cmath>
# include <algorithm>
# include <stdio.h>
# include <cstdint>
# include <cstring>
# include <string>
# include <cstdlib>
# include <vector>
# include <bitset>
# include <map>
# include <queue>
# include <ctime>
# include <stack>
# include <set>
# include <list>
# include <random>
# include <chrono>
# include <deque>
# include <functional>
# include <iomanip>
# include <sstream>
# include <fstream>
# include <complex>
# include <numeric>
# include <immintrin.h>
# include <cassert>
# include <array>
# include <tuple>
# include <cctype>
# include <unordered_map>
# include <unordered_set>
//#include <bits/stdc++.h>
 
#pragma GCC optimize("Ofast")
//#pragma GCC optimization("unroll-loops, no-stack-protector")
//#pragma GCC target("avx,avx2,fma")
 
#define forn(i, n) for (int i = 0; i < (n); i++)
#define forx(i,x,n) for (int i = x; i < (n); i++)
#define form(i, n) for (int i = n-1; i>=0; i--)
#define all(x) (x).begin(), (x).end()
#define vi vector<int>
#define vl vector<long long>
#define pb push_back
#define pf push_front
#define mp make_pair
#define ll long long
#define ld long double
#define ull unsigned ll
#define srt(a) sort(a.begin(), a.end());
#define pll pair<ll, ll>
#define pii pair<int,int>
#define pld pair<ld,ld>
#define ar array
#define endl '\n';
 
using namespace std;
 
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 
template <class T> inline T gcd(T a, T b) { while (b) { a %= b; swap(a, b); } return a; }
template <class T> inline T lcm(T a, T b) { return a * b / gcd(a, b); }
 
const ll MAXN = 2005, K = 200043, M = 3005, INF = 1e18 + 7;
// the good way to get PI number
const ld PI = acos(-1.0);
ll MOD = 1e9 + 7;

template <class T> T sqr(T a) {
    return a * a;
}

ll mul(ll a, ll b) {
    return ((a % MOD) * (b % MOD)) % MOD;
}

ll sum(ll a, ll b) {
    return ((a % MOD) + (b % MOD)) % MOD;
}

ll sub(ll a, ll b) {
    return sum(a, MOD - b);
}

ll bin_pow(ll a, ll n) {
    ll res = 1;
    while (n > 0) {
        if (n & 1)
            res = mul(res, a);
        a = mul(a, a);
        n >>= 1;
    }
    return res;
}

ll inv(ll x) {
    return bin_pow(x, MOD - 2) % MOD;
}

//ll fact[MAXN];
//
//ll C(ll n, ll k) {
//    return mul(mul(fact[n], inv(fact[k])), inv(fact[n - k]));
//}

ll dp[MAXN][MAXN], n, x;

ll min_on_segment(int l, int r) {
    if (l < 0)
        return min(dp[0][r], dp[n + l][n - 1]);
    return dp[l][r];
}

void solve() {
    cin >> n >> x;
    
    vl a(n);
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
        dp[i][i] = a[i];
    }
    
    for (int i = 0; i < n; ++i)
        for (int j = i + 1; j < n; ++j)
            dp[i][j] = min(dp[i][j - 1], a[j]);
    
    ll ans = 1e18, sum = 0;
    for (int k = 0; k < n; ++k) {
        sum = k * x;
        for (int i = 0; i < n; ++i)
            sum += min_on_segment(i - k, i);
        ans = min(ans, sum);
    }
    
    cout << ans << endl;
}

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    
    int t = 1;
//    cin >> t;
    
    while (t --> 0)
        solve();
    return 0;
}


Measured memory_bytes: 26268
#include<stdio.h>
#define N 100

int main(){
  
  int i , j, k, array[N], min, min_place, num, flag, cnt = 0;
  
  scanf("%d",&num);
  
  for(i = 0; i < num; i++)scanf("%d",&array[i]);
  
  for(i = 0; i < num; i++)
    {
      flag = 0;
      
      for(j = i; j < num; j++)
	{
	  if(j == i)min = array[j];
	  if(array[j] < min)
	    {
	      min = array[j];
	      min_place = j;
	      flag = 1;
	    } 
	}
      if(flag == 1)
	{
	  array[min_place] = array[i];
	  array[i] = min;
	  cnt++;
	}
      /*for(k = 0; k < num; k++)
	{
	printf("%d",array[k]);
	printf(" ");
	if(k == num - 1)printf("\n");
	}
      */ 
    } 
  for(i = 0; i < num; i++)
    {
      printf("%d",array[i]);
      if(i == num - 1){
	printf("\n");
	break;
      }
      printf(" ");
    }

  printf("%d\n",cnt);
  
  return 0;
}



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

using VS = vector<string>;    using LL = long long;
using VI = vector<int>;       using VVI = vector<VI>;
using PII = pair<int, int>;   using PLL = pair<LL, LL>;
using VL = vector<LL>;        using VVL = vector<VL>;

#define ALL(a)  begin((a)),end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define SZ(a) int((a).size())
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))
#define FOR(i, s, e) for (int(i) = (s); (i) < (e); (i)++)
#define FORR(i, s, e) for (int(i) = (s); (i) > (e); (i)--)
//#pragma GCC optimize ("-O3") 
#ifdef YANG33
#include "mydebug.hpp"
#else
#define DD(x) 
#endif
const int INF = 1e9;                          const LL LINF = 1e16;
const LL MOD = 1000000007;                    const double PI = acos(-1.0);
int DX[8] = { 0, 0, 1, -1, 1, 1, -1, -1 };    int DY[8] = { 1, -1, 0, 0, 1, -1, 1, -1 };

/* -----  __MAKE_TIME__  Problem: __PROBLEM__ / Link: __CONTEST_URL__  ----- */
/* ------問題------



-----問題ここまで----- */
/* -----解説等-----



----解説ここまで---- */

LL lcm(LL a, LL b) {
	return (a/__gcd(a, b)) * b;
}

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

	LL N; cin>>N;
	VL a(N);
	FOR(i, 0, N) {
		cin >> a[i];
	}

	LL ans = 1;
	FOR(i, 0, N) {
		ans = lcm(ans, a[i]);
		DD(de(ans))
	}
	cout<<ans<<endl;

	return 0;
}


Measured memory_bytes: 384