akhauriyash/Code-Regression huggingface dataset:
#include<iomanip>
#include<limits>
#include<thread>
#include<utility>
#include<iostream>
#include<string>
#include<algorithm>
#include<set>
#include<map>
#include<vector>
#include<stack>
#include<queue>
#include<cmath>
#include<numeric>
#include<cassert>
#include<random>
#include<chrono>
#include<unordered_set>
#include<unordered_map>
#include<fstream>
#include<list>
#include<functional>
#include<bitset>
#include<complex>
#include<tuple>
using namespace std;
typedef unsigned long long int ull;
typedef long long int ll;
typedef pair<ll,ll> pll;
typedef long double D;
typedef complex<D> P;
#define F first
#define S second
const ll E=1e18+7;
const ll MOD=1000000007;

template<typename T,typename U>istream & operator >> (istream &i,pair<T,U> &A){i>>A.F>>A.S; return i;}
template<typename T>istream & operator >> (istream &i,vector<T> &A){for(auto &I:A){i>>I;} return i;}
template<typename T,typename U>ostream & operator << (ostream &o,const pair<T,U> &A){o<<A.F<<" "<<A.S; return o;}
template<typename T>ostream & operator << (ostream &o,const vector<T> &A){ll i=A.size(); for(auto &I:A){o<<I<<(--i?" ":"");} return o;}
template<typename T>vector<T> & cset(vector<T> &A,T e=T()){for(auto &I:A){I=e;} return A;}







int main(){
    ll n,k,m;
    cin>>n>>k>>m;
    vector<vector<ll>> dp(2*n,vector<ll>(1LL<<k,0));
    vector<vector<ll>> nx(2*n,vector<ll>(1LL<<k,0));
    vector<ll> max_bit(1LL<<k,0);
    for(ll i=0;i<k;i++){
        for(ll j=0;j<(1LL<<k);j++){
            if(j>>i&1){max_bit[j]=1LL<<i;}
        }
    }
    dp[1][1]=1;
    for(ll i=1;i<n;i++){
        for(auto &I:nx){
            for(auto &T:I){T=0;}
        }
        for(ll j=i;j<2*i;j++){
            for(ll p=0;p<(1LL<<k);p++){
                //if(dp[j][p]==0){continue;}
                if(p+1==(1LL<<k) && i!=k){continue;}
                ll b=p;
                for(ll q=1;q<=k && j+q<(2*i+2);q++){
                    if(((b<<q)|1)>=(1LL<<k)){b^=max_bit[b]; continue;}
                    nx[j+q][(b<<q)|1]+=dp[j][p];
                    b^=max_bit[b];
                }
            }
        }
        for(auto &I:nx){
            for(auto &T:I){T%=m;}
        }
        swap(nx,dp);
        /*
        cout<<i+1<<endl;
        for(auto &I:dp){
            ll sum=0;
            for(auto &T:I){
                sum+=T;
            }
            cout<<sum<<" ";
        }
        cout<<endl;
         */
    }
    ll ans=0;
    for(ll i=n;i<2*n;i++){
        for(ll j=0;j<(1LL<<k);j++){
            if(j+1==(1LL<<k) && n!=k){continue;}
            ans+=dp[i][j];
            ans%=m;
        }
    }
    ans%=m;
    if(ans<0){ans+=m;}
    cout<<ans<<endl;
    
    
    
    
    return 0;
}


Measured memory_bytes: 6036
#include <bits/stdc++.h>
#define maxn 3001
using namespace std;
typedef long long LL;

int n;
int ar[maxn];
LL dp[maxn][maxn];

int main() {
	cin >> n;
	for( int i = 1 ; i <= n ; i++ )
		cin >> ar[i];
	int l = ( n % 2 == 0 ) ? 2 : 1;
	if( l == 1 )
		for( int i = 1 ; i <= n ; i++ )
			dp[i][i] = ar[i];
	else
		for( int i = 1 ; i < n ; i++ )
			dp[i][i+1] = abs( ar[i] - ar[i+1] );
	for( int len = l + 2 ; len <= n ; len += 2 )
		for( int i = 1 ; i+len-1 <= n ; i++ ) {
			int j = i+len-1;
			LL first = min( dp[i+2][j] + ar[i] - ar[i+1] , dp[i+1][j-1] + ar[i] - ar[j] );
			LL last = min( dp[i][j-2] + ar[j] - ar[j-1] , dp[i+1][j-1] + ar[j] - ar[i] );
			dp[i][j] = max( first , last );
		}
	cout << dp[1][n];
}


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

long long mini(int a,int b)
{
    if(a<=b)return a;
    else return b;
}

int main()
{
    long long i,j,n,x,total_hero=0,total_mons=0,final_hero=0,choto=0;
    cin>>n;

    vector<int>mons;
    vector<int>hero;

    for(i=0;i<n+1;i++)
    {
        cin>>x;
        mons.push_back(x);
        total_mons=total_mons+x;

    }
    for(i=0;i<n;i++)
    {
        cin>>x;
        hero.push_back(x);
        total_hero+=x;
    }

    for(i=0;i<n;i++)
    {
        choto=mini(hero[i],mons[i]);
        hero[i]=hero[i]-choto;
        mons[i]=mons[i]-choto;

        choto=mini(hero[i],mons[i+1]);
        hero[i]=hero[i]-choto;
        mons[i+1]=mons[i+1]-choto;

    }

    for(i=0;i<n;i++)
    {

        final_hero+=hero[i];
    }
    cout<<total_hero-final_hero;

}


Measured memory_bytes: 1400
import sys
input=sys.stdin.readline
class UnionFind:
  def __init__(self, num):
    self.rank = [0]*num
    self.par = [i for i in range(num)] #基準(par = parentのpar)
    self.n   = num
    self.size = [1]*num

#親を探す
  def find(self, x):
    if self.par[x] == x:
      return x
    else:
      self.par[x] = self.find(self.par[x]) #自分じゃなきゃ親を探す
      return self.par[x]

#集合を結合する(結合する前に親のポインタを取得する)
  def union(self, x, y):
    x = self.find(x)
    y = self.find(y)
    if x == y:
      return
    if self.rank[x] < self.rank[y]: #ランクの高い方に基準を合わせる
      x,y=y,x
    if self.rank[x] == self.rank[y]:
      self.rank[x] += 1
    self.par[y] = x
    self.size[x] += self.size[y]
    self.size[y] = 0

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

  def all_find(self):
    ls=[]
    for n in range(len(self.par)):
      ls.append(self.find(n))
    return ls


n,m=map(int,input().split())
uf=UnionFind(n)
ans=0
ab=[]
for i in range(m):
  a,b=map(int,input().split())
  ab.append([a,b])
for i in range(m):
  uf=UnionFind(n)
  flag=False
  for j in range(m):
    a,b=ab[j]
    if i==j:
      continue
    uf.union(a-1,b-1)
  if len(set(uf.all_find()))>1:
    ans+=1
  # for j in range(n):
  #   for k in range(j,n):
  #     if not uf.same(j,k):
  #       flag=True
  # if flag:
  #   ans+=1
print(ans)

Measured memory_bytes: 3064
#include <iostream>
#include <cmath>
#include <vector>
#include <algorithm>

using namespace std;

inline double add(double a, double b){
    return abs(a+b)<(1e-10)*(abs(a)+abs(b)) ? 0.0 : a+b;
}

struct vec{
    double x,y;
    vec operator-(vec b){
        return (vec){add(x,-b.x),add(y,-b.y)};
    }
    vec operator+(vec b){
        return (vec){add(x,b.x),add(y,b.y)};
    }
    vec operator*(double d){
        return (vec){x*d,y*d};
    }
    double dot(vec v){
        return add(x*v.x,y*v.y);
    }
    double cross(vec v){
        return add(x*v.y,-y*v.x);
    }
    double norm(){
        return sqrt(x*x+y*y);
    }
};

int ccw(vec& a, vec& b, vec& c){
    vec ab = b-a, ac = c-a;
    double o = ab.cross(ac);
    if(o>0) return 1; //CCW
    if(o<0) return -1; //CW
    if(ab.dot(ac)<0){
        return 2; //C-A-B
    }else{
        if(ab.dot(ab)<ac.dot(ac)){
            return -2; //A-B-C
        }else{
            return 0; //A-C-B
        }
    }
}

vector<vec> convex_hull(vector<vec>& V){
    vector<vec> C;
    vector<vec>::iterator ite;
    sort(V.begin(),V.end(),[](const vec& a, const vec& b){return a.y==b.y ? a.x < b.x : a.y< b.y;});
    C.push_back(V[0]),C.push_back(V[1]);
    for(auto i=V.begin()+2; i!=V.end(); ++i){
        C.push_back(*i);        
        while(ite=C.end()-1, C.size()>2&&ccw(*(ite-2),*(ite-1),*ite)==-1){
            C.erase(ite-1);
        }
    }
    sort(V.begin(),V.end(),[](const vec& a, const vec& b){return a.y==b.y ? a.x > b.x : a.y>b.y;});
    for(auto i=V.begin()+1; i!=V.end(); ++i){
        C.push_back(*i);
        while(ite=C.end()-1, C.size()>2&&ccw(*(ite-2),*(ite-1),*ite)==-1){
            C.erase(ite-1);
        }
    }
    C.pop_back();
    return C;
}

int main(){
    int n;
    cin >> n;
    vec v;
    vector<vec> V,C;
    while(n--){
        cin >> v.x >> v.y;
        V.push_back(v);
    }
    C=convex_hull(V);
    n=C.size();
    int i=0,j=0;
    for(int k=0;k<n;k++){
        if(C[k].x<C[i].x)i=k;
        if(C[k].x>C[j].x)j=k;
    }
    int i0=i,j0=j;
    double R=0;
    while(i!=j0||j!=i0){
        R=max(R,(C[i]-C[j]).norm());
        if((C[(i+1)%n]-C[i]).cross(C[(j+1)%n]-C[j])<0){
            i=(i+1)%n;
        }else{
            j=(j+1)%n;
        }
    }
    cout.precision(6);
    cout << fixed;
    cout << R << endl;
    return 0;
}

Measured memory_bytes: 7332
def insertionSort(N):
    for i in range(1, N):
        v = A[i]
        j = i - 1
        while j >= 0 and v < A[j]:
            A[j + 1] = A[j]
            j -= 1
        A[j + 1] = v
        print(*A)

N = int(input())
A = list(map(int, input().split()))
print(*A)
insertionSort(N)



Measured memory_bytes: 5980
INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STRM = lambda: map(str,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
LISTS = lambda: list(map(str,input().split()))
def do():
    a=INT()
    print(48-a)
if __name__ == '__main__':
    do()

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;
typedef pair<ll,ll> pll;
const ll mod=1e9+7;
//const ll mod=998244353;
const ll inf=5e18;

int main() {
  ll n,a,b;
  cin >> n >> a >> b;
  string s;
  cin >> s;
  for(ll i=0;i<n;i++) {
    if(s[i]=='a') {
      if(a+b) {
        cout << "Yes" << endl;
        if(a) a--;
        else b--;
      }
      else cout << "No" << endl;
    }
    if(s[i]=='b') {
      if(b) {
        cout << "Yes" << endl;
        b--;
      }
      else cout << "No" << endl;
    }
    if(s[i]=='c') cout << "No" << endl;
  }
}

Measured memory_bytes: 896
#include <iostream>
using namespace std;
 
int main (){
	int A,B,i = 0;
  	cin >> A >> B;
  	while(i <= 0){
  	if(A <= 5){
      cout << 0;
      break;
    }
    if(A >= 13)
      cout << B;
  	else{
    	cout << B / 2;
    }
           i++;
    }
}

Measured memory_bytes: 256
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
      	//文字列
      	String str = sc.next();
      	//カウント用
      	int count = 0;
      	//カウント最大値入れ物
      	int res = 0;
      	//String regex = "A|C|G|T";
      	//Pattern p = Pattern.compile(regex);
      	for(int i = 0; i < str.length(); i++){
      	//Matcher m = p.matcher(str.charAt(i));

          //if (m.find()){
          if(str.charAt(i) == 'A' || str.charAt(i) == 'T' || str.charAt(i) == 'G' || str.charAt(i) == 'C'){
            count++;
          }else{
          	count =0;
          }
            res = Math.max(count,res);
          }
      	System.out.println(res);
        
     }
}

Measured memory_bytes: 35588
program pro5
    implicit none
    character(len=2*10**5)::C
    integer(8)::i, b, ans
    read(*,*) C
    b = 0
    ans = 0

    do i = 1, len_trim(C)
        if(C(i:i) .eq. 'W') then
            ans = ans + b
        else
            b = b+1
        end if
    end do

    write(*,*) ans
    stop

end program pro5

Measured memory_bytes: 1084
#include <iostream>
#include <cassert>
#include <cstring>
#include <cstdlib>
#include <cstdio>
#include <cmath>
#include <ctime>
#include <queue>
#include <set>
#include <map>
#include <stack>
#include <string>
#include <bitset>
#include <vector>
#include <complex>
#include <algorithm>
using namespace std;
typedef long long ll;
typedef double db;
typedef pair<int,int> pii;
typedef vector<int> vi;
#define de(x) cout << #x << "=" << x << endl
#define rep(i,a,b) for(int i=a;i<(b);++i)
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define fi first
#define se second
const int N = 1010;
db x[N] , y[N] , r[N] , dis[N];
bool vis[N];
int n;

#define sq(x) (x)*(x)
db cal(int a,int b){
    return max(0. , sqrt(sq(x[a] - x[b]) + sq(y[a] - y[b])) - r[a] - r[b]);
}


int main(){
    cin >> x[0] >> y[0];
    cin >> x[1] >> y[1];
    cin >> n;
    rep(i,0,n) cin >> x[i+2] >> y[i+2] >> r[i+2];
    n += 2;
    rep(i,0,n) dis[i] = 1e50;
    dis[0] = 0;
    rep(i,0,n){
        int id = -1;
        rep(j,0,n) if(!vis[j] && (id == -1 || dis[j] < dis[id]))
            id = j;
        vis[id] = true;
        rep(j,0,n) if(!vis[j]) dis[j] = min(dis[j] , dis[id] + cal(id , j));
    }
    printf("%.16f\n",dis[1]);
    return 0;
}


Measured memory_bytes: 384
#include<stdio.h>
#include<algorithm>
using namespace std;
int b[1100];
int c[1100];
int main(){
	int a;scanf("%d",&a);
	for(int i=0;i<a;i++)scanf("%d%d",b+i,c+i);
	long long A=1;
	long long B=1;
	for(int i=0;i<a;i++){
		long long v=max((A+b[i]-1)/b[i],(B+c[i]-1)/c[i]);
		A=v*b[i];
		B=v*c[i];
	}
	if(A+B>1000000000000000000)return 0;
	printf("%lld\n",A+B);
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
#define endl '\n'
#define pb push_back
#define fr first
#define sc second
#define ll long long int
#define bit(idx) idx&(-idx)
#define bin(x, a) bitset<a>(x)
#define all(A) A.begin(), A.end()
#define debug(x) cout << #x << " = " << x << endl;
using namespace std;

int main(){
	ios_base::sync_with_stdio(NULL); cin.tie(); cout.tie();
	int x; cin >> x;
	for(int a = -200; a <= 200; a ++){
		for(int b = -200; b <= 200; b ++){
			if(1LL * a * a * a * a * a - 1LL * b * b * b * b * b == 1LL * x){
				cout << a << " " << b << endl;
				return 0;
			}
		}
	}
}
/**

*/

Measured memory_bytes: 3648
#include <stdio.h>
#include <ctype.h>

int main(void){
	int abc[26] = {0}, i;
	char ch;

	while (scanf("%c", &ch) != EOF){
		if (!isalpha(ch))continue;

		if (isupper(ch))ch = tolower(ch);
		abc[ch - 'a']++;
	}

	for ( i = 0; i < 26; i++){
		printf("%c : %d\n", 'a' + i, abc[i]);
	}
	
	return 0;
}

Measured memory_bytes: 548
w,h,n = map(int,input().split())
q = 0
z = 0
for i in range(n):
    x,y,a = map(int,input().split())
    if a == 1:
        if z <= x:
            z = x
    if a == 2:
        if w >= x:
            w = x
    if a == 3:
        if q <= y:
            q = y
    if a == 4:
        if h >= y:
            h = y
if w-z >= 0 and h-q >= 0:
    print((w-z)*(h-q))
else:
    print(0)

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

def main():
    # 文字列の2進数を数値にする
    # '101' → '5'
    # 文字列の頭に'0b'をつけてint()にわたす
    # binary = int('0b'+'101',0)

    # 2進数で立っているbitを数える
    # 101(0x5) → 2
    # cnt_bit = bin(5).count('1')
    
    # N! を求める
    # f = math.factorial(N)

    # N の逆元
    # N_inv = pow(N,MOD-2,MOD)

    # nCr
    # Nの階乗 * rの階乗の逆元 * n-rの階乗の逆元
    
    # 切り捨て
    # 4 // 3
    # 切り上げ
    #-(-4 // 3)
    
    # 初期値用:十分大きい数(100億)
    INF = float("inf")

    # 大きな素数
    MOD = 10**9+7
    
    # 1文字のみを読み込み
    # 入力:2
    # a = input().rstrip()
    # 変数:a='2'
    
    # スペース区切りで標準入力を配列として読み込み
    # 入力:2 4 5 7
    # a, b, c, d = (int(_) for _ in input().split())  
    # 変数:a=2 b=4 c=5 d =7
    
    # 1文字ずつ標準入力を配列として読み込み
    # 入力:2 4 5 7
    # a = list(int(_) for _ in input().split())
    # 変数:a = [2, 4, 5, 7]    

    # 1文字ずつ標準入力を配列として読み込み
    # 入力:2457
    # a = list(int(_) for _ in input())
    # 変数:a = [2, 4, 5, 7]    
    N = int(input())
    a = list(int(_) for _ in input().split())
    d = collections.defaultdict(int)
    for i in range(N):
        d[a[i]]+=1

    e_1 = 0
    e_2 = 0
    for d_i in sorted(d.items(),key=lambda x:-x[0]):
        if d_i[1] >= 4 and e_1 == 0:
            e_1 = d_i[0]
            e_2 = d_i[0]
            break
        elif d_i[1] >= 2 and e_1 == 0:
            e_1 = d_i[0]
        elif d_i[1] >= 2 and e_2 == 0:
            e_2 = d_i[0]
            break
    print(e_1 * e_2)
    
if __name__ == '__main__':
    main()


Measured memory_bytes: 25468
# include<bits/stdc++.h>
using namespace std;
# define lowbit(x) ((x)&(-x))
# define pi acos(-1.0)
# define eps 1e-8
# define MOD 1000000007
# define INF 1000000000
# define mem(a,b) memset(a,b,sizeof(a))
# define FOR(i,a,n) for(register int i=a; i<=n; ++i)
# define FDR(i,a,n) for(register int i=a; i>=n; --i)
# define bug puts("H");
# define lch p<<1,l,mid
# define rch p<<1|1,mid+1,r
# define mp make_pair
# define pb push_back
typedef pair<int,int> PII;
typedef vector<int> VI;
# pragma comment(linker, "/STACK:1024000000,1024000000")
typedef long long LL;
inline char nc(){
    static char buf[1000000],*p1=buf,*p2=buf;
    return p1==p2&&(p2=(p1=buf)+fread(buf,1,1000000,stdin),p1==p2)?EOF:*p1++;
}
inline int Scan(){
    char ch=nc();int sum=0, f=1;
    if (ch=='-') f=-1, ch=nc();
    while(!(ch>='0'&&ch<='9'))ch=nc();
    while(ch>='0'&&ch<='9')sum=sum*10+ch-48,ch=nc();
    return sum*f;
}
const int N=55;
//Code beg....

struct Node{int x, y;}node[N];
VI vx, vy;
int a[N][N], sum[N][N];

int main ()
{
    int n, K;
    LL ans=5e18;
    scanf("%d%d",&n,&K);
    FOR(i,1,n) scanf("%d%d",&node[i].x,&node[i].y), vx.pb(node[i].x), vy.pb(node[i].y);
    sort(vx.begin(),vx.end());
    sort(vy.begin(),vy.end());
    int siz_x=unique(vx.begin(),vx.end())-vx.begin();
    int siz_y=unique(vy.begin(),vy.end())-vy.begin();
    FOR(i,1,n) {
        int x=lower_bound(vx.begin(),vx.begin()+siz_x,node[i].x)-vx.begin()+1;
        int y=lower_bound(vy.begin(),vy.begin()+siz_y,node[i].y)-vy.begin()+1;
        ++a[x][y];
    }
    FOR(i,1,siz_x) FOR(j,1,siz_y) sum[i][j]=sum[i-1][j]+a[i][j];
    FOR(i,1,siz_x) FOR(j,i,siz_x) {
        int r=0, tmp=0;
        FOR(l,1,siz_y) {
            while (r<siz_y&&tmp<K) ++r, tmp+=sum[j][r]-sum[i-1][r];
            if (tmp>=K) ans=min(ans,(LL)(vx[j-1]-vx[i-1])*(vy[r-1]-vy[l-1]));
            tmp-=sum[j][l]-sum[i-1][l];
        }
    }
    printf("%lld\n",ans);
    return 0;
}


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

using namespace std;
using ll = long long;
using vec = vector<ll>;
using mat = vector<vec>;
using pll = pair<ll,ll>;

#define INF (1LL << 60)
#define MOD 1000000007
#define PI 3.14159265358979323846

#define REP(i,m,n) for(ll (i)=(m),(i_len)=(n);(i)<(i_len);++(i))
#define FORR(i,v) for(auto (i):v)
#define ALL(x) (x).begin(), (x).end()
#define PR(x) cout << (x) << endl
#define PS(x) cout << (x) << " "
#define SZ(x) ((ll)(x).size())
#define MAX(a,b) (((a)>(b))?(a):(b))
#define MIN(a,b) (((a)<(b))?(a):(b))
#define REV(x) reverse(ALL((x)))
#define ASC(x) sort(ALL((x)))
#define DESC(x) ASC((x)); REV((x))
#define pb push_back
#define eb emplace_back

int main()
{
    ll R, G, B, N;
    cin >> R >> G >> B >> N;

    ll cnt = 0;
    REP(r,0,N/R+1) {
        REP(g,0,N/G+1) {
            ll X = N - R*r - G*g;
            if(X >= 0 && X % B == 0) ++cnt;
        }
    }
    PR(cnt);

    return 0;
}

/*

Rr + Gg + Bb = N

*/

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

typedef pair<int,int> ii;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<ll> vll;
#define pb push_back
#define eb emplace_back
#define pob pop_back
#define psf push_front
#define pof pop_front
#define mkp make_pair
#define mkt make_tuple
#define all(x) x.begin(), x.end()

void solve(){
	
}

int main(){
	ios::sync_with_stdio(false), cin.tie(nullptr);
    ll k; cin>>k;
    if (k%2 == 0){
        cout<<-1<<'\n';
        return 0;
    }
    ll c = 7;
    ll power = 1;
    ll acc = 0;
    for (ll i = 0; i<20000000; i++){
        ll aux = c * power;
        acc+=aux;
        acc%=k;
        if (acc == 0){
            cout<<i+1<<'\n';
            return 0;
        }
        power *= 10;
        power%=k;
    }
	cout<<-1<<'\n';
	return 0;
}
/*
NARCO
*/


Measured memory_bytes: 3652
n = int(input())
l = list(map(int,input().split()))
l.sort()
ans = 0
if n <= 2:print(0);exit()
for i in range(n):
  for j in range(i+1,n):
    for k in range(j+1,n):
      if l[i]+l[j] > l[k] and l[i] != l[j] and l[j] != l[k]:
        ans += 1
print(ans)


Measured memory_bytes: 9188
#include<bits/stdc++.h>
#define ll long long int
#define pragi(a,b) for(ll i = a;i<b;i++)
#define pragj(a,b) for(ll j = a;j<b;j++)
#define pragk(a,b) for(ll k = a;k>=b;k--)
#define all(v) (v.begin(),v.end())
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
#define MP make_pair
#define MT make_tuple
#define F first
#define S second
#define KAKA ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
using namespace std;
const int mod = 1e9 + 7;

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<bool> vb;
typedef long double ld;
typedef pair<int, int> pii;
//typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<vvl> vvvl;
typedef pair<ll, ll> pll;

void Compute(ll n)
{
    KAKA
    vector<ll> v(n);
    pragi(0,n)
    {
        cin>>v[i];
    }
    vector<ll> suf(n);
    suf[n - 1] = v[n - 1]%mod;
    pragk(n - 2,0)
    {
        suf[k] = (suf[k + 1] + v[k])%mod;
    }
    ll sum = 0;
    pragi(0,n - 1)
    {
        sum = ((sum % mod) + ((v[i] % mod) * (suf[i + 1] % mod))%mod)%mod;
    }
    cout<<sum<<"\n";
}
int main()
{
    KAKA
    ll n;
    cin>>n;
    Compute(n);
}

Measured memory_bytes: 6328
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a,b,c,d,m;
    char num[5];
    cin>>num;
    a=num[0]-48;
    b=num[1]-48;
    c=num[2]-48;
    d=num[3]-48;

         if(a+b+c+d==7)cout<<a<<"+"<<b<<"+"<<c<<"+"<<d<<"=7";
    else if(a+b+c-d==7)cout<<a<<"+"<<b<<"+"<<c<<"-"<<d<<"=7";
    else if(a+b-c+d==7)cout<<a<<"+"<<b<<"-"<<c<<"+"<<d<<"=7";
    else if(a+b-c-d==7)cout<<a<<"+"<<b<<"-"<<c<<"-"<<d<<"=7";
    else if(a-b+c+d==7)cout<<a<<"-"<<b<<"+"<<c<<"+"<<d<<"=7";
    else if(a-b+c-d==7)cout<<a<<"-"<<b<<"+"<<c<<"-"<<d<<"=7";
    else if(a-b-c+d==7)cout<<a<<"-"<<b<<"-"<<c<<"+"<<d<<"=7";
    else if(a-b-c-d==7)cout<<a<<"-"<<b<<"-"<<c<<"-"<<d<<"=7";
    return 0;
}


Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;

public class Main {

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

    int n = sc.nextInt();
    int k = sc.nextInt();
    int q = sc.nextInt();

    int[] points = new int[n];
    Arrays.fill(points, k - q);

    for (int i = 0; i < q; i++) {
      int p = sc.nextInt();
      points[p - 1]++;
    }

    for (int point : points) {
      if (point >= 1) {
        System.out.println("Yes");
      } else {
        System.out.println("No");
      }
    }
  }
}


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

int main()
{
    int x;
    cin >> x;
    if(x >= 400 && x < 600) cout << 8 << endl;
    if(x >= 600 && x < 800) cout << 7 << endl;
    if(x >= 800 && x < 1000) cout << 6 << endl;
    if(x >= 1000 && x < 1200) cout << 5 << endl;
    if(x >= 1200 && x < 1400) cout << 4 << endl;
    if(x >= 1400 && x < 1600) cout << 3 << endl;
    if(x >= 1600 && x < 1800) cout << 2 << endl;
    if(x >= 1800 && x < 2000) cout << 1 << endl;
    return 0;
}


Measured memory_bytes: 3628
#include<iostream>
#include<climits>
#include<vector>
#include<list>
#include<functional>
#include<algorithm>
#include<string>
#include<cmath>
#include<complex>
#include<set>
#include<map>
#include<stack>
#include<queue>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) for(int i=0;i<(n);i++)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;

class question {
public:
	int H;
	vector<int> h;
	void ans() {
		cin >> H;
		h.resize(H);
		REP(i, H) cin >> h[i];
		REP(i, H) {
			int key = h[i];
			int parent = i == 0 ? INT_MAX : h[(i - 1) / 2];
			int left = (2 * i + 1 < H) ? h[2 * i + 1] : INT_MAX;
			int right = (2 * i + 2 < H) ? h[2 * i + 2] : INT_MAX;
			cout << "node " << i + 1 << ": key = " << key << ", ";
			if (parent < INT_MAX) cout << "parent key = " << parent << ", ";
			if (left < INT_MAX) cout << "left key = " << left << ", ";
			if (right < INT_MAX) cout << "right key = " << right << ", ";
			cout << "\n";
		}
	}
};

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

	question q;
	q.ans();

	return 0;
}




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

using namespace std;

int solve(){
    int l,r,d;
    cin>>l>>r>>d;
    int cnt=0;
    for (int i = d; i < 101; i+=d)
    {
        if(i>=l && i<=r) cnt++;
    }
    cout<<cnt;

    return 0;
}

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


Measured memory_bytes: 3636
from heapq import heappush, heappop


V, E, r = map(int, raw_input().split())
g = [[] for i in xrange(V)]
for i in xrange(E):
    s, t, d = map(int, raw_input().split())
    g[s].append((t, d))

INF = 10**10
dist = [INF]*V
que = [(0,r)]
dist[r] = 0
while que:
    c, v = heappop(que)
    if dist[v] < c:
        continue
    for t, cost in g[v]:
        if dist[v] + cost < dist[t]:
            dist[t] = dist[v] + cost
            heappush(que, (dist[t], t))
for i in xrange(V):
    print dist[i] if dist[i]<INF else "INF"


Measured memory_bytes: 86300
#include<bits/stdc++.h>
#include<iostream> 
using namespace std;
const int mod=1000000007;
int a[100005];
int dp[100005];
int main(){
	int n,m;
	scanf("%d %d",&n,&m);
	for(int i=1;i<=m;i++) scanf("%d",&a[i]);
	int k=1;
	dp[0]=1;
	for(int i=1;i<=n;i++){
		if(i==a[k]){
			k++;
			dp[i]=0;
			continue;
		}
		dp[i]=(dp[i-1]%mod+dp[i-2]%mod)%mod;
	}
	printf("%d",dp[n]%mod);
	return 0;
}

Measured memory_bytes: 1024
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        final Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        final String next = in.next();
        final char[] chars = next.toCharArray();

        char last = ' ';
        for (char aChar : chars) {
            if (aChar == last) {
                System.out.println("Bad");
                return;
            }
            last = aChar;
        }
        System.out.println("Good");
    }
}


Measured memory_bytes: 22228
#include <bits/stdc++.h>
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define FSP(x) fixed << setprecision(x)
using namespace std;
using ll = long long;
const ll INF = LLONG_MAX;
const long double PI = acosl(-1);
void Yes() {cout << "Yes\n";}
void No() {cout << "No\n";}
void YES() {cout << "YES\n";}
void NO() {cout << "NO\n";}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	//const ll P = 1e9 + 7;
	//const ll P = 998244353;

	ll n, k;
	cin >> n >> k;
	vector<ll> a(n);
	for (ll i = 0; i < n; i++) cin >> a[i];
	for (ll i = k; i < n; i++) {
		if (a[i] > a[i - k]) Yes();
		else No();
	}
}

Measured memory_bytes: 4776
#include <iostream>

#define DEFAULT_DEBT 1e5

using namespace std;

int calculate(int);

int main(void){
	int n; cin >> n;
	cout << calculate(n) << endl;

	return 0;
}

int calculate(int week){
	double debt = DEFAULT_DEBT;

	while(week --){
		debt *= 1.05;
		debt = ((debt / 1e3 > (int)(debt / 1e3)) ? 1e3:0) + (int)(debt / 1e3) * 1e3;
	}
	return (int)debt;
}

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

#define INF 1000000021
#define MOD 1000000007
#define pb push_back
#define sqr(a) (a)*(a)
#define M(a, b) make_pair(a,b)
#define T(a, b, c) make_pair(a, make_pair(b, c))
#define F first
#define S second
#define all(x) (x.begin(), x.end())
#define deb(x) cerr << #x << " = " << x << '\n'
#define N 222222

using namespace std;
//using namespace __gnu_pbds;

typedef long double ld;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
//typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;

const ld pi = 2 * acos(0.0);
template<class T> bool umin(T& a, T b){if(a>b){a=b;return 1;}return 0;}
template<class T> bool umax(T& a, T b){if(a<b){a=b;return 1;}return 0;}
template<class T, class TT> bool pal(T a, TT n){int k=0;for(int i=0;i<=n/2;i++){if(a[i]!=a[n-i-1]){k=1;break;}}return k?0:1;}

//int month[] = {0,31,28,31,30,31,30,31,31,30,31,30,31};

ll a[N];
pll p[N];
int main()
{
	int n, m;
	cin >> n >> m;
	for(int i = 1; i <= n; i ++)
		cin >> a[i];
	for(int i = 1; i <= m; i ++)
	{
		ll x, y;
		cin >> x >> y;
		p[i] = M(y, x);
	}
	sort(a + 1, a + n + 1);
	sort(p + 1, p + m + 1);
	reverse(p + 1, p + m + 1);
	int id = 1;
	for(int k = 1; k <= m; k ++)
	{
		ll x = p[k].F, y = p[k].S;
		int flag = 0;
		for(int i = id; i <= id + y - 1; i ++)
		{
			if(i > n)
			{
				flag = 1;
				break;
			}
			if(a[i] >= x)
			{
				flag = 1;
				break;
			}
			a[i] = x;
		}
		if(flag)
			break;
		id += y;
	}
	ll s = 0;
	for(int i = 1; i <= n; i ++) s += a[i];
	cout << s;



	





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

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

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

bool can_go(int arrive_time, int leave_time, int to_x, int to_y, int from_x, int from_y)
{
    int time = arrive_time - leave_time;
    int x = to_x - from_x;
    int y = to_y - from_y;

    if (x + y < -time || x + y > time)
        return false;
    else
    {
        if(time % 2 == 0)
            return abs(x + y) % 2 == 0;
        else
            return abs(x + y) % 2 == 1;
    }
}

int main()
{
    using vi = vector<int>;
    using vvi = vector<vi>;
    using vvvi = vector<vvi>;

    int N;
    cin >> N;

    int time, x, y;
    int prev_time = 0, prev_x = 0, prev_y = 0;
    bool possible = true;
    rep(i, N)
    {
        cin >> time >> x >> y;
        if(!can_go(time, prev_time, x, y, prev_x, prev_y))
        {
            possible = false;
            break;
        }
        prev_time = time;
        prev_x = x;
        prev_y = y;
    }
    cout << (possible ? "Yes" : "No") << endl;
}

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

int main(){
    int n;
    cin>>n;
    int a[n];
    int cnt1=0,cnt2=0;
    for(int i=0;i<n;i++){
        cin>>a[i];
        if(a[i]%2==0) cnt1++;
        else cnt2++;
    }
    if(cnt2%2==1) cout<<"NO"<<endl;
    else cout<<"YES"<<endl;
}

Measured memory_bytes: 640
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

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

		int A = sc.nextInt();
		int B = sc.nextInt();
		int C = sc.nextInt();
		Set<Integer> set = new HashSet<>();
		set.add(A);
		set.add(B);
		set.add(C);
		if (set.size() == 2) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}
}


Measured memory_bytes: 23892
// Vicfred
// https://atcoder.jp/contests/abc152/tasks/abc152_c
// greedy
import std.algorithm;
import std.array;
import std.conv;
import std.stdio;
import std.string;

void main() {
    int n = readln.chomp.to!int;
    int[] p = readln.split.map!(to!int).array;

    int minima = 1<<30;
    int answer = 0;

    foreach(item; p) {
        if(item <= minima) {
            minima = item;
            answer += 1;
        }
    }

    answer.writeln;
}



Measured memory_bytes: 11704
import java.util.*;

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

        long sum = 0;

        long limit = N;
        long i = 1;
        while(i <= limit){
            long m = (N-i)/i;
            if(m > i && (N-i)%i == 0)
                sum += m;
            i++;
            limit = m;
        }
        System.out.println(sum);
    }
}

Measured memory_bytes: 23124
#include <iostream>
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <time.h>
#include <stdlib.h>
#include <string>
#include <bitset>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <algorithm>
#include <sstream>
#include <stack>
#include <iomanip>
using namespace std;
#define pb push_back
#define mp make_pair
typedef pair<int,int> pii;
typedef long long ll;
typedef double ld;
typedef vector<int> vi;
#define fi first
#define se second
#define fe first
#define FO(x) {freopen(#x".in","r",stdin);freopen(#x".out","w",stdout);}
#define Edg int M=0,fst[SZ],vb[SZ],nxt[SZ];void ad_de(int a,int b){++M;nxt[M]=fst[a];fst[a]=M;vb[M]=b;}void adde(int a,int b){ad_de(a,b);ad_de(b,a);}
#define Edgc int M=0,fst[SZ],vb[SZ],nxt[SZ],vc[SZ];void ad_de(int a,int b,int c){++M;nxt[M]=fst[a];fst[a]=M;vb[M]=b;vc[M]=c;}void adde(int a,int b,int c){ad_de(a,b,c);ad_de(b,a,c);}
#define es(x,e) (int e=fst[x];e;e=nxt[e])
#define VIZ {printf("digraph G{\n"); for(int i=1;i<=n;i++) for es(i,e) printf("%d->%d;\n",i,vb[e]); puts("}");}
#ifdef LOCAL
#define TIMER cerr<<clock()<<"ms\n"
#else
#define TIMER
#endif
#define SZ 666666
int n,e,t,x[SZ];
ll dp[SZ],qzm[SZ];
int main()
{
	scanf("%d%d%d",&n,&e,&t);
	for(int i=1;i<=n;i++) scanf("%d",x+i);
	memset(dp,127/3,sizeof(dp)); dp[0]=0;
	memset(qzm,127/3,sizeof(qzm));
	int p=0; qzm[0]=dp[0]-2*x[1];
	for(int i=1;i<=n;i++)
	{
		while((x[i]-x[p+1])*2>t&&p<i) ++p;
		//for j>=p: (x[i]-x[j+1])*2<=t
		if(p<i) dp[i]=dp[p]+t;
		if(p) dp[i]=min(dp[i],qzm[p-1]+2*x[i]);
		qzm[i]=min(qzm[i-1],dp[i]-2*x[i+1]);
	}
	cout<<dp[n]+e<<"\n";
}


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

using namespace std;

#define pb push_back
#define mp make_pair
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
typedef long long LL;
typedef pair<int, int> PII;

LL d, n;

int main() {
    cin >> d >> n;
    LL ans = 1;
    if (n == 100) n += 1;
    forn(i, d) ans *= 100;
    ans *= n;
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
def second(hms):
    h, m, s = map(int, hms.split(':'))
    return h * 60 * 60 + m * 60 + s


while True:
    N = int(input())
    if N == 0:
        break
    trains = [0] * 86400
    for _ in range(N):
        start, end = map(second, input().split(' '))
        trains[start] += 1
        trains[end] -= 1

    for i in range(1, len(trains)):
        trains[i] += trains[i - 1]
    print(max(trains))



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

int select(int *a, int num){
    int change=0;
    for(int i=0;i<num;i++){
        int minj = i;
        for(int j=i;j<num;j++){
            if(a[minj]>a[j])
                minj = j;
        }
        if(i!=minj)
            change++;
        swap(a[i],a[minj]);
    }
    for(int i=0;i<num-1;i++){
        cout << a[i] << " ";
    }
    cout << a[num-1] << endl;
    return change;
}


int main(){
    int num; cin >> num;
    int a[num];
    for(int i=0;i<num;i++){
        cin >> a[i];
    }
    cout << select(a,num) << endl;

}

Measured memory_bytes: 1160
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
long long int mod=1000000007;
long int N=200000+5;

int main()
{
    ll n;
    cin>>n;
    ll a[N];
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
       
    }
    ll sum[n];
    sum[n-1]=a[n-1]%mod;
    for(int i=n-2;i>=0;i--)
    {
        sum[i]=(a[i]%mod+sum[i+1]%mod)%mod;
    }
    ll ans=0;
    ll k=0;
    for(int i=0;i<n-1;i++)
    {   
        
        ans=(ans%mod+((a[i]%mod)*(sum[i+1]%mod))%mod)%mod;
    
    }
    ans=ans%mod;
    cout<<ans<<endl;



    return 0;
}

Measured memory_bytes: 6720
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define snuke srand((unsigned)clock()+(unsigned)time(NULL));
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
inline int in() { int x; scanf("%d",&x); return x;}
template<typename T>inline istream& operator>>(istream&i,v(T)&v)
{rep(j,sz(v))i>>v[j];return i;}
template<typename T>string join(const v(T)&v)
{stringstream s;rep(i,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename T>inline ostream& operator<<(ostream&o,const v(T)&v)
{if(sz(v))o<<join(v);return o;}
template<typename T1,typename T2>inline istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<typename T1,typename T2>inline ostream& operator<<(ostream&o,const pair<T1,T2>&v)
{return o<<v.fi<<","<<v.se;}
template<typename T>inline ll suma(const v(T)& a) { ll res(0); for (auto&& x : a) res += x; return res;}
const double eps = 1e-10;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
#define dame { puts("-1"); return 0;}
#define yn {puts("Yes");}else{puts("No");}
const int MX = 200005;

    // 二次元ベクターの基本
    /*
    vector<vector<int>> dp; // 宣言
    dp.resize(n); // 1次元めの要素数決定
    dp[i].push_back(int); // プッシュバック
    rep(i,n){
        sort(dp[i].begin(),dp[i].end()); // 二次元めで昇順ソート
    }
    */

    // 整数スキャン（複数）
    /*
    int x;
    scanf("%d",&x);
    int y;
    scanf("%d",&y);
    int z;
    scanf("%d",&z);

    // n個の整数のスキャン
    /*
    ll a[n] = {};
    rep(i,n){
        scanf("%lld",&a[i]);
    }
    */

    // 文字列スキャン
    /*
    string s;
    cin >> s;
    */

    // n個の文字列スキャン
    /*
    vector<string> slist;
    rep(i,n){
        string s;
        cin >> s;
        slist.push_back(s);
    }
    */

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

    rep(i,k){
        if(i*2+1>n){
            cout << "NO" << endl;
            return 0;
        }
    }

    
    cout << "YES" << endl;
    return 0;
}
 
 


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

int main() {
    int a,b;
    cin >> a >> b ;
    if ( a < b ) {
    cout << "a < b" << endl;
    }
    else if ( a > b ) {
    cout << "a > b" << endl;
    }
    else if ( a == b ) {
    cout << "a == b" << endl;
    }
    return 0;
}



Measured memory_bytes: 3080
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <algorithm>
#include <iomanip>
#include <math.h>
#include <string.h>
#include <cstdio>
#include <tuple>
using namespace std; using ll = long long; using pll = pair<ll, ll>;
using vl = vector<ll>; using vll = vector<vl>; using vpll = vector<pll>;
//**デバッグ準備**//
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
void debug_out() { cerr << endl; }
template<typename Head, typename... Tail>
void debug_out(Head h, Tail... t) {
	cerr << " " << h;
	if (sizeof...(t) > 0) cerr << " :";
	debug_out(t...);
}
template <typename T>
ostream& operator<<(ostream& os, vector<T> vec) {
	for (size_t i = 0; i < vec.size(); i++)os << vec[i] << (i + 1 == vec.size() ? "" : " ");
	return os;
}
ll ctoi(char c) {
	switch (c) {
	case '0': return 0; case '1': return 1; case '2': return 2;
	case '3': return 3; case '4': return 4; case '5': return 5;
	case '6': return 6; case '7': return 7; case '8': return 8;
	case '9': return 9;  default: return 0;
	}
}
bool pairCompare(const pll firstElof, pll secondElof)
{
	return firstElof.first > secondElof.first;
}
//**Snippetリスト**//
//rep, vin, all, iteLoop//
//bitSearch, bitList, nod, gcdlcm, isPrime, primeFactorize, Npow, divisor, modinv, dfs, bfs, eratos//
//dijkstra, WarshallFloyd, BellmanFord, UnionFind, COM, digitDP ,RMQ//
ll i, j, k, l; ll N, M, K, H, W, L, X, Y, Z, R;
ll MOD = 1000000007; ll INF = 1LL << 62; ll ans = 1; ll z = 0, o = 1;
vl flag, color, D; vll path;
int main() {
	ll T1, T2;
	cin >> T1 >> T2;
	ll A1, A2;
	cin >> A1 >> A2;
	ll B1, B2;
	cin >> B1 >> B2;
	ll P1 = T1 * A1;
	ll P2 = P1+T2 * A2;
	ll Q1 = T1 * B1;
	ll Q2 = Q1+T2 * B2;
	if ((P1 > Q1 && P2 > Q2) || (P1 < Q1 && P2 < Q2)) cout << 0;
	else if (P2 == Q2) cout << "infinity";
	else {
		ans = (abs(P1 - Q1) / abs(Q2 - P2)) * 2 + 1;
		if (abs(P1 - Q1) % abs(Q2 - P2) == 0) ans--;
		cout << ans;
	}
}

Measured memory_bytes: 256
N,T = [int(i) for i in input().split()]
A = [int(i) for i in input().split()]
mintmp = float("inf")
difflist = []
for A_i in A:
    mintmp = min(A_i,mintmp)
    difflist.append(A_i-mintmp)
print(difflist.count(max(difflist)))

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

using namespace std;
typedef long long ll;
typedef pair<int,int> P;

int H,W;
char field[100][100];

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

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

	cin >> H >> W;

	int cnt_w = 0;

	for (int i = 0;i < 100;i++){
		for (int j = 0;j < 100;j++){
			field[i][j] = '#';
		}
	}

	for (int i = 1;i <= H;i++){
		for (int j = 1;j <= W;j++){
			cin >> field[i][j];
			if(field[i][j] == '.') cnt_w++;
		}
	}

	int dist[100][100]; memset(dist,-1,sizeof(dist));
	queue<P> que;
	dist[1][1] = 1;
	que.push(P(1,1));

	while(que.size()){
		P p = que.front(); que.pop();
		int x = p.second, y = p.first;
		for (int i = 0;i < 4;i++){
			int ny = y+dy[i];
			int nx = x+dx[i];
			if(dist[ny][nx] == -1 && field[ny][nx] == '.'){
				dist[ny][nx] = dist[y][x]+1;
				que.push(P(ny,nx));
			}
		}
	}

	if(dist[H][W] == -1) cout << -1 << endl;
	else cout << cnt_w-dist[H][W] << endl;

	return 0;

}


Measured memory_bytes: 384
#pragma GCC optimize ("Ofast")
#include <bits/stdc++.h>
#define FOR(i, a, b) for (int i=(a); i<(int)(b); i++)
#define FORD(i, a, b) for (int i=a; i>(int)(b); i--)
#define PPC(x) __builtin_popcount(x)
#define pb push_back
#define ALL(x) (x).begin(), (x).end()
#define ft first
#define sd second
#ifdef DEBUG
#include "debug.h"
#else
#define dbg(...) 0
#endif
using namespace std;

const int maxN = 1 << 19;
const int mod = 1000000007;

template <class T1, class T2> inline void addMod(T1& a, T2 b)	{   a = (a + b) % mod;  }
template <class T1, class T2> inline void multMod(T1& a, T2 b)	{   a = a * b % mod;    }

long long qpow(long long a, long long b)
{
    long long res0 = 1;
    for (; b!=0; b>>=1)
    {
        if (b & 1)  multMod(res0, a);
        multMod(a, a);
    }
    return res0;
}

int A[maxN];
long long pow2[maxN];

void solve()
{
	int n;
	scanf ("%d", &n);
	pow2[0] = 1ll;
	FOR(i, 1, n+1)
		pow2[i] = pow2[i-1] * 2 % mod;
	long long res = 0;
	FOR(i, 1, n+1)
		scanf ("%d", A+i);
	sort(A+1, A+n+1, greater<int>());
	
	FOR(i, 1, n+1)
	{
		long long tp = A[i];
		multMod(tp, pow2[n-i]);
		if (i != 1)
			multMod(tp, pow2[i-2]), multMod(tp, i+1);
		addMod(res, tp);
	}	

	multMod(res, pow2[n]);
	printf("%lld\n", res);
}

int main()
{
	int t;
	t = 1;//scanf ("%d", &t);
	while (t--)
		solve();
	
	return 0;
}


Measured memory_bytes: 3840
s = input()
s1 = ''
judge = False
if s[0] == 'A':
    for i in range(1,len(s)):
        s1 += s[i]
    jc = 0
    for i in range(1, len(s1)-1):
        if s1[i] == 'C':
            jc += 1
            s2 = ''
            for j in range(len(s1)):
                if j != i:
                    s2 += s1[j]
    if jc == 1:
        judge = True
    if judge:
        if s2.islower():
            print('AC')
        else:
            print('WA')
    else:
        print('WA')
else:
    print('WA')


Measured memory_bytes: 3064
#include <iostream>

using namespace std;
int n,m,x,y, ap[200001],i;
int main()
{
    cin>>n>>m;
    for(i=1;i<=m;i++)
    {
        cin>>x>>y;
        if(x==1)
        {
            if(ap[y]==2)
            {
                cout<<"POSSIBLE"<<'\n';
                return 0;
            }
            else ap[y]=1;
        }
        if(y==n)
        {
            if(ap[x]==1)
            {
                cout<<"POSSIBLE"<<'\n';
                return 0;
            }
            else ap[x]=2;
        }
    }
    cout<<"IMPOSSIBLE"<<'\n';
    return 0;
}


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

template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T> inline void POSS(T condition){ if(condition) cout << "POSSIBLE" << endl; else cout << "IMPOSSIBLE" << endl; }
template<class T> inline void Poss(T condition){ if(condition) cout << "Possible" << endl; else cout << "Impossible" << endl; }
template<class T> inline void First(T condition){ if(condition) cout << "First" << endl; else cout << "Second" << endl; }
int character_count(string text, char character){ int ans = 0; for(int i = 0; i < text.size(); i++){ ans += (text[i] == character); } return ans; }
long power(long base, long exponent, long module){ if(exponent % 2){ return power(base, exponent - 1, module) * base % module; }else if(exponent){ long root_ans = power(base, exponent / 2, module); return root_ans * root_ans % module; }else{ return 1; }}
struct position{ int y, x; }; position move_pattern[4] = {{-1, 0}, {0, 1}, {1, 0}, {0, -1}}; // double euclidean(position first, position second){ return sqrt((second.x - first.x) * (second.x - first.x) + (second.y - first.y) * (second.y - first.y)); }
template<class T, class U> string to_string(pair<T, U> x){ return to_string(x.first) + "," + to_string(x.second); }
template<class itr> void array_output(itr start, itr goal){ string ans; for(auto i = start; i != goal; i++){ ans += to_string(*i) + " "; } ans.pop_back(); cout << ans << endl; }
template<class T> T gcd(T a, T b){ if(a && b){ return gcd(min(a, b), max(a, b) % min(a, b)); }else{ return a; }} template<class T> T lcm(T a, T b){ return a / gcd(a, b) * b; }
#define mod long(1e9 + 7)
#define all(x) (x).begin(), (x).end()
#define bitcount(n) __builtin_popcountl(long(n))

int main(){
    int a, b;
    cin >> a >> b;
    cout << (b - a) * (b - a + 1) / 2 - b << endl;
}


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

#define mp make_pair
#define fst first
#define snd second
#define forn(i,n) for (int i = 0; i < int(n); i++)
#define forn1(i,n) for (int i = 1; i <= int(n); i++)
#define popcnt __builtin_popcount

using namespace std;

typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll,int> pli;
typedef pair<int,ll> pil;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;

template <typename T> T id(T b) {return b;};
template <class It> bool all(It f,It l){return std::all_of(f,l,id<bool>);}
template <class It> bool any(It f,It l){return std::any_of(f,l,id<bool>);}
template <typename T> void chmax(T &x, T y) {if (x < y) x = y;}
template <typename T> void chmin(T &x, T y) {if (x > y) x = y;}

int n;
vi a;

int main()
{
#ifdef FASTIO
  ios_base::sync_with_stdio(false); cin.tie(nullptr);
#endif

  cin >> n;
  forn(i,n) {
    int v; cin >> v;
    a.push_back(v);
  }

  int res = 0;
  for (int i = 1; i < n-1; i++) {
    if ((a[i-1] < a[i] && a[i] < a[i+1]) || (a[i+1] < a[i] && a[i] < a[i-1]))
      res++;
  }

  cout << res << endl;

  return 0;
}


Measured memory_bytes: 256
import sys, collections
input = lambda: sys.stdin.readline().rstrip() 
sys.setrecursionlimit(10**7)
INF = 10**10
def I(): return int(input())
def F(): return float(input())
def SS(): return input()
def LI(): return [int(x) for x in input().split()]
def LI_(): return [int(x)-1 for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LSS(): return input().split()

def resolve():
    T = SS()
    P = SS()

    len_P = len(P)
    for i in range(len(T)):
        if T[i:i+len_P] == P:
            print(i)

if __name__ == '__main__':
    resolve()



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

bool num[10001];

int main() {
	int sum=0;
	int a;
	cin>>a;
	int x;
	for(int i=0;i<a;i++) {
		cin>>x;
		if(!num[x]) {
			sum++;
			num[x]=1;
		}
	}
	cout<<sum<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <vector>
#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <numeric>
#include <cassert>
#include <memory>
#include <stack>
#include <set>
#include <map>

#define MAX_SIZE 100000000
typedef long long ll;
typedef unsigned long long ull;
using namespace std;

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

  int N,Y; cin>>N>>Y;
  int x = -1, y = -1, z = -1;

  for(int i = 0; i <= N; i++) {
    for(int j = 0; j <= N; j++) {
      int k = N - i - j;
      if(k < 0) { continue; }
      if(10000 * i + 5000 * j + 1000 * k == Y) {
        x = i; y = j; z = k;
        break;
      }
    }
  }

  cout << x << " " << y << " " << z << endl;
}


Measured memory_bytes: 256