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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

#define INF 1<<30
#define LINF 1ll<<60ll
#define MOD 1000000007
#define pb(a) push_back(a)

#define _overload3(_1,_2,_3,_4,name,...) name
#define _rep(i,n) _repi(i,0,n)
#define _repi(i,a,b) for(int i=a, i##_len=(b); i<i##_len; ++i)
#define _repis(i,a,b,s) for(int i=a, i##_len(b); i<i##_len; i+=s)
#define REP(...) _overload3(__VA_ARGS__,_repis,_repi,_rep,)(__VA_ARGS__)

#define REPR(i, n) for(int i = n;i >= 0;--i)
#define REPARR(i, v) for(int i = 0;i < sz(v);++i)

#define all(vec) (vec.begin()),(vec.end())
#define sz(x) ((int)(x).size())
#define bit(n) (1ll<<(n))

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

#define YES(n) cout<<((n)?"YES":"NO")<<endl
#define Yes(n) cout<<((n)?"Yes":"No")<<endl
#define yes(n) cout<<((n)?"yes":"no")<<endl
#define poss(n) cout<<((n)?"possible":"impossible")<<endl
#define Poss(n) cout<<((n)?"Possible":"Impossible")<<endl
#define POSS(n) cout<<((n)?"POSSIBLE":"IMPOSSIBLE")<<endl

ll p(int n,int k){
    int ans=1;
    REP(i,k){
        ans*=n;
    }
    return ans;
}

int main(){
    ll n,k;
    cin>>n>>k;
    cout<<k*p(k-1,n-1)<<endl;
    return 0;
}


Measured memory_bytes: 256
def rot(x0, y0, x1, y1):
    a = x0 - x1
    b = y0 - y1
    return (b + x1,  -a + y1)

x1, y1, x2, y2 = [int(i) for i in input().split()]
x3, y3 = rot(x1, y1, x2, y2)
x4, y4 = rot(x2, y2, x3, y3)
print(x3, y3, x4, y4)


Measured memory_bytes: 3316
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm> 
using namespace std;
long long a[200010];
const long long mod=998244353;
long long ksm(long long a,long long b)
{
//	cout<<a<<' '<<b<<'\n';
	long long ans=1;
	for(long long i=1;i<=b;i++)
	  ans=(ans*a)%mod;
/*	while(b>0)
	{
		if(b&1)
		  ans=((long long)ans*a)%mod;
		a=((long long)a*a)%mod;
		b>>=1; 
	//	cout<<ans<<'\n';
	}
//	cout<<ans<<'\n';*/
	return ans%mod;
}
int main()
{
	long long n;
	scanf("%lld",&n);
	long long maxn=0;
	long long ans=1;
	for(long long i=1;i<=n;i++)
	{
		long long x;
		scanf("%lld",&x);
		if(i==1&&x!=0)
		{
			puts("0");
			return 0; 
		} 
		a[x]++;
		maxn=max(maxn,x);
	}
	if(a[0]!=1)
	{
		puts("0");
		return 0;
	}
	for(long long i=1;i<=maxn;i++)
	{
		ans=((long long)ksm(a[i-1],a[i])*ans)%mod;
	}
	cout<<ans%mod<<'\n';
	return 0;
}

Measured memory_bytes: 1024
#pragma warning disable

using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.Serialization.Formatters.Binary;
using System.Text;
using System.Text.RegularExpressions;
using System.Diagnostics;
using System.Numerics;
using System.Collections;

static class MainClass
{
    public static void Main(string[] args)
    {
        var abc = Console.ReadLine().Split
            (' ');   
        if (abc[0].Last() == abc[1].First() && abc[1].Last() == abc[2].First())
        {
            Console.WriteLine("YES");
        }
        else
        {
            Console.WriteLine("NO");
        }

        Console.ReadLine();
    }
    

    #region ライブラリ
    public static long ToInt64(this string str) => long.Parse(str);
    public static int ToInt32(this string str) => int.Parse(str);
    public static BigInteger ToBigInteger(this string str) => BigInteger.Parse(str);
    public static List<string> SplittedStringToList(this string str) => str.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).ToList();
    public static List<int> SplittedStringToInt32List(this string str) => str.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Select(x => int.Parse(x)).ToList();
    public static List<long> SplittedStringToInt64List(this string str) => str.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Select(x => long.Parse(x)).ToList();
    public static List<BigInteger> SplittedStringToBigInteger(this string str) => str.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Select(x => BigInteger.Parse(x)).ToList();
    public const int INF = int.MaxValue / 2;
    public const long LONGINF = long.MaxValue / 2;

  
  

    public static void PrintArray(int[,] array)
    {
        for (int i = 0; i < array.GetLength(0); i++)
        {
            var sb = new StringBuilder();
            for (int j = 0; j < array.GetLength(1); j++)
            {
                sb.Append(array[i, j]).Append(" ");
            }
            Console.WriteLine(sb.ToString());
        }
    }

    #endregion
}



Measured memory_bytes: 13268
void main() {
	auto N = ri;
	auto D = readAs!(long[]);
	if(D[0] != 0 || D[1..$].any!(i => i == 0) || (arr => iota(arr.length).array != arr)(D.sort().uniq.array)) {
		writeln(0);
		return;
	}
	long MOD = 998244353;
	long res = 1;
	auto arr = D.sort().array.group.map!(i => i[1]).array;
	foreach(i; 0..arr.length-1) {
		foreach(_; 0..arr[i+1]) {
			res *= arr[i];
			res %= MOD;
		}
	}
	res.writeln;
}

// ===================================

import std.stdio;
import std.string;
import std.functional;
import std.algorithm;
import std.range;
import std.traits;
import std.math;
import std.container;
import std.bigint;
import std.numeric;
import std.conv;
import std.typecons;
import std.uni;
import std.ascii;
import std.bitmanip;
import core.bitop;

T readAs(T)() if (isBasicType!T) {
	return readln.chomp.to!T;
}
T readAs(T)() if (isArray!T) {
	return readln.split.to!T;
}

T[][] readMatrix(T)(uint height, uint width) if (!isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		res[i] = readAs!(T[]);
	}
	return res;
}

T[][] readMatrix(T)(uint height, uint width) if (isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		auto s = rs;
		foreach(j; 0..width) res[i][j] = s[j].to!T;
	}
	return res;
}

int ri() {
	return readAs!int;
}

double rd() {
	return readAs!double;
}

string rs() {
	return readln.chomp;
}


Measured memory_bytes: 4540
def calc(n):
    x = 1 << (n.bit_length() + 4) // 5
    y = (4 * x + n // (x ** 4)) // 5
    while y < x:
        x = y
        y = (4 * x + n // (x ** 4)) // 5
    return x
def f(n):
    return calc(n) if n > 0 and calc(n) ** 5 == n else 0

X = int(input())
for i in range(1 << 10):
    a = f(X + i ** 5)
    if a:
        print(a, i)
        break
    a = f(X - i ** 5)
    if a:
        print(a, -i)
        break

Measured memory_bytes: 9216
// #define _GLIBCXX_DEBUG
#include <bits/stdc++.h>

#define FOR(i, a, b) for (int i = (a); i < int(b); ++i)
#define RFOR(i, a, b) for (int i = (b)-1; i >= int(a); --i)
#define REP(i, n) FOR(i, 0, n)
#define REP1(i, n) FOR(i, 1, int(n) + 1)
#define RREP(i, n) RFOR(i, 0, n)
#define RREP1(i, n) RFOR(i, 1, int(n) + 1)
#define ALL(c) begin(c), end(c)

int _ = (
#ifndef LOCAL
    std::cin.tie(nullptr), std::ios::sync_with_stdio(false),
#endif
    std::cout.precision(10), std::cout.setf(std::ios::fixed));

using ll = long long;
using ull = unsigned long long;
using ld = long double;
template <typename T> using vec = std::vector<T>;
using namespace std;

int main() {
  ll N, A, B;
  cin >> N >> A >> B;
  const auto distance = B - A;
  const auto answer = (distance % 2 == 0)
                          ? distance / 2
                          : min(A - 1, N - B) + 1 + (distance - 1) / 2;
  cout << answer << endl;
  return 0;
}


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

typedef long long ll;

#define int ll
#define all(v) v.begin(), v.end()
#define reps(__i, a, b) for (int __i = a; i < b; i++)
#define rep(__i, n) reps(__i, 0, n)

const ll INF = (1ll << 60);
const ll MOD = (ll)1e9 + 7;

signed main()
{
    int h, w;
    cin >> h >> w;

    int mn = min(w * ((h + 2) / 3) - w * (h / 3), h * ((w + 2) / 3) - h * (w / 3));

    for (int i = 1; i <= h / 2; i++)
    {
        mn = min(mn, max(abs((h - i) * (w / 2) - (h - i) * ((w + 1) / 2)), max(abs(w * i - (h - i) * (w / 2)), abs(w * i - (h - i) * ((w + 1) / 2)))));
    }
    for (int i = 1; i <= w / 2; i++)
    {
        mn = min(mn, max(abs((w - i) * (h / 2) - (w - i) * ((h + 1) / 2)), max(abs(h * i - (w - i) * (h / 2)), abs(h * i - (w - i) * ((h + 1) / 2)))));
    }
    cout << mn << endl;
}

Measured memory_bytes: 256
@a = map { ($x, $y, $z) = glob <>; [ $x, $y, $z ] } 0, 1, 2;

sub check {
    for $i (0 .. 2) {
        if (!$a[$i][0] && !$a[$i][1] && !$a[$i][2]) { return 1; }
    }
    for $i (0 .. 2) {
        if (!$a[0][$i] && !$a[1][$i] && !$a[2][$i]) { return 1; }
    }
    if (!$a[0][0] && !$a[1][1] && !$a[2][2]) { return 1; }
    if (!$a[0][2] && !$a[1][1] && !$a[2][0]) { return 1; }
    return 0;
}

$n = <>;
for (1 .. $n) {
    $b = <>;
    for $i (0 .. 2) {
        for $j (0 .. 2) {
            if ($a[$i][$j] == $b) {
                $a[$i][$j] = 0;
            }
        }
    }
}
print check ? Yes : No


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

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

  vector<int> D1(N);
  vector<int> D2(N);
  bool z = false;
  rep(i, N) {
    cin >> D1[i] >> D2[i];
    if (i >= 2 && D1[i - 2] == D2[i - 2] && D1[i - 1] == D2[i - 1] &&
        D1[i] == D2[i]) {
      z = true;
    }
  }

  if (z)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 3620
from operator import itemgetter

H,W,D = [int(x) for x in input().split()]
a = []

for i in range(H):
    x = [int(x) for x in input().split()]
    for ind,j in enumerate(x):
        a.append([j,i,ind])
a.sort(key=itemgetter(0))
Q = int(input())
LR = [[int(x) for x in input().split()]for _ in range(Q)]
#%%
stims = [[[0,0,0]]for _ in range(D)]
dinds = [{}for _ in range(D)]
for i in a:
    d = i[0]%D
    stims[d].append([stims[d][-1][0]+abs(i[1]-stims[d][-1][1])+abs(i[2]-stims[d][-1][2]),i[1],i[2]])
    dinds[d][i[0]]=len(stims[d])-1

for i in LR:
    dnum = i[0]%D
    l = dinds[dnum][i[0]]
    r = dinds[dnum][i[1]]
    print(stims[dnum][r][0]-stims[dnum][l][0])


Measured memory_bytes: 135844
data = gets
data = data.chomp

datas = data.chars

answer = 0
tmp_answer = 0

datas.each do|elm|
  if ((elm == "A") || (elm == "G") || (elm == "C") || (elm == "T"))
    tmp_answer += 1
  else
    if tmp_answer > answer
      answer = tmp_answer
    end
    tmp_answer = 0
  end
end
if tmp_answer > answer
  answer = tmp_answer
end
puts answer.to_s


Measured memory_bytes: 3836
#pragma GCC optimize("Ofast")
//#pragma comment(linker, "/STACK: 2000000")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>

#define IOS ios::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define endl '\n'
#define elif else if
#define lli long long int
#define ld long double
#define vec vector
#define forn(a) for(lli a=0; a<n; a++)
#define all(x) x.begin(), x.end()
#define presicion(x) cout<<fixed<<setprecision(x)
#define deb(x) cerr<<#x<<" = "<<x<<endl
#define PI 3.14159265358979323
#define sen(ang) sin((ang)*PI/180)

using namespace std;

int main(){
    IOS;

    int n; cin>>n;
    vec<int> l(n);
    forn(i) cin>>l[i];
    sort( all(l) );
    int p_sum = 0;
    for(int i=0; i<n-1; i++)
        p_sum += l[i];
    if(l[n-1]<p_sum) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i=0;i<(n);i++)
using namespace std;
typedef long long ll; //long longをllとして簡略

int main(){
      int k,x;
      cin >> k >> x;
      if(k * 500 >= x){cout<<"Yes"<<endl;}
      else {cout<<"No"<<endl;}
      return 0;
}

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

int main()
{
   int sx,sy,tx,ty;
   cin>>sx>>sy>>tx>>ty;
   int dx = tx - sx;
   int dy = ty - sy;
   
   for(int i=0;i<dy;i++)
      cout<<"U";
   for(int i=0;i<dx;i++)
      cout<<"R";
   for(int i=0;i<dy;i++)
      cout<<"D";
   for(int i=0;i<dx;i++)
      cout<<"L";
   cout<<"L";
   for(int i=0;i<dy+1;i++)
      cout<<"U";
   for(int i=0;i<dx+1;i++)
      cout<<"R";
   cout<<"D";
   cout<<"R";
   for(int i=0;i<dy+1;i++)
      cout<<"D";
   for(int i=0;i<dx+1;i++)
      cout<<"L";
   cout<<"U";   

   return 0;
   
}

Measured memory_bytes: 3636
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <cmath>
using namespace std;

typedef pair<int, int> pii;
typedef long long ll;



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

	unsigned long long c = 100;


	
	int cnt = 0;
	while (c < x) {
		cnt++;
		c = c + c /100;
		

	}

	cout << cnt << endl;

}

Measured memory_bytes: 3232
#include <bits/stdc++.h>
using namespace std;
#define INF 2e9
#define ll long long


int main(){
    string s;
    cin>>s;

    int n = s.size();

    int white = 0, black = 0;

    for(int i=0; i<n; i++){
        if(s[i] == '1'){
            white++;
        }
        else{
            black++;
        }
    }

    cout<<2*min(white, black)<<endl;
}

Measured memory_bytes: 512
from bisect import bisect_left, bisect_right
from collections import Counter, defaultdict, deque, OrderedDict
from copy import deepcopy
from fractions import gcd
from functools import lru_cache, reduce
from math import ceil, floor
from sys import setrecursionlimit

import heapq
import itertools
import operator


inf = float('inf')


# globals
S = ""
K = 0


def set_inputs():
    global S, K
    S = get_str()
    K = get_int()
    return


def main():
    setrecursionlimit(100000)
    set_inputs()
    # ----------MAIN----------
    substrings = set()
    for i in range(1, K + 1):
        for j in range(len(S) + 1 - i):
            substrings.add(S[j:j+i])
    print(list(sorted(substrings))[K-1])
    return


def get_int():
    return int(input())


def get_float():
    return float(input())


def get_str():
    return input().strip()


def get_li():
    return [int(i) for i in input().split()]


def get_lf():
    return [float(f) for f in input().split()]


def get_lc():
    return list(input().strip())


def get_data(n, types):
    if len(types) == 1:
        return [types[0](input()) for _ in range(n)]
    return zip(*(
        [t(x) for t, x in zip(types, input().split())]
        for _ in range(n)
    ))


if __name__ == '__main__':
    main()


Measured memory_bytes: 6628
#include <bits/stdc++.h>
#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;
using P = pair<int, int>; 
using ll = long long;

int main()
{
  int a,b,c;
  cin >> a>> b>> c;
  if(abs(a - b) > abs(a - c)) cout << "B" << endl;
  else cout << "A" << endl;
  return 0;
}


Measured memory_bytes: 3588
#include <stdio.h>
#include <string.h>
int main(void){
    int a,b;
    int d[3000];
    char c[100];
    int n,j;
    n=1;
    j = 0;
    while(j == 0){
	scanf("%d %s %d",&a,&c,&b);
	if(strcmp(c,"?") == 0){
	    j = 1;
	}else{
	    if(strcmp(c,"+")==0){
		d[n] = a+b;
	    }else if(strcmp(c,"-")==0){
		d[n] = a-b;
	    }else if(strcmp(c,"*")==0){
		d[n] = a*b;
	    }else if(strcmp(c,"/")==0){
		d[n] = a/b;
	    }
	    n++;
	}
    }

    for(int i=1;i<n;i++){
	j = d[i];	
	printf("%d\n",j);
    }
}

Measured memory_bytes: 2716
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <string>
#include <cstring>
#include <ctime>


using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); }

//math
//-------------------------------------------
template<class T> inline T sqr(T x) { return x*x; }

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define EXISTch(s,c) ((((s).find_first_of(c)) != std::string::npos)? 1 : 0)//cがあれば1 if(1)
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)  FOR(i,0,n)
#define loop(n) FOR(i,0,n)
#define rrep(i,a,b) for(int i=(a);i>=(b);--i)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int INF = (int)1000000007;
const LL MOD = (LL)1000000007;//10^9+7
const LL INF2 = (LL)100000000000000000;//10^18

int main() {
	while (1) {
		int x, y; cin >> x >> y;

		if (x == 0 && y == 0)break;

		if (x > y) {
			cout << y << " " << x << endl;
		}
		else {
			cout << x << " " << y << endl;
		}
	}

	return 0;
}


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

int main(){
  string s;
  cin>>s;
  for(int i=0;i<s.size();i++){
    if(i%2!=0&&s[i]=='R'){
       cout<<"No";
       return 0;
    }
    else if(i%2==0&&s[i]=='L'){
       cout<<"No";
       return 0;
    }
  }
  cout<<"Yes";

}


Measured memory_bytes: 256
#include<bits/stdc++.h>
//#include<ext/pb_ds/tree_policy.hpp>
#define ll long long
#define int long long int
#define mkp make_pair
#define pb push_back
#define ff first
#define ss second
#define debug1(a) cout<<a<<endl;
#define debug2(a,b) cout<<a<<' '<<b<<endl;
#define debug3(a,b,c) cout<<a<' '<<b<<' '<<c<<endl;
#define rep(i,n) for(int i=0;i<n;i++)
#define repl(i,a,b) for(int i=a;i<b;i++)
#define pi pair<int,int>
#define pii pair<int,pi>
#define mp map<int,int>
#define ump unordered_map<int,int>
#define  vi vector<int>
#define st set<int>
#define mst multiset<int>
#define pq priority_queue
#define mpq priority_queue<int,vector<int>,greater<int> >
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define in cin>>
#define out cout<<
//using namespace __gnu_pbds;
using namespace std;
//typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> orderedSet;
//typedef tree<int,null_type,less_equal<int>,rb_tree_tag,tree_order_statistics_node_update> orderedMSet;
//*p.find_by_order(index) return value at index
//p.order_of_key(key) return index
void printArray(int arr[],int n)
{
   for(int i=0;i<n;i++)cout<<arr[i]<<' ';
}
void printMp(mp m)
{
  mp ::iterator it;
  for(it=m.begin();it!=m.end();it++)cout<<it->first<<' '<<it->second<<endl;
}
void printUmp(ump m)
{
  ump ::iterator it;
  for(it=m.begin();it!=m.end();it++)cout<<it->first<<' '<<it->second<<endl;
}
void printSt(st s)
{
  st ::iterator it;
  for(it=s.begin();it!=s.end();it++)cout<<*it<<' ';
}
void printMst(mst s)
{
  mst ::iterator it;
  for(it=s.begin();it!=s.end();it++)cout<<*it<<' ';
}
void printVec(vector<int>v)
{
for(int i=0;i<v.size();i++)cout<<v[i]<<' ';
}
void printVec2(vector<int>v[],int n)
{
    for(int i=0;i<n;i++)
    {
        for(int j=0;j<v[i].size();j++)
            cout<<v[i][j]<<' ';
        cout<<endl;
    }
}
 set<pair<int,int>> primeset;
void SieveOfEratosthenes(int n)
{
    bool prime[n+1];
    memset(prime, true, sizeof(prime));

    for (int p=2; p*p<=n; p++)
    {
        if (prime[p] == true)
        {
        for (int i=p*p; i<=n; i += p)
                prime[i] = false;
        }
    }
    for (int p=2; p<=n; p++)
       if (prime[p])
          primeset.insert(mkp(p,1));
}
int32_t main()
{
fastio;
int n; in n;
int m;in m;
vector<int> b[m];
rep(i,n){
  int x;in x;x--;
  int y;in y;
  if(x<m)
    b[x].pb(y);
}
priority_queue<int> queue;
int ans=0;
rep(i,m){
  for(int x:b[i])
      queue.push(x);
    if(!queue.empty()){
      ans+=queue.top();
      queue.pop();
    }
}
out ans;
    return 0;
}


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

using namespace std;

#define pb push_back
#define mk make_pair
#define mod 1000000007
#define ff first
#define ss second

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

ll modpow(ll a, ll b){

    ll ans=1;
    while(b){
        if(b&1){
            ans=(ans*a)%mod;
        }
        a=(a*a)%mod;
        b=b/2;
    }
    return ans;
}

int inp[81][81][2];

int fin[81][81];

vector<vector<bool> > dpc(12805, vector<bool>(81)), prev1(12805, vector<bool>(81));

int main(){

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

    int h,w;
    cin>>h>>w;


    for(int i = 1; i <= h; i++) {
        for(int j = 1; j <= w; j++) {
            cin>>inp[i][j][0];
        }
    }

    for(int i = 1; i <= h; i++) {
        for(int j = 1; j <= w; j++) {
            cin>>inp[i][j][1];
            fin[i][j] = abs(inp[i][j][0]-inp[i][j][1]);
        }
    }

    dpc[0 + 6401][0] = true;

    for(int i = 1; i <= h; i++) {
        for(int j = 1; j <= w; j++) {
            for(int v = -6400; v <= 6400; v++) {
                int v1 = v - fin[i][j];
                if(v1 >= -6400 && v1 <= 6400) {
                    if(dpc[v + 6401][j-1]) dpc[v1 + 6401][j] = true;
                    if(prev1[v + 6401][j]) dpc[v1 + 6401][j] = true;
                }

                v1 = v + fin[i][j];

                if(v1 >= -6400 && v1 <= 6400) {
                    if(dpc[v + 6401][j-1]) dpc[v1 + 6401][j] = true;
                    if(prev1[v + 6401][j]) dpc[v1 + 6401][j] = true;
                }

                    
            }
        }
        prev1 = dpc;
        for(int j = 0; j < 81; j++) {
            for(int k = 0; k < 12805; k++) {
                dpc[k][j] = false;
            }
        }
    }

    for(int i = 0; i <= 6400; i++) {
        if(prev1[-i+6401][w] || prev1[i][w]) {
            cout<<i<<endl;
            return 0;
        }
    }





}


Measured memory_bytes: 2176
#include <stdio.h>

long long max(long long a, long long b) {
  if (a > b) return a;
  return b;
}
  

int main(void) {
  int N, W;
  scanf("%d %d", &N, &W);
 
  long long w[N], v[N];
  for (int i = 0; i < N; i++) {
    scanf("%lld %lld", &w[i], &v[i]);
  }
 
  long long dp[W + 1];
  for (int i = 0; i <= W; i++) {
    dp[i] = 0;
  }
 
  for (int i = 0; i < N; i++) {
    for (int j = W; j >= w[i]; j--) {
      dp[j] = max(dp[j - 1], dp[j - w[i]] + v[i]);
    }
  }
 
  printf("%lld\n", dp[W]);
 
  return 0;
}

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

int main()
{
	string s,t;
	cin >> s >> t;
	int n = s.size(), m = t.size();
	vector<int> c[26];
	rep(i,n)
	{
		c[s[i] - 'a'].push_back(i);
	}
	
	int x = t[0] - 'a', j;

	if (c[x].size() == 0)
	{
		cout << "-1" << endl;
		return 0;
	}

	ll ans = 0;

	ans += c[x][0] + 1;
	int k = c[x][0];
	//cout << "0: " << k << " now ans = " << ans << endl;

	for (int i = 1; i < m; ++i)
	{
		x = t[i] - 'a';
		if (c[x].size() == 0)
		{
			cout << "-1" << endl;
			return 0;
		}
		else
		{
			j = upper_bound(c[x].begin(), c[x].end(), k) - c[x].begin();

			if (j == c[x].end() - c[x].begin() )
			{
				ans += c[x][0] + n - k;
				k = c[x][0];
				//cout << i << ": " << c[x][0] << " now ans = " << ans << endl;; 
			}
			else
			{
				ans += c[x][j] - k;
				k = c[x][j];
				//cout << i << ": " << c[x][j] << " now ans = " << ans << endl;; 
			}
		}
	}

	cout << ans << endl;
	return 0;
}

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

string s;

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> s;
  for (int i = 0; i < 2; i++) {
    bool ok = 1;
    for (int j = i + 1; j < i + 1 + 2; j++) {
      if (s[i] != s[j]) ok = 0;
    }
    if (ok) {
      cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    cout<<fixed<<setprecision(12);
    double a,b,C;
    cin>>a>>b>>C;
    double PI=acos(-1.0);
    C=C/180.0*PI;
    cout<<a*b*sin(C)/2.0<<endl;
    double cc=a*a+b*b-2*a*b*cos(C);
    cout<<a+b+sqrt(cc)<<endl;
    cout<<b*sin(C)<<endl;
    return 0;
}


Measured memory_bytes: 3488
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush
from bisect import bisect_left,bisect_right 
import sys,math,itertools,fractions
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))

s = input()
n = len(s)
res = [0] * n
cnt = 0
now = [0,0]
for i in range(n):
    if s[i] == 'R':
        now[cnt%2] += 1
        cnt += 1
    else:
        res[i-1] += now[0]
        res[i] += now[1]
        now = [0,0]
        cnt = 0
for i in range(n)[::-1]:
    if s[i] == 'L':
        now[cnt%2] += 1
        cnt += 1
    else:
        res[i+1] += now[0]
        res[i] += now[1]
        now = [0,0]
        cnt = 0
print(*res)

Measured memory_bytes: 12056
#include<stdio.h>
int main(void){
  int n,a,b;
  scanf("%d",&n);
  for(a=9;a>=1;a--){
    for(b=9;b>=1;b--){
      if(a*b==n){
        printf("Yes\n");
        return 0;
      }
    }
  }
  printf("No\n");
  return 0;
}


Measured memory_bytes: 128
#pragma region Header
#ifdef DEBUG
#include "debug.hpp"
#else
#define NDEBUG
#define debug(...)
#define IFD(...)
#endif
#include <utility>
#include <cstdint>
#include <cmath>
#include <vector>
#include <array>
#include <deque>
#include <queue>
#include <stack>
#include <tuple>
#include <set>
#include <map>
#include <unordered_map>
#include <bitset>
#include <string>
#include <functional>
#include <algorithm>
#include <numeric>
#include <stdexcept>
#include <iostream>
#include <iomanip>
using namespace std;
using i32 = int32_t;
using i64 = int64_t;
using u32 = uint32_t;
using u64 = uint64_t;
#define rep(i, n) for (int i = 0; i < static_cast<int>(n); ++i)
#define repd(i, n) for (int i = static_cast<int>(n) - 1; i >= 0; --i)
#define FOR(i, a, b) for (int i = static_cast<int>(a); i <= static_cast<int>(b); ++i)
#define FORD(i, b, a) for (int i = static_cast<int>(b); i >= static_cast<int>(a); --i)
template <typename T>
int SZ(T const &x)
{
    return static_cast<int>(x.size());
}
template <class T>
bool chmax(T &a, T const &b)
{
    if (a < b)
    {
        a = b;
        return true;
    }
    return false;
}
template <class T>
bool chmin(T &a, T const &b)
{
    if (b < a)
    {
        a = b;
        return true;
    }
    return false;
}
#pragma endregion

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(15);

    int n;
    cin >> n;
    vector a_s(n, 0);
    rep(i, n)
    {
        cin >> a_s[i];
    }

    int g = accumulate(a_s.begin(), a_s.end(), 0, [](int acc, int x) { return gcd(acc, x); });

    bool flag = [&]() {
        vector<bool> p_s(1000'000);
        auto ins = [&](int p) {
            if (p_s[p] == 1)
            {
                return false;
            }
            p_s[p] = 1;
            return true;
        };
        for (auto a : a_s)
        {
            for (int p = 2; p * p <= a; ++p)
            {
                if (a % p == 0)
                {
                    if (not ins(p))
                    {
                        return false;
                    }
                    while (a % p == 0)
                    {
                        a /= p;
                    }
                }
            }
            if (a != 1)
            {
                if (not ins(a))
                {
                    return false;
                }
            }
        }
        return true;
    }();

    cout << (flag ? "pairwise coprime" : (g == 1 ? "setwise coprime" : "not coprime")) << endl;

    return 0;
}


Measured memory_bytes: 7384
from collections import deque

H, W = map(int, input().split())
s = [list(input()) for _ in range(H)]

d = deque([[0,0,s[0][0]]])
distance = [[float("inf")]*W for _ in range(H)]
if s[0][0] == ".":
    distance[0][0] = 0
else:
    distance[0][0] = 1

while d:
    y, x, c = d.popleft()
    for new_y, new_x in ([int(y)+1, int(x)], [int(y), int(x)+1]):
        if 0 <= new_y <= H-1 and 0 <= new_x <= W-1:
            if c == "." and s[new_y][new_x] == "#":
                new_cost = distance[y][x] + 1
            else:
                new_cost = distance[y][x]
            if new_cost < distance[new_y][new_x]:
                distance[new_y][new_x] = new_cost
                d.append([new_y, new_x, s[new_y][new_x]])

print(distance[H-1][W-1])

Measured memory_bytes: 42992
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin >> N;
  int A[4][110];
  for(int i=1;i<=N;i++){cin >> A[1][i];}
  for(int i=1;i<=N;i++){cin >> A[2][i];}
  int S[110];
  for(int i=1;i<=N;i++){S[i]=0;}
  int ans=0;
  for(int i=1;i<=N;i++){
    for(int j=1;j<=i;j++){S[i]+=A[1][j];}
    for(int k=i;k<=N;k++){S[i]+=A[2][k];}
    if(ans<S[i]){ans=S[i];}
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10**7)

debug = True
#debug = False

def dprint(*objects):
    if debug == True:
        print(*objects)

mx = 10**9 + 7

from math import factorial
# def npr(n, r):
#     ans = math.factorial(n+r) // (math.factorial(n) * math.factorial(r))
#     return ans

def ncr(n, r):
    a = factorial(n) // (factorial(r) * factorial(n - r))
    return a

def solve():
    N, K = map(int, input().split())
    M = N - K

    for i in range(1, K+1):
        if M+1 < i:
            print(0)
            continue
        # まず、赤がM個あるので、両端を含む隙間 M+1 から、i個選ぶ
        agroup = ncr(M+1, i)

        # そのあと、青iこの箱にKをを分ける
        bagroup = ncr(K-1, i-1)

        print((agroup * bagroup) % mx)

solve()

Measured memory_bytes: 3316
#include<bits/stdc++.h>
using namespace std;
bool isPal(string s){
	int i = 0;
	int j = s.size() - 1;
 
	while( i < j){
		if(s[i] == s[j]){
			i++;
			j--;
		}
		else{
			return false;
		}
	}
	return true;
}
int main(){
	string s;
	cin >> s;
	int firstHalf = ((s.size() - 1) / 2);
	int secHalf = (s.size() + 3) / 2;
	string s1 = s.substr(0 , firstHalf);
	string s2 = s.substr(secHalf - 1, s.size());
	if(isPal(s) && isPal(s1) && isPal(s2)){
		cout<<"Yes\n";
	}
	else{
		cout<<"No\n";
	}
	return 0;
}

Measured memory_bytes: 256
//#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/rope>
#define mem(a,v) memset((a), (v), sizeof (a))
#define enl printf("\n")
#define case(t) printf("Case #%d: ", (t))
#define ni(n) scanf("%d", &(n))
#define nl(n) scanf("%lld", &(n))
#define nai(a, n) for (int i = 0; i < (n); i++) ni(a[i])
#define nal(a, n) for (int i = 0; i < (n); i++) nl(a[i])
#define pri(n) printf("%d\n", (n))
#define prl(n) printf("%lld\n", (n))
#define pii pair<int, int>
#define pil pair<int, long long>
#define pll pair<long long, long long>
#define vii vector<pii>
#define vil vector<pil>
#define vll vector<pll>
#define vi vector<int>
#define vl vector<long long>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef cc_hash_table<int,int,hash<int>> ht;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> oset;
const double pi = acos(-1);
const int MOD = 1e9 + 7;
const int INF = 1e9 + 7;
const int MAXN = 2e5 + 5;
const double eps = 1e-9;
int a[MAXN], n;

bool ok(int cnt) {
	stack<pii> st;
	for (int i = 1; i < n; i++) {
		if (a[i] > a[i-1]) continue;
		while (!st.empty() && st.top().fi > a[i])
			st.pop();
		int idx = 0;
		while (!st.empty() && st.top().fi + idx == a[i] && st.top().se == cnt) {
			st.pop();
			idx++;
		}
		if (idx == a[i] || cnt == 1) {
			return false;
		} else {
			int col = 2;
			if (!st.empty() && st.top().fi + idx == a[i]) {
				col = st.top().se + 1;
				st.pop();
			}
			st.push(mp(a[i]-idx,col));
		}
	}
	return true;
}

int main() {
	ni(n); nai(a, n);
	int lo = 1, hi = n;
	while (lo <= hi) {
		int mi = (lo+hi) / 2;
		if (ok(mi))
			hi = mi - 1;
		else
			lo = mi + 1;
	}
	pri(lo);
	return 0;
}


Measured memory_bytes: 1024
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools,fractions,pprint
sys.setrecursionlimit(10**8)
mod = 10**9+7
mod2 = 998244353
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpln(n): return list(int(sys.stdin.readline()) for i in range(n))

n = inp()
if n < 1000:
    print('ABC')
else:
    print('ABD')

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


int main() {
  int n; cin >> n;
  long long l[n];
  for(int i = 0; i < n; i++) cin >> l[i];
  int ans = 0;
  for(int i = 0; i < n; i++)
    for(int j = i+1; j < n; j++)
      for(int k = j+1;k<n;k++){
       
          if((l[i]+l[j])>l[k] &&(l[j]+l[k]) > l[i] && (l[i]+l[k]) > l[j] && l[i] != l[j] && l[j] != l[k] && l[i] != l[k])
            ans++;
        
      }
  cout << ans << endl;
}


Measured memory_bytes: 3632
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <map>
#include <unordered_map>
#include <utility>
#include <algorithm>
#include <set>
#include <cmath>
#include <array>
#include <bitset>
using namespace std;

typedef long long ll;
const ll mod=1000000007;
#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,n) for(int i=1;i<n+1;i++)
int main(){
    int X,A;
    cin>>X>>A;
    if(X<A) cout<<0<<endl;
    else cout<<10<<endl;
    return 0;
}

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

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

cnt = 0
l = 0
r = n

while max(hs)>0:
    l = 0
    r = n

    for i in range(n):
        if hs[i] > 0:
            l = i
            break
    
    for j in range(l,n):
        if hs[j]== 0:
            r = j
            break
    
    for k in range(l,r):
        hs[k] -= 1

    cnt += 1

print(cnt)
        

Measured memory_bytes: 3064
#[allow(unused_macros)]
macro_rules! invec {
    ( $t:ty ) => {{
        let mut s = String::new();
        match std::io::stdin().read_line(&mut s) {
            Ok(0) => Vec::<$t>::new(),
            Ok(n) => s.trim().split_whitespace().map(|s| s.parse::<$t>().unwrap()).collect::<Vec<$t>>(),
            Err(_) => Vec::<$t>::new(),
        }
    }}
}

#[allow(unused_macros)]
macro_rules! input {
    ( $($t:ty),* ) => {{
        let mut s = String::new();
        std::io::stdin().read_line(&mut s);
        let mut splits = s.trim().split_whitespace();
        ($(
            {
                 splits.next().unwrap().parse::<$t>().unwrap()
            },
        )*)
    }}
}

#[allow(unused_must_use)]
#[allow(unused_variables)]
fn solve() {
    let (n, l) = input!(i64, i64);

    let sub_total: usize = (0..(n as usize)).sum();
    let total: i64 = (l * n) as i64 + sub_total as i64;

    if l <= -1 * n {
        println!("{}", total - (n - 1 + l));
    } else if l <= 0 {
        println!("{}", total);
    } else {
        println!("{}", total - l);
    }
}

fn main() {
    solve();
}


Measured memory_bytes: 4352
N = int(input())
P = tuple(map(lambda x:int(x)-1, input().split()))
Q = tuple(map(lambda x:int(x)-1, input().split()))

import itertools

p = 0
q = 0

for i,l in enumerate(itertools.permutations(list(range(N)))):
    if P==l:
        p += i
    if Q==l:
        q += i

print(abs(p - q))

Measured memory_bytes: 3064
import bisect
import math
from functools import reduce

def gcd(A):
    return reduce(math.gcd, A)

N,X = map(int, input().split())
x = sorted(map(int, input().split()))
bisect.insort(x,X)
ans = [x[i+1]-x[i] for i in range(N)] 
if N ==1:
    print(x[1]-x[0])
else:
    print(gcd(ans))

Measured memory_bytes: 20676
'use strict'
const main = (input: string) => {
    const std: string[] = input.split('\n')
    const [n, x] = std.shift().split(' ').map(Number)
    let l: number[] = std.shift().split(' ').map(Number)
    l.unshift(0)
    const r = l.map((v,i,a) => {
        if (i === 0) return 0
        return v + a.slice(0, i).reduce((p,c) => p+c)
    }).filter(v => v <= x)
    console.log(r.length)
}
main(require('fs').readFileSync('/dev/stdin', 'utf8').trim())

Measured memory_bytes: 7500
#include <bits/stdc++.h>
using namespace std;
int main()
{
long long n,m,ans=0;
scanf("%lld%lld",&n,&m);
if (n*2<=m){ans+=n;m-=2*n;}
else {ans+=m/2;m%=2;}
ans+=m/4;
printf("%lld\n",ans);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const int INF=10000000;
const int mod=1e9+7;
int a[100005];
int n,ant;
int extgcd(int a,int b,int& x,int& y)
{
    int d=a;
    if(b!=0)
    {
        d=extgcd(b,a%b,y,x);
        y-=(a/b)*x;
    }
    else
    {
        x=1;
        y=0;
    }
    return d;
}
void trace()
{
    for(int i=0;i<n;i++)
    {
        if(i)
            printf(" ");
        printf("%d",a[i]);
    }
    printf("\n");
}
int cnt;
int get_prime(int x)
{
    if(x<2)
        return 0;
    if(x==2)
        return 1;
    if(x%2==0)
        return 0;
    for(int i=3;i*i<=x;i+=2)
    {
        if(x%i==0)
            return 0;
    }
    return 1;
}
int main()
{
    scanf("%d",&n);
    for(int i=0;i<n;i++)
    {
        int x;
        scanf("%d",&x);
        if(get_prime(x))
            ant++;
    }
    printf("%d\n",ant);
    return 0;
}



Measured memory_bytes: 3212
n=int(input())
w=[input() for i in range(n)]
#print(n)
#print(w)
flag=0
if len(w)==len(set(w)):
    flag=0
else:
  flag=1

for j in range(n-1):
  if w[j][-1] != w[j+1][0]:
    flag=1

if flag==1:
  print('No')
else:
  print('Yes')


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

using namespace std;

int main(int argc, const char * argv[]) {
    int a, b;
    cin >> a >> b;
    
    string ans = (a * b) % 2 == 1 ? "Odd" : "Even";
    
    std::cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] a = new int[n];
        for (int i = 0; i < a.length; i++) {
            a[i] = sc.nextInt();
        }
        Map<Integer, Integer> map = new HashMap<>();
        for (int i = 0; i < a.length; i++) {
            if (map.keySet().contains(a[i])) {
                map.put(a[i], map.get(a[i]) + 1);
            } else {
                map.put(a[i], 1);
            }
        }
        long sum = 0;
        for (int val : map.values()) {
            sum += (long)val * (val - 1) / 2;
        }
        for (int i = 0; i < a.length; i++) {
            System.out.println(sum - (map.get(a[i]) - 1));
        }
        sc.close();
    }
}

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

 
int main() {
   int n,d;
   cin>>n>>d;
   int waru=2*d+1;
   //繰り上げの除算
   cout<<(n+waru-1)/waru<<endl;

}

Measured memory_bytes: 256
import java.util.Scanner;

class Main {
  public static void main(String argv[]) {
    int n;
    Scanner sc = new Scanner(System.in);
    n = Integer.parseInt(sc.next());
    System.out.println((n % 2 == 0 ? n/2:n/2 + 1) / (double)n);
  }
}

Measured memory_bytes: 21716
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
#include <chrono> 
using namespace std::chrono;
using namespace std;
typedef long long ll;
using namespace __gnu_pbds;   
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update> 
#define ordered_mset tree<pair<ll,ll>, null_type,less<pair<ll,ll>>, rb_tree_tag,tree_order_statistics_node_update> 
#define fr(i,a,b) for (ll i=(a); i<(b);++i)
#define frr(i,a,b) for(ll i=(a-1);i>=(b);--i)
#define vi vector<ll>
#define vl vector<ll>
#define pb push_back
#define ppb pop_back()
#define pf push_front
#define ppf pop_front()
#define F first
#define S second
#define pii pair<ll,ll> 
#define rev(a) reverse(a.begin(),a.end())
#define srt(a,k) sort(a,a+k,greater<ll>())
#define rsrt(a) sort(a.begin(),a.end(),greater<ll>())
#define sz(a) (ll)a.size()
//#define endl "\n"
#define po(a,b) (ll)(pow(a,b)+0.5)
#define double long double
#define print(a) for(auto x:a)cout<<x<<" ";cout<<endl;
#define setbits(a) __builtin_popcount(a)
const ll M=1e9+7;
const ll MX=1e6+1;

int main()
{  
     

  int tt=1;
  //cin>>tt;
  while(tt--)
  {
    int n;
    cin>>n;
    ll a[n];
    fr(i,0,n)cin>>a[i];
  int cnt=0;
    fr(i,0,n-2)
    {  
       fr(j,i+1,n-1)
       {
         fr(k,j+1,n)
         {
             vi v;
             v.pb(a[i]);v.pb(a[j]);v.pb(a[k]);
             sort(v.begin(),v.end());
             if(v[0]+v[1]>v[2] && v[0]<v[1] && v[1]<v[2])cnt++;
         }
       }
    }
   cout<<cnt;
  }
}



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


using ll = long long;
int N, T;
vector<pair<int, int>> store;


ll g(ll t0, int k)
{
    ll a = store[k].first;
    ll b = store[k].second;
    return t0 + 1 + a * (t0 + 1) + b;
}


void solve()
{
    sort(store.begin(), store.end(),
    [](const pair<int, int> &p1, const pair<int, int> &p2) {
        ll x1 = (ll)p1.first * (p2.second + 1);
        ll x2 = (ll)p2.first * (p1.second + 1);
        return ((x1 > x2) || (x1 == x2 && p1.second < p2.second));
    });

    const ll Inf = 2e9;
    int len = 0;
    int s = 1;
    int k = N;
    while (s <= T) {
        s *= 2;
        len++;
    }
    len = min(len, N);
    vector<ll> dp(len + 1);
    for (int j = 1; j <= len; j++)
        dp[j] = Inf;
    for (int i = 0; i < N; i++) {
        if (store[i].first == 0) {
            k = i;
            break;
        }
        for (int j = len; j > 0; j--)
            dp[j] = min(dp[j], g(dp[j - 1], i));
    }

    int ans = 0;
    for (int i = 0; i <= len; i++) {
        int c = i, k0 = k;
        ll x = dp[i];
        if (x > T)
            break;
        while (k0 < N && (x = g(x, k0)) <= T) {
            c++;
            k0++;
        }
        ans = max(ans, c);
    }
    cout << ans << endl;
}


int main()
{
    cin >> N >> T;
    store.resize(N);
    for (int i = 0; i < N; i++)
        cin >> store[i].first >> store[i].second;
    solve();
    return 0;
}


Measured memory_bytes: 1792
#include <iostream>

using namespace std;

int main() {
	long long int n;
	cin >> n;
	if (n <= 6) {
		cout << 1 << endl;
	} else if (n <= 11){
		cout << 2 << endl; 
	} else {
		long long int k = n/11;
		k *= 2;
		if (n % 11 != 0) {
			long long int p = n%11;
			if (p < 7) {
				k++;
			} else {
				k += 2;
			}
		}
		cout << k << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstring>
using namespace std;
int main(void){
	char a[105];
	cin>>a;
	int check=0;
	for(int i=0;i<strlen(a);i++){
		if(a[i]!='C'&&a[i]!='F') continue;
		if(a[i]=='C'){
			check=1;
			continue;
		}
		if(check==1&&a[i]=='F'){
			cout<<"Yes";
			return 0;
		}
	}
	cout<<"No";
	return 0;
}

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

using namespace std;

int main() {
  int N;
  cin >> N;
  vector<int> A(N);
  cin >> A[0];
  int ans = 1;
  long long last_diff = 0;
  for (int i = 1; i < N; ++i) {
    cin >> A[i];
    if (last_diff * (A[i] - A[i - 1]) < 0) {
      ans++;
      last_diff = 0;
    } else if (last_diff == 0)
      last_diff = A[i] - A[i - 1];
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 640
from sys import stdin,stdout
def INPUT():return list(int(i) for i in stdin.readline().split())
def inp():return stdin.readline()
def out(x):return stdout.write(x)
import math
import random
J=998244353
########################################################
n=int(input())
A=[]
for i in range(n):
    x,y=INPUT()
    a=x+y
    b=y-x
    A.append([a,b])
A.sort()
ans=0
maxiy=A[0][1]
miniy=maxiy
for i in range(n):
    ans=max(max(abs(A[i][0]-A[0][0]),max(abs(A[i][1]-maxiy),abs(A[i][1]-miniy))),ans)
    maxiy=max(maxiy,A[i][1])
    miniy=min(miniy,A[i][1])
print(ans)


Measured memory_bytes: 113344
#include <bits/stdc++.h>
#include <numeric>
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;

int main(){
    long long n,a,b,c,d,e;
    cin >> n >> a >> b >> c >> d >> e;
    cout << max({(n-1)/a,(n-1)/b,(n-1)/c,(n-1)/d,(n-1)/e})+5 << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i = 0; i < (n); i++)
int main(){
    double sum = 0;
    int n; cin >> n;
    double a[n]; 
    rep(i,n){
        cin >> a[i];
        sum += 1.0/a[i];
    }
    cout << setprecision(15) << 1.0/sum << endl;
}

Measured memory_bytes: 256
/*** keep hungry and calm CoolGuang!***/
#include <bits/stdc++.h>
#define debug(x) cout<<#x<<" :"<<x<<" "<<endl;
#pragma GCC optimize(2)
using namespace std;
typedef long long ll;
const ll INF=1000000000000007;
const ll maxn=1e6+5;
const int mod=1e9+7;
ll n,m,p;
ll a[maxn],b[maxn];
int judge(ll x){
    ll cot=0;
    for(int i=1;i<=n;i++){
        ll l=1,r=i-1;
        ll ans=-1;
        if(a[i]==0) cot+=x<0?i-1:0;
        else if(a[i]>0){
            while(l<=r){
                ll mid=(l+r)/2;
                if(a[mid]*a[i]>x){
                    r=mid-1;
                    ans=mid;
                }
                else l=mid+1;
            }
            if(ans!=-1) cot+=i-ans;
        }
        else{
            while(l<=r){
                ll mid=(l+r)/2;
                if(a[mid]*a[i]>x){
                    l=mid+1;
                    ans=mid;
                }
                else r=mid-1;
            }
            if(ans!=-1) cot+=ans;
        }
    }
    return cot<p;
}
int main()
{
    scanf("%lld%lld",&n,&p);
    p=n*(n-1)/2-p+1;
    for(int i=1;i<=n;i++) scanf("%lld",&a[i]);
    sort(a+1,a+1+n);
    ll ans=-1;
    ll l=-1e18,r=1e18;
    while(l<=r){
        ll mid=(l+r)/2;
        if(judge(mid)){
            r=mid-1;
            ans=mid;
        }
        else l=mid+1;
    }
    printf("%lld\n",ans);
    return 0;
}
/**
2 2 3
-1 -2
1 2
**/


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

const int N = 2e5 + 20;
int n, k, l, x;
vector <int> ro[N], ra[N], jro[N], jra[N];
int mark[N], mark1[N];
queue <int> q;
map <pair<int, int>, int> jav;

void bfs(int v, int s) {
    mark[v] = s;
    q.push(v);
    while(q.size()){
        int x = q.front();
        q.pop();
        for (int i : ro[x])
            if (!mark[i]) {
                q.push(i);
                mark[i] = s;
            }
    }
}
void bfs1(int v, int s) {
    mark1[v] = s;
    q.push(v);
    while(q.size()){
        int x = q.front();
        q.pop();
        for (int i : ra[x])
            if (!mark1[i]) {
                q.push(i);
                mark1[i] = s;
            }
    }
}
void input() {
    cin >> n >> k >> l;
    for (int i = 0; i < k; i ++) {
        int a, b;
        cin >> a >> b;
        ro[a].push_back(b);
        ro[b].push_back(a);
    }
    for (int i = 0; i < l; i ++) {
        int a, b;
        cin >> a >> b;
        ra[a].push_back(b);
        ra[b].push_back(a);
    }

}
void solve() {
    input();
    x = 1;
    bfs(1, x);
    for (int i = 2; i <= n; i++)
        if (!mark[i]) {
            x ++;
            bfs(i, x);
        }
    //memset(mark, 0, sizeof(mark));
    x = 1;
    bfs1(1, x);
    for (int i = 2; i <= n; i++)
        if (!mark1[i]) {
            x ++;
            bfs1(i, x);
        }
    for (int i = 1; i <= n; i ++)
        jav[{mark[i], mark1[i]}] ++;
    for (int i = 1; i <= n; i ++)
        cout << jav[{mark[i], mark1[i]}] << " ";
}
int main() {
    solve();
    return 0;
}


Measured memory_bytes: 37248
N, K = map(int, input().split())
H = list(map(int, input().split()))

dp = [10**9]*N
dp[0] = 0

for i in range(1, N):
    k = 1
    while i - k >= 0 and k <= K:
        dp[i] = min(dp[i], dp[i - k]+abs(H[i] - H[i - k]))
        k += 1
print(dp[-1])

Measured memory_bytes: 52448