akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
//#include<ext/rope>
//using namespace __gnu_cxx
//#include<ext/pb_ds/priority_queue.hpp>
//using namespace __gnu_pbds;
#define lowbit(x) (x&-x)
#define pb push_back
#define empb emplace_back
#define all(x) (x).begin(),(x).end()
#define clr(a,b) memset(a,b,sizeof(a))
#define caze(T) for(cin>>T;T;T--)
#define inf (1<<29)
#define Endl ('\n')
#define fi first
#define se second
#define db double
#define ldb long double
#define ll long long
#define pii pair<int,int>
#define pil pair<int,ll>
#define pli pair<ll,int>
#define pll pair<ll,ll>
#define ull unsigned long long
#define IOS ios::sync_with_stdio(0),cin.tie(0),cout.tie(0)
inline char nc() {
	#define SZ 1000000
	static char buf[SZ], *p1, *p2;
	return p1==p2&&(p2=(p1=buf)+fread(buf,1,SZ,stdin),p1==p2)?EOF:*p1++;
}
template<typename T>
inline int scan(T &x) {
	char c, sign=1; 
	while(!isdigit(c=nc())&&c!=EOF)if(c=='-')sign*=-1;
	if(c==EOF) return EOF;
	for(x = 0; isdigit(c); c = nc())
		x = (x<<1) + (x<<3) + (c&15);
	return x *= sign, 1;
}
template<typename T, typename...Args>
inline int scan(T &x, Args&...args) {
	return scan(x), scan(args...);
}
string s;
int main()
{
	cin>>s;
	int n=s.length();
	bool f=1;
	int a1=-1,a2=-1;
	for(int i=1;f&&i<n;++i)
		if(s[i]==s[i-1])
			a1=i,a2=i+1,f=0;
	for(int i=2;f&&i<n;++i)
		if(s[i]==s[i-2])
			a1=i-1,a2=i+1,f=0;
	cout<<a1<<' '<<a2<<Endl;
}

Measured memory_bytes: 512
N, C = map(int, input().split())
Sushi = [[int(info) for info in input().split()] for n in range(N)]
Clocksum = [0 for i in range(N+1)]
AntiClocksum = [0 for i in range(N+1)]
maxClocksum, maxAntisum = [0 for i in range(N+1)], [0 for i in range(N+1)]
for i in range(N): #一方向にのみ進む
    Clocksum[i+1] = Clocksum[i] + Sushi[i][1] - Sushi[i][0] 
    AntiClocksum[i+1] = AntiClocksum[i] + Sushi[N-i-1][1] - (C - Sushi[N-i-1][0])
    if i > 0:
        Clocksum[i+1] += Sushi[i-1][0]
        AntiClocksum[i+1] += C - Sushi[N-i][0]
    maxClocksum[i+1] = max(maxClocksum[i], Clocksum[i+1])
    maxAntisum[i+1] = max(maxAntisum[i], AntiClocksum[i+1])
maxCalorie = max(max(Clocksum), max(AntiClocksum))

#途中で折り返す
ClockToAnticlock = 0
AntiClockToClock = 0
for i in range(N-1):
    ClockToAnticlock = max(Clocksum[i+1] + maxAntisum[N-1-i] - Sushi[i][0], ClockToAnticlock)
    AntiClockToClock = max(AntiClocksum[i+1] + maxClocksum[N-1-i] - (C - Sushi[N-i-1][0]), AntiClockToClock)

print(max(maxCalorie, max(ClockToAnticlock, AntiClockToClock)))

Measured memory_bytes: 32308
N = int(input())
A = [0] + [int(_) for _ in input().split()] + [0, ]

ALL = 0
for i in range(N + 1):
    ALL += abs(A[i] - A[i + 1])

for i in range(1, N + 1):
    if A[i - 1] <= A[i] <= A[i + 1] or A[i + 1] <= A[i] <= A[i - 1]:
        print(ALL)
        continue

    ans = ALL + abs(A[i - 1] - A[i + 1]) - abs(A[i - 1] - A[i]) - abs(A[i + 1] - A[i])
    print(ans)


Measured memory_bytes: 14172
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
import java.lang.Math;
import java.util.Map;
import java.util.ArrayList;
import java.util.Collections;

public class Main {

    public static void main(String[] args) {
        FastScanner fs = new FastScanner();
        int len = fs.nextInt();
        String s = fs.next();

        if (s.length()>len) {
            for (int i = 0;i<len; i++) {
                System.out.print(s.charAt(i));
            }
            System.out.print("...");
        } else {
            System.out.println(s);
        }

    }




    static class FastScanner {
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st=new StringTokenizer("");
        String next() {
            while (!st.hasMoreTokens())
                try {
                    st=new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }
        int[] readArray(int n) {
            int[] a=new int[n];
            for (int i=0; i<n; i++) a[i]=nextInt();
            return a;
        }
        long nextLong() {
            return Long.parseLong(next());
        }
    }

}


Measured memory_bytes: 32796
#include <stdio.h> 

int main(void) 
{ 

   int H, W,i,j; 
   while(scanf("%d %d",&H,&W) != EOF){
     if(H == 0 && W == 0){
       break;
     }

     for (i = 1; i <= H; i++) { 
         for (j = 1; j <= W; j++) { 
             if(i%2 == 0 && j%2 == 1 || i%2 == 1 && j%2 == 0){
                printf("."); 
             }
             else{
                printf("#");
             }

         } 
           printf("\n"); 
        
     } 
    printf("\n");
   }
   return 0; 

} 


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


using namespace std;

#define int long long
#define all(a) a.begin(),a.end()
#define sz(x) ((int)x.size())
#define ff first 
#define ss second 
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef vector<string> vs;
typedef map<int,int> mii;
typedef map<char,int> mci;
typedef vector<vector<int>> vvi;
typedef vector<pair<int,int>> vpii;
template<class T>
istream &operator>>(istream &in, vector<T> &arr){
	for(auto &x: arr) in >> x;
	return in;
}


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

    vi a(n);
    cin >> a;
    vvi dp(n,vi(n));
    for(int gap = 0; gap < n; ++gap){
        for(int i = 0; i < n; ++i){
            int l = i, r = i + gap;
            if(r < n){
                if(l == r){
                    dp[l][r] = a[l];
                }else if(l + 1 == r){
                    dp[l][r] = max(a[l],a[r]);
                }else {
                    dp[l][r] = max(a[l] + min(dp[l+2][r],dp[l + 1][r - 1]),a[r] + min(dp[l+1][r-1],dp[l][r-2]));
                }
            }
        }
    }
    // cout << dp[0][n-1];
    int x = accumulate(all(a),0LL);
    cout << 2*dp[0][n-1] - x;
}

Measured memory_bytes: 70784
#include <iostream>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <tuple>
#include <math.h>
#include <set>
#include <stack>
#include <bitset>
#include <map>
#include <queue>
#include <random>
#include <unordered_set>
#include <unordered_map>
#define DEBUG
#define fi first
#define se second
#define pqueue priority_queue
#define pb(x) push_back(x)
#define endl '\n'
#define all(x) x.begin(), x.end()
#define int long long
#define mk(a, b) make_pair(a, b)

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef vector<int> vi;
typedef vector<vector<int> > vvi;
typedef vector<ull> vull;
typedef vector<ll> vll;
// typedef tuple<int, int, int> tiii;
typedef pair<int, int> pii;
typedef vector<pair<int, int> > vpii;
typedef vector<bool> vb;
typedef vector<string> vs;
typedef vector< vector<int> > vvi;
typedef vector<char> vc;

const int INF = 1e9;
const ll INFLL = 1e16;
const int MOD = 1000000007;
const int MAXN = 3e5;
//const ld eps = 1e-6;
const ld eps2 = 1e-9;
const int MOD2 = 998244353;
const int dosz = 5e5;
const int SZ = (1<<18);
const ld PI = atan2l(0, -1);


void fast_io(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
#ifdef DEBUG
        // freopen("a.in", "r",stdin);
#else
       // freopen("substrcmp.in", "r", stdin);
       // freopen("substrcmp.out", "w", stdout);
#endif
}

void solve(){
    string s;
    cin >> s;
    if(s[2]==s[3] && s[4]==s[5]){
        cout << "Yes" << endl;
    } else{
        cout << "No" << endl;
    }
}

signed main() {
    fast_io();
    int q = 1;
    // cout << fixed << setprecision(6);
    // cin >> q;
    // cout << 1 << endl;
    while(q--){
        solve();
    }
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<math.h>
int main(){
    int i,n,s[1000];
    double m,sum,a;
    while(1){
        scanf("%d",&n);
        if(n==0) break;
        a=0;
        sum=0;
        for(i=0;i<n;i++){
            scanf("%d",&s[i]);
            sum+=s[i];
        }
        m=sum/n;
        for(i=0;i<n;i++){
            a+=pow(s[i]-m,2.0);
        }
        a/=n;
        printf("%f\n",pow(a,0.5) );
    }

    return 0;
}



Measured memory_bytes: 2068
#include<stdio.h>

int main(void){
  
  int x[200000];
  int n, i, j;
  scanf("%d", &n);
  for(i=0;i<n;i++){
    scanf("%d", &x[i]);
  }
  int max=-1000000000, min=x[0];
  for(j=1;j<n;j++){
    if(x[j]-min>max)
      max=x[j]-min;
    if(min>x[j])
      min=x[j];   
  }
  printf("%d\n", max);
  return 0;
}

Measured memory_bytes: 3504
#include <bits/stdc++.h>
using namespace std;
vector<int>v;
string s;
int ary[100005] = {0};
int main(){
  int flag;

  char l_list[] = {'q','w','e','r','t','a','s','d','f','g','z','x','c','v','b'};
  char r_list[] = {'y','u','i','o','p','h','j','k','l','n','m'};
  cin >>s;
  while(s != "#"){
    int ans = 0;

    for(int i = 0;i<15;i++){
      if(s[0] ==  l_list[i]){
        flag = 1;
      }
    }
    for(int i = 0;i<11;i++){
      if(s[0] == r_list[i]){
        flag = 0;
      }
    }

    for(int j = 1;j < (int)s.size();j++){
      int now_flag = flag;
      for(int i = 0;i<15;i++){
        if(s[j] ==  l_list[i]){
          flag = 1;
        }
      }
      for(int i = 0;i<11;i++){
        if(s[j] == r_list[i]){
          flag = 0;
        }
      }
      if(flag != now_flag){
        ans++;
      }
    }
    v.push_back(ans);
    cin >>s;
  }

  for (int i = 0;i<(int)v.size();i++){
    cout <<v[i]<<endl;
  }
  return 0;
}



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

const int A = 1000005;

int main() {
    int n;
    cin >> n;
    vector<int> a(n), c(A);
    rep(i,n) {
        cin >> a[i];
        c[a[i]]++;
    }
    int g = 0;
    rep(i,n) g = __gcd(g,a[i]);
    if (g != 1) {
        cout << "not coprime" << endl;
        return 0;
    }     

    for (int i = 2; i < A; i++) {
        int cnt = 0;
        for (int j = i; j < A; j += i) {
            cnt += c[j];
        }
        if (cnt > 1) {
            cout << "setwise coprime" << endl;
            return 0;
        }
    }
    cout << "pairwise coprime" << endl;
    return 0;
}

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

int main()
{
   vector<int>v;
   int n,x;
   cin>>n;
   for(int i=0;i<n;i++)
   {
       cin>>x;
       v.push_back(x);
   }
   sort(v.begin(),v.end());

   int k=v[(n/2)]-v[(n/2)-1];
   cout<<k<<endl;

   return 0;
}


Measured memory_bytes: 892
fun main(args: Array<String>) {

    val n = readLine()!!.toInt()

    val h = readLine()!!.split(" ").map { it.toInt() }.toTypedArray()

    var c = 0

    // 全ての要素が条件を満たすまでループ
    while(true){
        if(h.max() == 0) break

        var i = 0
        while(i < n){
            
            // すでに条件を満たしている要素はスキップ
            if(h[i] == 0){
                i++
                continue
            }
            
            // 条件を満たしていない要素の場合は条件を満たしている要素が見つかるまで水をあげる
            c++
            while(i < n && h[i] > 0){
                h[i]--
                i++
            }
        }
    }

    println(c)
}


Measured memory_bytes: 37996
/**
  * http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ITP1_11_D&lang=jp
  * Structure and Class - Dice IV
  */
object Main {

  case class Dice(numbers: IndexedSeq[Int]) {
    def apply(number: Int): Int = {
      numbers(number)
    }

    def rotateTo(direction: Char): Dice = {
      direction match {
        case 'N' => Dice(IndexedSeq(numbers(1), numbers(5), numbers(2), numbers(3), numbers(0), numbers(4)))
        case 'S' => Dice(IndexedSeq(numbers(4), numbers(0), numbers(2), numbers(3), numbers(5), numbers(1)))
        case 'W' => Dice(IndexedSeq(numbers(2), numbers(1), numbers(5), numbers(0), numbers(4), numbers(3)))
        case 'E' => Dice(IndexedSeq(numbers(3), numbers(1), numbers(0), numbers(5), numbers(4), numbers(2)))
      }
    }

    def find(number: Int): Int = {
      // returns -1 if not found
      numbers.indexWhere(_ == number)
    }

    def adjustWith(dice: Dice): Dice = {
      val operationsToTop = Seq("", "", "N", "W", "E", "S", "NN")
      val operationsToFront = Seq("", "S", "", "WSE", "ESW", "SEEN", "N")
      val dice2 = operationsToTop(this.find(dice(0)) + 1).foldLeft(this)(_.rotateTo(_))
      val dice3 = operationsToFront(dice2.find(dice(1)) + 1).foldLeft(dice2)(_.rotateTo(_))
      dice3
    }
  }

  def main(args: Array[String]): Unit = {
    val n = io.StdIn.readInt()
    val dices = Iterator.continually(io.StdIn.readLine()).takeWhile(_ != null).take(n)
      .map(_.split(" ").map(_.toInt)).map(Dice(_))
      .toList
    val result = dices.tail.forall(e => !(dices.head == e.adjustWith(dices.head)))
    if (result)
      println("Yes")
    else
      println("No")
  }
}

Measured memory_bytes: 44240
N = int(input())
T, A = map(int, input().split())
xs = list(map(int, input().split()))

ans_ind = -1
ans_d = 100000000000

for i, x in enumerate(xs):
  t = T - x*0.006
  
  if abs(A - t) < ans_d:
    ans_ind = i+1
    ans_d = abs(A - t)
    
print(ans_ind)

Measured memory_bytes: 38384
#include <stdio.h>

int main()
{
    int monsterHealth, attacksDone, attacksAmount, isKilled;
    scanf("%d %d",&monsterHealth, &attacksDone);

    attacksAmount = monsterHealth / attacksDone;
    isKilled = attacksAmount * attacksDone >= monsterHealth;

    if (!isKilled)
    {
        attacksAmount++;
    }

    printf("%d \n", attacksAmount);

    return 0;
}


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

const int MXN=100005;

int n,k,h[MXN];
int dp[MXN];

int main(){
  scanf("%d%d",&n,&k);
  for(int i=1;i<=n;++i)scanf("%d",h+i);
  dp[n-1]=abs(h[n-1]-h[n]);
  for(int i=n-2;i>=0;--i){
    dp[i]=1e9;
    for(int j=i+1;j<=min(i+k,n);++j){
      dp[i]=min(dp[i],abs(h[i]-h[j])+dp[j]);
    }
  }
  printf("%d\n",dp[1]);
}


Measured memory_bytes: 1024
"use strict";
    
const main = arg => {
    const A = parseInt(arg.split("\n")[0].split(" ")[0]);
    const B = parseInt(arg.split("\n")[0].split(" ")[1]);
    
    console.log(A + B >= 24 ? (A + B) - 24 : A + B);
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 21064
n=int(input())
s=list(input().split())
color=[0]*4
for i in s:
    if i=="P":
        color[0]+=1
    elif i=="W":
        color[1]+=1
    elif i=="G":
        color[2]+=1
    else:
        color[3]+=1
print("Four" if color.count(0)==0 else "Three")

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

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

int main()
{
	int i;
	int N;
	int d[100010];

	scanf("%d", &N);

	for(i = 0; i<N; i++){
		scanf("%d", &d[i]);
	}

	qsort(d, N, sizeof(int), comp);	

	printf("%d", d[N/2]-d[N/2-1]);
	return 0;	

}	

Measured memory_bytes: 892
#include <iostream>
#include <cstdio>
using namespace std;
const int maxn=1e4+10;
int v[110];
int w[110];
int dp[maxn];
int main()
{
	int N,W,i,j,M=0;
	cin>>N>>W;
	for(i=1;i<=N;i++) scanf("%d%d",&v[i],&w[i]);
	for(i=1;i<=N;i++)
	{
		for(j=W;j>=w[i];j--)
		{
			dp[j]=max(dp[j],dp[j-w[i]]+v[i]);
		}
	}
	for(i=0;i<=W;i++) M=max(M,dp[i]);
	cout<<M<<endl;
}


Measured memory_bytes: 3236
#include<bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rep2(i, m, n) for(int i = (int)(m); i < (int)(n); i++)
#define rep_inv(i, n, m) for(int i = (int)(n); i > (int)(m); i--)
using namespace std;
using ll = long long;
using vl = vector<ll>;
using vc = vector<char>;
using vvl = vector<vl>;
using vvc = vector<vc>;
using pll = pair<ll, ll>;
using vpll = vector<pll>;

int main(){
  ll X, Y, Z;
  cin >> X >> Y >> Z;

  cout << (X - Z) / (Y + Z) << endl;
  
  return 0;
}


Measured memory_bytes: 256
N, M = map(int, input().split())
A = list(map(int, input().split()))
honsuu = [0,2,5,5,4,5,6,3,7,6]
aval = []
for a in A:
  aval += [honsuu[a]]
aval.sort()
 
dp = [0]+ [-float("INF")]*N 

for i in range(1,N+1):
  for b in aval:
    if i < b:
      continue
    elif dp[i-b] >= 0:
      dp[i] = dp[i-b] + 1
      break

A.sort(reverse=True)
ans = []
for i in range(dp[N],1,-1):
  for a in A:
    if N - honsuu[a] < 0:continue
    if dp[N - honsuu[a]] == dp[N] - 1:
      N -= honsuu[a]
      ans += [a]
      break
      
final = 0
for i in range(10):
  if i in A and honsuu[i] == N:
    final = i
ans += [final]
print(''.join(map(str, ans)))

Measured memory_bytes: 3700
#include <iostream>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <climits>
#include <cmath>
#include <utility>
#include <string>

using namespace std;

const int maxn = 100002;

int n, a[maxn], b;

int main() {

	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	
	cin >> n;
	for (int i = 0; i < n; ++i)
		cin >> a[i];

	long long sum = 0, sum2 = 0;
	int ans = 0;
	std::vector<int> rem;

	for (int i = 0; i < n; ++i) {
		cin >> b;

		if (b > a[i]) {
			++ans;
			sum += b - a[i];
		} else if (b < a[i]) {
			sum2 += a[i] - b;
			rem.push_back(a[i] - b);
		}
	}

	if (sum2 < sum) {
		cout << -1 << endl;
		return 0;
	}

	sort(rem.begin(), rem.end());

	int i = rem.size()-1;
	while (sum > 0 && i >= 0) {
		sum -= rem[i];
		++ans;
		--i;
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 1152
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <queue>
using namespace std;

int N,M;
vector<int> G[100001];
int n[100001];
int main(){
	cin >> N >> M;
	for(int i=0;i<M;i++){
		int x,y;
		cin >> x >> y;
		G[x].push_back(y);
		G[y].push_back(x);		
	}
	for(int i=1;i<=N;i++)n[i] = -1;
	n[1] = 0;
	queue<int> q;
	q.push(1);
	while(q.size()){
		int x = q.front();
		q.pop();
		for(int i=0;i<G[x].size();i++){
			int u = G[x][i];
			if(n[u] != -1)continue;
			n[u] = x;
			q.push(u);
		}
	}
	for(int i=1;i<=N;i++)if(n[i] == -1){cout << "No" << endl; return 0;}
	cout << "Yes" << endl;
	for(int i=2;i<=N;i++)cout << n[i] << endl;
	return 0;	
}



Measured memory_bytes: 10348
#include <iostream>
#include <vector>
#include <stack>
#include <algorithm>
using namespace std;

int main()
{
    stack<int> S1;
    stack<pair<int, int> > S2;
    char c;
    int sum = 0;

    for (int i = 0; cin >> c; ++i)
    {
        if (c == '\\')
        {
            S1.push(i);
        }
        else if (c == '/' && S1.size() > 0)
        {
            int j = S1.top();
            sum += i - j;
            int a = i - j;
            S1.pop();

            while (S2.size() > 0 && S2.top().first > j)
            {
                a += S2.top().second;
                S2.pop();
            }

            S2.push(make_pair(j, a));
        }
    }

    cout << sum << endl;

    vector<int> vec;

    while (!S2.empty())
    {
        vec.push_back(S2.top().second);
        S2.pop();
    }

    reverse(vec.begin(), vec.end());

    cout << vec.size();

    for (vector<int>::iterator it = vec.begin(); it != vec.end(); ++it)
    {
        cout << " " << *it;
    }
    
    cout << endl;

    return 0;
}


Measured memory_bytes: 3184
#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i < (n); ++i)
template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}
using namespace std;
using ll = long long;
using P = pair<int,int>;
using Pl = pair<long long,long long>;
using veci = vector<int>;
using vecl = vector<long long>;
using vecveci = vector<vector<int>>;
using vecvecl = vector<vector<long long>>;
const int MOD = 1000000009;
const double pi = acos(-1);

int main() {
    int N; cin >> N;
    veci A(N); REP(i,N) cin >> A[i];
    vector<P> res;

    int i = 0;
    while(i < N) {
        int c = A[i];
        int cnt = 1;
        while(c == A[i+cnt] && i+cnt < N) cnt++;
        res.push_back(P(c,cnt));
        i += cnt;
    }

    int ans = 0;
    for(auto p : res) ans += p.second/2;
    cout << ans << endl;
}

Measured memory_bytes: 3608
#include<stdio.h>
#include<string.h>

int main(){
  char a[10000000],b[200];
  int c=0,d;
  scanf("%s %s",&a,&b);
  strcat(a,b);
 
  c=atoi(a);
  
  for(int i=1;i<1000;i++){
    d=i*i;
    if(c==d){
      printf("Yes\n");
      return 0;
    }
  }
  printf("No\n");
  return 0;
}



Measured memory_bytes: 128
#include <bits/stdc++.h>
#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define repeq(i,n) for(int (i)=0;(i)<=(int)(n);(i)++)
#define rep1(i,x,n) for(int (i)=(x);(i)<(int)(n);(i)++)
#define rep1eq(i,x,n) for(int (i)=(x);(i)<=(int)(n);(i)++)
#define rrep(i,x) for(int i=((int)(x)-1);i>=0;i--)
using namespace std;
using ll = long long;
using Int = long long;

const int MOD = 1000000007;
const ll INF = numeric_limits<ll>::max();
const int inf = 1e8;
//typedef pair<int,int> P;

//少数点表示
//cout << std::fixed << std::setprecision(14) <<double値

int main(){
    cin.tie( 0 ); ios::sync_with_stdio( false );
    ll n;
    cin >> n;
    map<ll,ll> am;
    vector<ll> a(n);
    rep(i,n){
        cin >> a[i];
        if(am.count(a[i]) == 0){
            am[a[i]] = 1;
        }else{
            am[a[i]]++;
        }
    }
    vector<ll> aans(n);
    ll all = 0;
    for(auto i = am.begin(); i != am.end(); ++i){
        ll v = i->second;
        all += v*(v-1)/2;
    }

    rep(i,n){
        ll ans = 0;
        ans = all - am[a[i]] + 1;
        cout << ans << endl;
    }

}

Measured memory_bytes: 12672
n = int(input())

f = list()
for i in range(n):
    temp = list(map(str, input().split()))
    bin_str = ''
    for j in range(10):
        bin_str = bin_str + temp[j]

    f.append(int(bin_str, 2))

p = list()
for i in range(n):
    p.append(list(map(int, input().split())))

max_sell = -10**10
open = 0
for i in range(2**10):
    temp_sell = 0

    open_list = '{:010b}'.format(open)
    open_flag = False
    check = 0
    for j in range(5):
        check = int(open_list[j * 2]) + int(open_list[j * 2 + 1])
        if(check > 0):
            open_flag = True
            break

    if(open_flag):
        for j in range(n):
            res_temp = open & f[j]
            count = bin(res_temp).count('1')

            temp_sell += p[j][count]

        if(temp_sell > max_sell):
            max_sell = temp_sell

    open += 1

print(max_sell)


Measured memory_bytes: 3064
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>

typedef struct CARD {
	int seqno;
	char suit;
	int number;

} CARD;

void swap_ref(CARD **p1, CARD **p2){
	CARD *tmp;
	tmp = *p1;
	*p1 = *p2;
	*p2 = tmp;
}

typedef int (*CARD_CHECKER)(CARD *p1, CARD *p2);

int sort_by_number_asc(CARD *p1, CARD *p2){
	return p1->number - p2->number;
}

int sort_by_seqno_asc(CARD *p1, CARD *p2){
	return p1->seqno - p2->seqno;
}

typedef int (*CARD_REF_SORTER)(CARD **card_ref_list, int size, CARD_CHECKER checker);

int bubble_sort(CARD **card_ref_list, int size, CARD_CHECKER checker){
	int swap_count = 0;
	int i,j;

	for(i=0;i<size;i++){
		for(j=size-1;j>i;j--){
			if( checker( card_ref_list[j], card_ref_list[j-1] ) < 0 ){
				swap_ref( card_ref_list + j, card_ref_list + j - 1 );
				swap_count++;
			}
		}
	}

	return swap_count;
}

int select_sort(CARD **card_ref_list, int size, CARD_CHECKER checker){
	int swap_count = 0;
	int i,j,minj;

	for(i=0;i<size;i++){
		minj = i;
		for(j=i;j<size;j++){
			if( checker( card_ref_list[j], card_ref_list[minj] ) < 0 ){
				minj = j;
			}
		}
		if( i != minj ){
			swap_ref( card_ref_list + i, card_ref_list + minj );
			swap_count++;
		}
	}

	return swap_count;
}

void print_card_ref_list(CARD **card_ref_list, int size){
	int i;
	for(i=0;i<size;i++){
		if( i >= 1 ){
			putchar(' ');
		}
		// printf("[%d]",card_ref_list[i]->seqno);
		printf("%c",card_ref_list[i]->suit);
		printf("%d",card_ref_list[i]->number);
	}
	putchar('\n');
}

int is_stable(CARD **card_ref_list, int size, CARD_CHECKER checker){
	int i;
	int check_result;

	for(i=0;i<size-1;i++){
		check_result = checker(card_ref_list[i], card_ref_list[i+1]);
		if( check_result > 0 ){
			// Not Stable
			return 0;
		} else if( check_result < 0 ){
			// Stable -> Check Next
		} else {
			if( sort_by_seqno_asc( card_ref_list[i], card_ref_list[i+1] ) > 0 ){
				// Not Stable
				return 0;
			} else {
				// Stable -> Check Next
			}
		}
	}

	return 1;
}

int main(int argc, char** argv){
	CARD_REF_SORTER card_ref_sorter_list[] = { bubble_sort, select_sort };
	int n;
	CARD *card_list,**card_ref_list;
	int i;
	char s[3];

	// Input & Create CARD List
	scanf("%d",&n);
	card_list = malloc(sizeof(CARD)*n);
	card_ref_list = malloc(sizeof(CARD*)*n);
	for(i=0;i<n;i++){
		scanf("%2s",s);
		card_list[i].seqno = i;
		card_list[i].suit = s[0];
		card_list[i].number = atoi(s+1);
		card_ref_list[i] = &card_list[i];
	}

	// Sort & Check
	for(i=0;i<sizeof(card_ref_sorter_list)/sizeof(CARD_REF_SORTER);i++){
		// Sort
		card_ref_sorter_list[i](card_ref_list, n, sort_by_number_asc);
		// Output Sorte d List
		print_card_ref_list(card_ref_list, n);
		// Check Stable or Not
		if( is_stable(card_ref_list, n, sort_by_number_asc) ){
			printf("Stable\n");	
		} else {
			printf("Not stable\n");	
		}
		// Reset List
		card_ref_sorter_list[i](card_ref_list, n, sort_by_seqno_asc);
	}

	// Delete CARD List
	free(card_list);
	free(card_ref_list);

	return 0;
}

Measured memory_bytes: 616
#include<bits/stdc++.h>
using namespace std;
const int MAXN = 1e5+7;
const int INF = 1e6+7;
vector<pair<int, int> > adj[MAXN];
priority_queue<pair<int, int> > q;

int d[MAXN];
bool visit[MAXN];
int n;
set<int> s;
void djas() {
    d[0] = 0;
    for(int i = 1; i < n; i++) {
        d[i] = INF;
    }
    q.push(make_pair(0, 0));
    while(!q.empty()) {
        pair<int, int> s1 = q.top(); q.pop();
        int u = s1.second;
        visit[u] = true;
        for(int j = 0; j < adj[u].size(); j++) {
            int v = adj[u][j].second;
            if(visit[v]==false) {
                if(d[v]>d[u]+adj[u][j].first) {
                    d[v] = d[u]+adj[u][j].first;
                    q.push(make_pair((-1)*d[v],v));
                }
            }
        }
    }
}
int main() {
//    freopen("in.txt", "r", stdin);
    memset(visit, false, sizeof(visit));
    scanf("%d", &n);
    int v;
    int c;
    int id;
    int degree;
    for(int i = 0; i < n; i++) {
        scanf("%d", &id);
        scanf("%d", &degree);
        for(int j = 0; j < degree; j++) {
            scanf("%d", &v);
            scanf("%d", &c);
            adj[id].push_back(make_pair(c,v));
        }
    }
    djas();
    for(int i = 0; i < n; i++) {
        printf("%d %d\n", i, d[i]);
    }

    return 0;
}



Measured memory_bytes: 10316
#include<cstdio>
#include<iostream>
#include<algorithm>
using namespace std;
const int maxn =(int)2e5+7;
int a[maxn];
int b[maxn];
int dp[maxn];
int DP_LIS(int n)// NLOGN LIS
{
	if(n==0)return 0;//ery important!!
	int len;
	dp[1]=a[1];
	len=1;
	for(int i=2;i<=n;i++)
	{
		if(a[i]>dp[len])dp[++len]=a[i];
		else
		{
			int pos=lower_bound(dp,dp+len,a[i])-dp;
			dp[pos]=a[i];
		}
	}
	return len;
}

int main()
{
	int n;
	cin>>n;
	for(int i=1;i<=n;i++)
	{
		scanf("%d",&a[i]);
		b[a[i]]=i; 
	}
	//for(int i=1;i<=n;i++)cout<<b[i]<< " "; 
	for(int i=1;i<=n;i++)a[i]=b[i];
	int mx=0;
	int cnt=1; 
	for(int i=1;i<=n;i++)
	{
		if(a[i]<a[i+1])cnt++;
		else{
			mx=max(mx,cnt);
			cnt=1;
		}
		mx=max(mx,cnt);
	}
	cout<<n-mx<<endl;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for (long long i = 0, max_i = (n); i < max_i; i++)
template <class T>
ostream& operator<<(ostream& s, vector<T>& d) {
    REP(i, d.size()) s << d[i] << (i == d.size() - 1 ? "" : " ");
    return s;
}
using Int = long long;

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

    Int n, K;
    cin >> n >> K;
    vector<vector<Int>> g(n);
    vector<Int> ps(n);
    REP(i, n) {
        Int p;
        cin >> p;
        ps[i] = p;
        if (p) {
            g[p - 1].push_back(i);
        }
    }

    vector<bool> use(n);
    vector<Int> rem(n, -1);
    function<Int(Int)> dfs = [&](Int v) {
        if (g[v].size() == 0) return rem[v] = K;
        if (rem[v] != -1) return rem[v];
        Int ma = 0;
        for (Int s : g[v]) {
            ma = max(ma, dfs(s) - 1);
        }
        return rem[v] = ma;
    };
    REP(i, n) { dfs(i); }
    int ans = 0;
    REP(i, n) {
        ans += (rem[i] > 0 || ps[i] == 0);
        // cerr << ans << " " << i << endl;
    }
    cout << ans << endl;
}



Measured memory_bytes: 15984
#include <bits/stdc++.h>
#define PI acos(-1)
using namespace std;
int main() {
	double a, b, h, m; cin >> a >> b >> h >> m;
	double a1 = abs(5.0 * (h + m / 60.0) - m);
	double a2 = 60.0 - a1;
	double a3 = 2.0 * PI * min(a1, a2) / 60.0;
	printf("%.9f", sqrt(a * a + b * b - 2 * a * b * cos(a3)));
}

Measured memory_bytes: 4212
#include <iostream>

#define REP(i, a, b) for ( int i = (a); i < (b); i++ )
#define REVREP(i, a, b) for ( int i = (a); i >= (b); i--)
#define DEBUG_INT(var) printf("the value of "#var" is %d\n", var)
#define PRINT_ARRAY(name, i) printf("the value of "#name"[%d] is %d\n", (i), name[(i)])
#define DEBUG_ARRAY(name, begin, end) REP(i, begin, end) PRINT_ARRAY(name, i)

typedef long long ll;

using namespace std;

ll N, M;

int main(void) {
    scanf("%lld %lld", &N, &M);
   
    if(N>1 && M>1) printf("%lld\n", (N-2)*(M-2));
    else if (N==1 && M==1) puts("1");
    else printf("%lld\n", N*M-2);
    

	return 0;
}


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

int main(){
  int x1, x2, sum, N;
  sum = 0;

  cin >> N;
  for(int i=0; i<N; i++){
  	cin >> x1 >> x2;
  	sum += (x2 -x1 + 1);
  }
  cout << sum << endl;
}

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

int main(){
	int a,b,c;scanf("%d%d%d",&a,&b,&c);
	if(a+b<c)puts("NA");
	else printf("%d\n",max(0,c-a));
}

Measured memory_bytes: 3172
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) FOR(i,0,n)
#define repr(i,n) for(int i=(n)-1;0<=i;--i)
#define each(e,v) for(auto&& e:(v))
#define all(v) begin(v),end(v)
#define dump(x) cerr<<#x<<": "<<(x)<<endl
using namespace std;
using vint = vector<int>;
using ll = long long;
using vll = vector<ll>;
template <class T> void chmin(T& a, const T& b) { a = min(a, b); }
template <class T> void chmax(T& a, const T& b) { a = max(a, b); }
void yes() { cout << "Yes" << endl; exit(0); }
void no() { cout << "No" << endl; exit(0); }

int main() {
    int n; cin >> n;
    string s, t; cin >> s >> t;
    rep(i, n) {
        cout << s[i] << t[i];
    }
    cout << endl;
    return 0;
}


Measured memory_bytes: 256
#include <queue>
#include <vector>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <iostream>
#include <algorithm>
using namespace std;
typedef long long ll;
const int inf=0x3f3f3f3f;
const int maxn=20010;
struct edge{
    int to,cost,val;
    edge(){}
    edge(int a,int b,int c){to=a;cost=b;val=c;}
};
typedef pair<int,int>P;
vector<edge>G[maxn];
int dis[maxn],value[maxn];
void dijkstra(int st){
    priority_queue<P,vector<P>,greater<P> >que;
    fill(dis,dis+maxn,inf);
    fill(value,value+maxn,inf);
    dis[st]=0;
    que.push(P(0,st));
    while(!que.empty()){
        P p=que.top();que.pop();
        int v=p.second;
        if(dis[v]<p.first) continue;
        for(unsigned int i=0;i<G[v].size();i++){
            edge e=G[v][i];
            if(dis[e.to]>dis[v]+e.cost){
                dis[e.to]=dis[v]+e.cost;
                value[e.to]=e.val;
                que.push(P(dis[e.to],e.to));//因为都是从1出发，例如1到3最小距离是通过1->2->3这样的，我们将1->3的费用就记为
                                            //2->3的费用，因为1->2的费用肯定已经会花的，要的是用的每条路的费用，所以最后将1到
                                            //每个点的费用加起来就行了
            }else if(dis[e.to]==dis[v]+e.cost){//相等时要小的费用
                value[e.to]=min(value[e.to],e.val);
            }
        }
    }
}
int main(){
    int n,m,a,b,c,d;
    while(scanf("%d%d",&n,&m)!=-1){
        if(n==0&&m==0) break;
        for(int i=0;i<maxn;i++) G[i].clear();
        for(int i=0;i<m;i++){
            scanf("%d%d%d%d",&a,&b,&c,&d);
            G[a].push_back(edge(b,c,d));
            G[b].push_back(edge(a,c,d));
        }
        dijkstra(1);
        int ans=0;
        for(int i=2;i<=n;i++) ans+=value[i];
        printf("%d\n",ans);
    }
    return 0;
}



Measured memory_bytes: 5440
// 150 b

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


int main() {
    int n;
    string s;
    int count;

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


Measured memory_bytes: 256
#include<stdio.h>
  
main() {
  int m, f, b;
  scanf("%d %d %d", &m, &f, &b);
  if ( m >= b ) printf("0\n");
  else if ( m + f >= b ) printf("%d\n", b - m );
  else printf("NA\n");

  return 0;
}



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

using namespace std;

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

    string output;

    // 偶数
    if(a*b%2 == 0)
    {
        output = "Even";
    }
    // 奇数
    else
    {
        output = "Odd";
    }

    cout << output << endl;
}

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

void out(int n){
	std::cout << "line = " << n << std::endl;
}
class Edge{
public:
	int node, weight;
	Edge(const int &n = 0, const int &w = 0):node(n), weight(w){};
};
class Node{
public:
	int node, weight;
	Node(const int &n, const int &w):node(n), weight(w){};
	bool operator<(const Node &other) const {return weight > other.weight;}
	bool operator>(const Node &other) const {return other.weight > weight;}
	bool operator==(const Node &other) const {return weight == other.weight;}
	bool operator<=(const Node &other) const {return weight >= other.weight;}
	bool operator>=(const Node &other) const {return other.weight >= weight;}

};
int main(){
	int v, e, r;
	std::cin >> v >> e >> r;
	std::vector<std::vector<Edge>> edges(v);
	std::vector<int> weight(v, INT_MAX);
	for (auto i = 0; i < e; ++i){
		int s, t, d;
		std::cin >> s >> t >> d;
		edges.at(s).push_back(Edge(t, d));
	}
	for (auto i = 0; i < v; ++i){
		edges.at(i).push_back(Edge(i, 0));
	}
	std::priority_queue<Node> queue;
	queue.push(Node(r, 0));
	while (queue.size() != 0){
		weight.at(queue.top().node) = queue.top().weight;
		for (Edge edge : (edges.at(queue.top().node))){
			if (weight.at(edge.node) > edge.weight + queue.top().weight){
				queue.push(Node(edge.node, edge.weight + queue.top().weight));
			}
		};
		while ((queue.top().weight >= weight.at(queue.top().node)) and (queue.size() > 0)){
			//out(100);out(queue.top().node);out(queue.top().weight);
			queue.pop();
		}
	}
	for (auto w : weight){
		if (w == INT_MAX){
			std::cout << "INF\n";
		}else{
			std::cout << w << "\n";
		}
	}
}

Measured memory_bytes: 13796
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <iomanip>
#include <queue>
#include <deque>
#include <map>
#include <unordered_map>
#define rep(i,n) for(int i=0;i<n;i++)
#define repn(i,n) for(int i=1;i<=n;i++)
#define repr(e,x) for(auto& e:x)
using namespace std;
typedef long long ll;
typedef long double ld;
ll const MOD=1000000007;

ll N;
ll num[1001];
ll cnt[1001];

int main(){
    cin>>N;
    repn(i,N) num[i]=i;

    repn(i,N){
        repn(j,N){
            if(j==1) continue;
            while(num[i]%j==0){
                cnt[j]++;
                num[i]/=j;
            }
        }
    }

    ll ans=1;
    repn(i,N){
        ans*=cnt[i]+1;
        ans%=MOD;
    }

    cout<<ans<<endl;
}

Measured memory_bytes: 3624
#include <iostream>
#include <iomanip>
#include <cmath>
#include <vector>
#include <queue>
#include <limits>
#include <algorithm>
#include <string>
using namespace std;
 
int main()
{
	int64_t x;
	cin >> x;
 
	int64_t res = x / 11;
	x -= res * 11;
	res *= 2;
	if (x > 0)
		res += x < 7 ? 1 : 2;
	cout << res << endl;
 
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define all(x)  x.begin(),x.end()
#define vi vector<int>
#define vll vector<ll>
#define print(x) for(auto it=x.begin();it!=x.end();it++) cout<<*it<<' '; cout<<'\n';
#define debug(a,b,c) cout << a << " " << b << " " << c << endl;
#define in(x,n) for(int e=0;e<n;e++){int y;cin>>y;x.pb(y);}
#define inl(x,n) for(int e=0;e<n;e++){ll y;cin>>y;x.pb(y);}
#define lower(sl)  transform(sl.begin(), sl.end(), sl.begin(), ::tolower); 

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
      int x1,x2;
      cin >> x1 >> x2;
      if((4*x1-x2)%2==0 and (4*x1-x2>=0) and ((4*x1-x2)/2)<=x1) cout << "Yes" << endl;
      else cout << "No" << endl;
      
}


Measured memory_bytes: 3600
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cctype>
#include <algorithm>
#include <numeric>
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <complex>
#include <sstream>
#include <deque>

#define REP(i, n) for ( int i = 0; i < n; i++ )
#define MP(a, b) make_pair(a, b)

using namespace std;

typedef pair<vector<int>, int> data;

/*
全探索
9! = 362880 余裕

持っている配列、ステップ数
*/

int sum(vector<int> nums) {
    int sum = 0;
    REP(i, nums.size()) {
        sum += nums[i];
    }
    return sum;
}

bool insertable(int num, vector<int> nums) {
    REP(i, nums.size()) {
        if ( num == nums[i] ) return false;
    }
    return true;
}

int dump(vector<int> n) {
    REP(i, n.size()) {
        cout << n[i] << " ";
    }
    cout << endl;
}

int main() {
    int n, s;

    while(cin >> n >> s, n||s) {
        queue<data> open;
        int cnt = 0;

        // 初期値をpush
        REP(i, 10-(n-1)) {
            vector<int> num(n);
            num[0] = i;
            open.push( MP(num, 1) );
        }

        while(!open.empty()) {
            data d = open.front(); open.pop();
            vector<int> nums = d.first;
            int c = d.second;

            // cout << c << " " << n << endl;
            if ( c == n ) {
                if ( s == sum(nums) ) {
                    cnt++;
                    // dump(nums);
                }
                continue;
            }

            for ( int i = nums[c-1]; i <= 9; i++ ) {
                if ( insertable(i, nums) ) {
                    nums[c] = i;
                    open.push( MP(nums, c+1) );
                }
            }
        }
        cout << cnt << endl;
    }
    
    return 0;
}

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

int main()
{
	ll n;
	cin >> n;
	map<char, ll> name_cnt;
	for (int i = 0; i < n; i++) {
		string s;
		cin >> s;
		switch (s[0]) {
		case 'M': name_cnt[s[0]]++;  break;
		case 'A': name_cnt[s[0]]++;  break;
		case 'R': name_cnt[s[0]]++;  break;
		case 'C': name_cnt[s[0]]++;  break;
		case 'H': name_cnt[s[0]]++;  break;
		default: break;
		}
	}

	vector<ll> d = { name_cnt['M'],name_cnt['A'], name_cnt['R'], name_cnt['C'], name_cnt['H'] };
	vector<ll> p = { 0,0,0,0,0,0,1,1,1,2 };
	vector<ll> q = { 1,1,1,2,2,3,2,2,3,3 };
	vector<ll> r = { 2,3,4,3,4,4,3,4,4,4 };

	ll res = 0;
	for (int i = 0; i < 10; i++) res += d[p[i]] * d[q[i]] * d[r[i]];
	cout << res << endl;
}


Measured memory_bytes: 256
//#pragma GCC optimize("Ofast")
//#pragma GCC target("avx,avx2,fma")

#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

#define Q int t; scanf("%d", &t); for(int q=1; q<=t; q++)
typedef long long int lli;
typedef pair<int, int> pi;
#define oset tree<pi, null_type,greater<pi>, rb_tree_tag,tree_order_statistics_node_update>


int main()
{
    int n;
    cin >> n;
    vector<lli> v, c;
    for(int i=0; i<n; i++){
        lli x;
        cin >> x;
        v.push_back(x);
    }
    for(int i=0; i<n; i++){
        lli x;
        cin >> x;
        c.push_back(x);
    }
    lli mx = -1e9;
    for(int i=0; i<(1<<n); i++){
        lli x = 0, y=0;
        for(int j=0; j<n; j++){
            if(i&(1<<j)){
                x+=v[j];
                y+=c[j];
            }
        }
        mx = max(mx, x-y);
    }
    cout << mx << endl;

    return 0;
}


Measured memory_bytes: 3600
#include<iostream>
#include<algorithm>
#include<cmath>
#define REP(i,n) for(int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<=(b);i++)
#define INIT 1000000
using namespace std;

int N;
int Coin[12];
int dp[100005] ;
int main()
{
	Coin[0] = 1;
	FOR(i, 1, 6)Coin[i] = pow(6, i);
	FOR(i, 1, 5)Coin[6+i] = pow(9, i);
	REP(i, 100005)dp[i] = INIT;
	dp[0] = 0;
	cin >> N;
	
	FOR(i, 0, 11)
	{
		FOR(j, Coin[i], N)
		{
			dp[j] = min(dp[j], dp[j - Coin[i]] + 1);
		}
	}
	cout << dp[N] << endl;
	return 0;
}

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

using namespace std;

int main(){

	int n;
  cin>>n;
  vector<int>a(n);
  
  for(int i=0;i<n;i++){
  	cin>>a[i];
  }
  
  
  int count =0;
  
  for(int i=0;i<n;i++){
  	bool done = true;
    
    for(int j=i-1;j>=0;j--){
    	if(a[j]>a[i]){
        	done = false;
          	break;
        }
    }
    
    if(done){
    	count++;
    }
  
  }
  
  cout<<count;

}


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

using namespace std;

typedef long long ll;

int main()
{
    ios_base::sync_with_stdio(0);
    int n, v;
    cin >> n >> v;
    vector<int> a(n);
    for (int i = 0; i < n; ++i)
        cin >> a[i];
    ll dp[50][51][2501];
    for (int i = 0; i < 50; ++i)
        for (int j = 0; j < 51; ++j)
            for (int k = 0; k < 2501; ++k)
                dp[i][j][k] = 0;
    for (int i = 0; i < n; ++i)
    {
        for (int j = 1; j < n + 1; ++j)
        {
            for (int k = 1; k < 2501; ++k)
            {
                if (i - 1 >= 0)
                    dp[i][j][k] += dp[i - 1][j][k];
                if (i - 1 >= 0 && j - 1 >= 1 && k - a[i] >= 1)
                    dp[i][j][k] += dp[i - 1][j - 1][k - a[i]];
            }
        }
        ++dp[i][1][a[i]];
    }
    ll odp = 0;
    for (int i = 1; i < n + 1; ++i)
        odp += dp[n - 1][i][v * i];
    cout << odp;
    return 0;
}


Measured memory_bytes: 50176
// AtCoder Beginner Contest 070
// A - Palindromic Number

#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;


int N;

int main() {

    cin >> N;

    cout << ((N / 100 == N % 10) ? "Yes" : "No") << endl;

    return 0;

}





Measured memory_bytes: 256
import java.util.Comparator;
import java.util.PriorityQueue;
import java.util.Scanner;

public class Main {
    public static void main(String [] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        long[] a = new long[n];
        long[] b = new long[n];
        for (int i = 0; i < n; ++i) {
            a[i] = scanner.nextLong();
        }
        for (int i = 0; i < n; ++i) {
            b[i] = scanner.nextLong();
        }
        int lessNum = 0;
        int moreNum = 0;
        long less = 0;
        long more = 0;
        for (int i = 0; i < n; ++i) {
            if (a[i] < b[i]) {
                less += b[i] - a[i];
                ++lessNum;
            }
        }
        if (less == 0) {
            System.out.println(0);
            return;
        }
        PriorityQueue<Long> moreScore = new PriorityQueue<>(
                Comparator.reverseOrder()
        );
        for (int i = 0; i < n; ++i) {
            if (a[i] > b[i]) {
                more += a[i] - b[i];
                moreScore.add(a[i] - b[i]);
            }
        }
        if (more < less) {
            System.out.println(-1);
            return;
        }
        int result = lessNum;
        while (!moreScore.isEmpty() && less > 0) {
            long delta = moreScore.poll();
            less -= delta;
            ++result;
        }


        System.out.println(result);


    }
}


Measured memory_bytes: 91552
n,k = map(int, input().split())

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

for _ in range(min(100,k)):
    imos = [0]*(n+1)
    for i,a in enumerate(al):
        l = max(0,i-a)
        r = min(n,i+a+1)
        imos[l] += 1
        imos[r] -= 1
    new_al = []
    curr_val = 0
    for im in imos[:-1]:
        curr_val += im
        new_al.append(curr_val)
    al = new_al[:]

print(*al)

Measured memory_bytes: 187604
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <chrono>
#define _USE_MATH_DEFINES
#include <cmath>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iostream>
#include <iterator>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <string>
#include <tuple>
#include <utility>
#include <vector>
using namespace std;

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

const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;
const double EPS = 1e-8;
const int MOD = 1000000007; // 998244353;
const int dy[] = {1, 0, -1, 0}, dx[] = {0, -1, 0, 1};
/*-------------------------------------------------*/
vector<int> graph[200000];
long long cnt[200000] = {};
void dfs(int par, int ver) {
  for (int e : graph[ver]) if (e != par) {
    cnt[e] += cnt[ver];
    dfs(ver, e);
  }
}

int main() {
  cin.tie(0); ios::sync_with_stdio(false);
  // freopen("input.txt", "r", stdin);

  int n, q; cin >> n >> q;
  REP(_, n - 1) {
    int a, b; cin >> a >> b; --a; --b;
    graph[a].emplace_back(b);
    graph[b].emplace_back(a);
  }
  while (q--) {
    int p, x; cin >> p >> x; --p;
    cnt[p] += x;
  }
  dfs(-1, 0);
  REP(i, n) cout << cnt[i] << (i == n - 1 ? '\n' : ' ');
  return 0;
}


Measured memory_bytes: 24320
import sys
from sys import stdin

h, w = map(int, stdin.readline().rstrip().split())
a = [stdin.readline().rstrip() for i in range(h)]
count = 0
for i in a:
    for j in i:
        if j == '#':
            count += 1
if h + w - 1 == count:
    print('Possible')
else:
    print('Impossible')

Measured memory_bytes: 3060
#include <iostream>
#include <numeric>

long GCD(long a, long b)
{
    if (b == 0)
        return a;
    return GCD(b, a % b);
}

long LCM(long a, long b)
{
    return a * (b / GCD(a, b));

}

int main(void) {
	long A, B;
    std::cin >> A >> B;
	std::cout << LCM(A,B);
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define  gcd(a,b) __gcd(a,b)
#define  lcm(a,b) (a*b)/gcd(a,b)
#define  PI acos(-1.0)
#define  sqr(x) ((x)*(x))
#define  min3(a,b,c) min(a,min(b,c))
#define  min4(a,b,c,d) min(d,min(a,min(b,c)))
#define  max4(a,b,c,d) max(d,max(a,max(b,c)))
typedef   pair<int, int> ii;
typedef   std::vector<ii> vii;
#define   vi   std::vector<int>
#define   vll  std::vector<ll>
#define   all(n) n.begin(),n.end()
#define  mpsi std::map<string, int>
#define  pb             push_back
#define  ll             long long int
#define  ln             printf("\n");
#define  fast           ios::sync_with_stdio(false);cin.tie(0)
#define  max3(a,b,c)    max(a,max(b,c))
#define setbits(x)      __builtin_popcountll(x)
#define zerobits(x)     __builtin_ctzll(x)
#define dec(x,y)        fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)
mt19937                 rng(chrono::steady_clock::now().time_since_epoch().count());
#define  mod           1e9 + 7;
int main()
{
    fast;
    ll n;
    cin >> n;
    ll v[n];
    ll i,j;
    ll cnt = 0;
    ll pnt = 0;
    ll k;
    for(i = 0; i<n; i++){
        cin >> v[i];
    }

    for(i = n-2; i>=1; i--)
    {
        if(v[i] < v[i-1] && v[i] > v[i+1])
            cnt++;
        else if(v[i] > v[i-1] && v[i] < v[i+1])
            cnt++;
    }
    cout << cnt << endl;
}


Measured memory_bytes: 256