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

#define int long long
#define endl '\n'

signed main() {
    ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
    string s, t; cin >> s >> t;
    int n = s.size();
    vector<int> ids[26];
    for (int i = 0; i < n; i++) 
        ids[s[i] - 'a'].push_back(i);
    int rep = 0, curr = 0, last = 100;
    for (auto i: t) {
        int ind = i - 'a';
        if (ind == last)
            curr++;
        if (ids[ind].empty()) {
            cout << -1;
            return 0;
        }
        auto k = lower_bound(ids[ind].begin(), ids[ind].end(), curr);
        if (k == ids[ind].end()) {
            ++rep;
            curr = ids[ind][0];

        } else {
            curr = *k;
        }
        last = ind;
    }
    cout << rep * n + curr + 1;
}

Measured memory_bytes: 1736
s=input()
flag=0
if s == "abc":
  flag=1
elif s == "acb":
  flag=1
elif s == "bac":
  flag=1
elif s == "bca":
  flag=1
elif s == "cab":
  flag=1
elif s == "cba":
  flag=1
  
if flag:
  print("Yes")
else:
  print("No")    
    

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

int main (void) {
  int A[3][3];
  int N, result = 0;
  bool appear[3][3];
  for (int i = 0; i < 3; i++) {
  	for (int j = 0; j < 3; j++) cin >> A[i][j];
  }
  cin >> N;
  int b[N];
  for (int i = 0; i < N; i++) cin >> b[i];
  
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < N; j++) {
      appear[i][j]=false;
      for (int k = 0; k < N; k++) {
        if (b[k] == A[i][j]) appear[i][j] = true;
      }
    }
  }
  
  for (int i = 0; i < N; i++) {
    if (appear[i][0]&&appear[i][1]&&appear[i][2]) result = 1;
  }
  for (int i = 0; i < N; i++) {
    if (appear[0][i]&&appear[1][i]&&appear[2][i]) result = 1;
  }
  if (appear[0][0]&&appear[1][1]&&appear[2][2]) result = 1;
  if (appear[2][0]&&appear[1][1]&&appear[0][2]) result = 1;
  if (result == 1) cout << "Yes";
  else cout << "No";
  
  return 0;
}


Measured memory_bytes: 256
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Main {

	public static void main(String args[]) {

		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();

		long[][] ball = new long[N][2];
		for(int i=0;i<N;i++) {
			ball[i][0] = sc.nextLong();
			ball[i][1] = sc.nextLong();
		}


		Map<String,Long> pq = new HashMap<String,Long>();
		long maxvalue = 0;
		for(int i=0;i<N;i++) {
			for(int j=i+1;j<N;j++) {
				long p = ball[j][0] - ball[i][0];
				long q = ball[j][1] - ball[i][1];

				if(p < 0 && q < 0) {
					p = -1 * p;
					q = -1 * q;
				}else if(p < 0 && q > 0) {
					p = -1 * p;
					q = -1 * q;
				}else if(p == 0 && q < 0) {
					q = -1 * q;
				}else if(p < 0 && q == 0) {
					p = -1 * p;
				}

				String s = String.valueOf(p) + "_" + String.valueOf(q);
				if(pq.containsKey(s)) {
					long temp = pq.get(s);
					temp++;
//					System.out.print("UP!:");
					if(maxvalue < temp) {
						maxvalue = temp;
					}
					pq.put(s, temp);
//					System.out.println(s+","+temp+":::"+maxvalue + ":¥t:i:"+Arrays.toString(ball[i])+"::j:"+Arrays.toString(ball[j]));
				}else {
					pq.put(s, 1L);
					if(maxvalue < 1) maxvalue = 1;
//					System.out.println(s+","+1+":::"+maxvalue + ":¥t:i:"+Arrays.toString(ball[i])+"::j:"+Arrays.toString(ball[j]));
				}
			}
		}
		System.out.println(N - maxvalue);
	}
}


Measured memory_bytes: 23636
#!/usr/bin/env perl
use strict;
use warnings;
use utf8;
use feature qw/say/;

my $S = <STDIN>;
say join(' ', detect());

sub detect {
    my ($s) = @_;
    my @c = split(//, $S);
    for my $i (0..scalar(@c)-2) {
        if (($c[$i + 1] || '') eq $c[$i]) {
            return ($i + 1, $i + 2);
        } elsif (($c[$i + 2] || '') eq $c[$i]) {
            return ($i + 1, $i + 3);
        }
    }
    return (-1, -1);
}

Measured memory_bytes: 14208
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
// #define fore(i,a) for(auto &i:a)
// #define all(x) (x).begin(),(x).end()
// #pragma GCC optimize ("-O3")
// using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
// typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
// template<class T>bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
// template<class T>bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }

using namespace std;

int main()
{
  long int x;
  cin>>x;
  
  for(long int i=0; i<1000;i++){
    long double A5=x+pow(i,5);
    long double Ad=pow(A5,0.2);
    long int Ai=(int)Ad;
    if((Ad-Ai)<pow(10,-10)&&Ai!=i){
      cout<<Ai<<" "<<i<<endl;
      return 0;
    }
  }
  for(long int i=-1; i>-1000;i--){
    long double A5=x+pow(i,5);
    long double Ad=pow(A5,0.2);
    long int Ai=(int)Ad;
    if((Ad-Ai)<pow(10,-10)&&Ai!=i){
      cout<<Ai<<" "<<i<<endl;
      return 0;
    }
  }
  
  return 0;
}

Measured memory_bytes: 4020
import heapq
N, M = map(int, input().split())
A = list(map(int, input().split()))

q = []
for i in range(N):
    heapq.heappush(q, -A[i])

for j in range(M):
    tmp = heapq.heappop(q)
    tmp = - (-tmp // 2)
    heapq.heappush(q, tmp)

ans = -sum(q)
print(ans)


Measured memory_bytes: 14180
#pragma GCC optimize ("O3")
#pragma GCC target ("avx")
//#include<bits/stdc++.h>
#include<cstdio>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please

const int cm = 1 << 17;
char cn[cm], * ci = cn + cm, ct;
inline char getcha() {
	if (ci - cn == cm) { fread_unlocked(cn, 1, cm, stdin); ci = cn; }
	return *ci++;
}
inline int getint() {
	int A = 0;
	if (ci - cn + 16 > cm) while ((ct = getcha()) >= '0') A = A * 10 + ct - '0';
	else while ((ct = *ci++) >= '0') A = A * 10 + ct - '0';
	return A;
}

const ll mod = 1e9 + 7;
ll modpow(ll A, ll B) {
	ll kotae = 1;
	while (B > 0) {
		if (B & 1) kotae = kotae * A % mod;
		A = A * A % mod;
		B >>= 1;
	}
	return kotae;
}

void pakuri_sort(int N, int A[]) {
	const int b = 8;
	int tmp[200001];
	rep(k, 4) {
		int kazu[1 << b] = {}, kazu2[1 << b] = {};
		rep(i, N) kazu[A[i] >> k * b & ((1 << b) - 1)]++;
		rep(i, (1 << b) - 1) kazu[i + 1] += kazu[i];
		for (int i = N - 1; i >= 0; i--) tmp[--kazu[A[i] >> k * b & ((1 << b) - 1)]] = A[i];
		k++;
		rep(i, N) kazu2[tmp[i] >> k * b & ((1 << b) - 1)]++;
		rep(i, (1 << b) - 1) kazu2[i + 1] += kazu2[i];
		for (int i = N - 1; i >= 0; i--) A[--kazu2[tmp[i] >> k * b & ((1 << b) - 1)]] = tmp[i];
	}
}

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


	int N = getint();
	int C[200000];
	rep(i, N) C[i] = getint();
	pakuri_sort(N, C);

	//考えることえぐいなぁ
	unsigned long long kotae1 = 0, kotae2 = 0;
	int k = 0;
	rep(i, N >> 1) {
		kotae1 += ll(N + 1 - k) * C[k++];
		kotae2 += ll(N + 1 - k) * C[k++];
	}
	if (N & 1) kotae1 += ll(N + 1 - k) * C[k++];

	printf("%lld\n", (kotae1 % mod + kotae2 % mod) * modpow(2, N + N - 2) % mod);

	Would you please return 0;
}

Measured memory_bytes: 1792
// tzl ak IOI! 
 
#include<bits/stdc++.h>
 
#define HEAP priority_queue
#define rep(i, n) for(int i = 0, _end_ = (n); i < _end_; ++i)
#define per(i, n) for(int i = (n) - 1; i >= 0 ; --i)
#define forn(i, l, r) for(int i = (l), _end_ = (r); i <= _end_; ++i)
#define nrof(i, r, l) for(int i = (r), _end_ = (l); i >= _end_; --i)
#define FOR(a, b) for(auto (a): (b))
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define X first
#define Y second
#define eps 1e-6
#define pi 3.1415926535897932384626433832795
#define SZ(x) (int)x.size()
#define ALL(x) x.begin(), x.end()
#define FILL(a, b) memset((a), (b), sizeof((a)))
#define MCPY(a, b) memcpy((a), (b), sizeof((b)))
 
using namespace std;
 
typedef long long LL;
typedef double flt;
typedef vector<int> vi;
typedef vector<LL> vl;
typedef pair<int,int> pii;
typedef pair<int,LL> pil;
typedef pair<LL,int> pli;
typedef pair<LL,LL> pll;
typedef vector<pil> vil;
typedef vector<pii> vii;
typedef vector<pli> vli;
typedef vector<pll> vll;
 
const int iinf = 1e9 + 7;
const LL linf = 1ll << 60;
const flt dinf = 1e60;
 
template <typename T>
inline void scf(T &x)
{
	bool f = 0; x = 0; char c = getchar();
	while((c < '0' || c > '9') && c != '-') c = getchar();
	if(c == '-') { f = 1; c = getchar(); }
	while(c >= '0' && c <= '9') { x = x * 10 + c - '0'; c = getchar(); }
	if(f) x = -x; return;
}
 
template <typename T1, typename T2>
void scf(T1 &x, T2 &y) { scf(x); return scf(y); }
 
template <typename T1, typename T2, typename T3>
void scf(T1 &x, T2 &y, T3 &z) { scf(x); scf(y); return scf(z); }
 
template <typename T1, typename T2, typename T3, typename T4>
void scf(T1 &x, T2 &y, T3 &z, T4 &w) { scf(x); scf(y); scf(z); return scf(w); }
 
inline char mygetchar(){ char c = getchar(); while(c == ' ' || c == '\n') c = getchar(); return c; }
 
template <typename T>
void chkmax(T &x, const T &y){ if(y > x) x = y; return; }
 
template <typename T>
void chkmin(T &x, const T &y){ if(y < x) x = y; return; }
 
#ifdef ONLINE_JUDGE
#define debug(x,c) ;
#else
#define DEBUG
#define debug(x,c) cerr<<#x<<"="<<x<<c;
#endif
 
void TZL();
 
void RANK1();
 
#define tzl int
#define ak main
#define IOI ()
tzl ak IOI
{
#undef tzl
#undef ak
#undef IOI
 
	TZL();
	RANK1();
 
#define tzl return
#define caisi 0
#define myy ;
	tzl caisi myy
#undef tzl
#undef caisi
#undef myy
}
 
//---------------------------head----------------------------
 
const int N = 1e5 + 100;
 
int n;
vi b;
 
void TZL()
{
	scf(n);
	forn(i, 1, n)
	{
		int x; scf(x);
		if(!SZ(b) || x != b.back()) b.pb(x);
	}
	return;
}
 
void RANK1()
{
	int ans = 0;
	for(int i = 0; i < SZ(b);)
	{
		++ans;
		int j = i + 1;
		if(j == SZ(b)){ printf("%d\n", ans); return; }
		if(b[j] > b[i])
		{
			while(j < SZ(b) && b[j] > b[j - 1]) ++j;
			i = j;
		}
		else
		{
			while(j < SZ(b) && b[j] < b[j - 1]) ++j;
			i = j;
		}
	}
	printf("%d\n", ans);
	return;
}

Measured memory_bytes: 892
/*
 * omg.cpp
 *
 *  Created on: 2019/06/03
 *      Author: J01003
 */
#include<iostream>
using namespace std;
int main(){
	int a,b,x;
	cin>>a>>b;
	if(a>b){
		x=a;
		a--;
	}else{
		x=b;
		b--;
	}
	if(a>b){
		x=a+x;
		a--;
	}else{
		x=b+x;
		b--;
	}
cout<<x<<endl;
	return 0;
}


Measured memory_bytes: 256
/*ANKON GHOSH
  KUET,ECE 2K16*/
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define inf 1e18
#define MAX 3100
#define mod 1000000007
#define sf(a) scanf("%lld",&a)
#define sff(a,b) scanf("%lld %lld",&a,&b)
#define sfff(a,b,c) scanf("%lld %lld %lld",&a,&b,&c)
#define Case(i) cout<<"Case #"<<i<<": "
#define pf(a) printf("%lld\n",a)
#define pfsn printf("NO\n")
#define pfs  printf("YES\n")
#define pff(a,b) printf("%lld %lld\n",a,b)
#define pfff(a,b,c) printf("%lld %lld %lld\n",a,b,c)
#define pffff(a,b,c,d) printf("%lld %lld %lld %lld\n",a,b,c,d)
#define FOR(i,n) for(ll i=0;i<n;i++)
#define FOR1(i,n) for(ll i=1;i<=n;i++)
#define LOOP(x,y) for(ll r=x;r<=y;r++)
#define RFOR(i,n) for(ll i=n-1;i>=0;i--)
#define RFOR1(i,n) for(ll i=n;i>0;i--)
#define RLOOP(x,y) for(ll i=y;i>=x;i--)
#define m_p(a,b) make_pair(a,b)
#define p_b(a) push_back(a)
#define ff first
#define ss second
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL)
map<ll,ll>mp1,mp;
vector<pair<ll,pair<ll,ll> > >vpp,vpp1;
vector<pair<ll,ll> >vp,fin;
vector<ll>v1,v2,dummy;
map<pair<ll,ll>,bool>mbb;
map<ll,bool>mb;
vector<double>v;
ll n,k,a,b,c,d,ta,sum=0,cnt=0,m,l,req,sz,maxi;
bool sortbysec(const pair<pair<ll,ll>,ll> &a,const pair<pair<ll,ll>,ll> &b)
{
    return (a.second < b.second);
}
///vector<pair<ll,ll> >adj[MAX+10];
double dp[MAX][MAX];
bool visited[MAX][MAX];
double calc(ll pos,ll nisi)
{
    if(pos>=n)
    {
        if(nisi>=req) return 1.0;
        else return 0.0;
    }
    else if(dp[pos][nisi]>-1.0) return dp[pos][nisi];
    double r1=0.00,r2=0.0;
    double head=v[pos];
    double tail=1.00-v[pos];
    r1+=(calc(pos+1,nisi+1)*head);
    r2+=(calc(pos+1,nisi)*tail);
    ///visited[pos][nisi]=true;
    return dp[pos][nisi]=r1+r2;
}
int main()
{
    sf(n);
    req=(n+2)/2;
    FOR(i,n)
    {
         FOR(j,n) dp[i][j]=-1.0;
    }
    memset(visited,false,sizeof visited);
    FOR(i,n)
    {
        double a;
        scanf("%lf",&a);
        v.p_b(a);
    }
    double ans=calc(0,0);
    printf("%.10lf",ans);
    return 0;
}


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

int64_t MOD = 1000000007;
int64_t MAX = 9223372036854775807;
double PI = 3.141592653589793;

int main()
{
    string S;
    cin >> S;
    cout << S[0] << S.size() - 2 << S[S.size() - 1];
}

Measured memory_bytes: 256
def gcd(a,b):
    if a>b:
        return gcd(b,a)
    if a==0:
        return b
    return gcd(b-a*(b//a),a)
def lcm(x,y):
    return (x*y)//gcd(x,y)
N=int(input())
A=list(map(int,input().split()))
s=1
for a in A:
    s=lcm(s,a)
ans=0
for a in A:
    ans+=s//a
print(ans%(10**9+7))

Measured memory_bytes: 4084
#include <bits/stdc++.h>
using namespace std;
/*{{{*/  //template
#define rep(i,n) for(int i=0;i<(int)(n);i++)
constexpr int INF = numeric_limits<int>::max()/2;
constexpr long long LINF = numeric_limits<long long>::max()/3;
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
#define sz(x) (int)(x).size()
#define debug(x) cerr<<#x<<":"<<x<<endl
#define debug2(x,y) cerr<<#x<<","<<#y":"<<x<<","<<y<<endl
//struct fin{ fin(){ cin.tie(0); ios::sync_with_stdio(false); } } fin_;
struct Double{ double d; explicit Double(double x) : d(x){} };
ostream& operator<<(ostream& os,const Double x){ os << fixed << setprecision(20) << x.d; return os; }
template<typename T> ostream& operator<<(ostream& os,const vector<T>& vec){ os << "["; for(const auto& v : vec){ os << v << ","; } os << "]"; return os; }
template<typename T,typename U> ostream& operator<<(ostream& os,const pair<T,U>& p){ os << "(" << p.first << ","<< p.second <<")"; return os; }
template<typename T> ostream& operator<<(ostream& os,const set<T>& st){ os<<"{"; for(T v:st) os<<v<<","; os <<"}"; return os; }
template<typename T,typename U> inline void chmax(T &x,U y){ if(y>x) x = y; }
template<typename T,typename U> inline void chmin(T &x,U y){ if(y<x) x = y; }
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
ll gcd(ll a,ll b){ if(b==0) return a; else return gcd(b,a%b); }
//constexpr double eps = 1e-14; 
constexpr double eps = 1e-10; 
constexpr ll mod = 1e9+7;
const int dx[]={1,0,-1,0} ,dy[] = {0,1,0,-1};
/*}}}*/

ll N;
string s;

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

    vector<int> sume(N+10,0);    // sume[i] = [0...i)
    vector<int> sumw(N+10,0);    // sume[i] = [0...i)


    for(int i=0;i<N;i++){
        sume[i+1] = sume[i] + (s[i] == 'E');
        sumw[i+1] = sumw[i] + (s[i] == 'W');
    }
    cerr << sume << endl;
    cerr << sumw << endl;

    int ans = INF;
    for(int i=0;i<N;i++){
        cerr << "i = " << i << endl;
        int a = 0;
        a += sume[N] - sume[i+1];
        a += sumw[i];
        cerr << sume[N] << " " << sume[i+1] <<  " " << sume[N] - sume[i+1] << endl;
        cerr << sumw[i] << endl;
        ans = min(ans,a);
    }
    cout << ans << endl;
}


Measured memory_bytes: 3076
#include <iostream>

using namespace std;

int main()
{
  char str[4];
  int ans = 0;
  
  cin >> str;
  
  for (int i = 0; i < 4; i++) {
    if (str[i] == '+') {
      ans++;
    }
    else {
      ans--;
    }
  }
  
  cout << ans << endl;
  
  return (0);
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
 
using namespace std;
 
#define INF 1000000007
#define LINF 1000000000000000007
 
typedef long long ll;
typedef pair<ll,ll> P;


int n, m, x, y, a[101], b[101];

int main(){
	cin >> n >> m >> x >> y;
	for(int i = 0; i < n; i++){
		cin >> a[i];
	}
	for(int i = 0; i < m; i++){
		cin >> b[i];
	}
	a[n] = x; b[m] = y;
	
	sort(a,a+n+1);sort(b,b+m+1);
	if(a[n] < b[0]) cout << "No War" << endl;
	else cout << "War" << endl;
	
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(){
  int m, f, r;
  while(1){
    scanf("%d %d %d", &m, &f, &r);
    if(m==-1 && f==-1 && r==-1)break;
    if(m==-1 || f==-1){
      printf("F\n");
    }else if(m+f>=80){
      printf("A\n");
    }else if(65<=m+f && m+f<80){
      printf("B\n");
    }else if(50<=m+f && m+f<65){
      printf("C\n");
    }else if(30<=m+f && m+f<50){
      if(50<=r){
    printf("C\n");
      }else{
    printf("D\n");
      }
    }else if(m+f<30){
      printf("F\n");
    }
  }
  return 0;
   
}


Measured memory_bytes: 2072
#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;

int main() {
  ll n;
  cin >> n;
  vec a(n);
  for(ll i=0;i<n;i++) {
    cin >> a[i];
  }
  ll res=1;
  ll ans=1;
  for(ll i=0;i<n;i++) {
    if(a[i]%2==0) res*=2;
    ans*=3;
  }
  cout << ans-res << endl;
}

Measured memory_bytes: 256
class ModInt
  MOD = 10 ** 9 + 7

  attr_reader :n

  def initialize(n)
    @n = n % MOD
  end

  def +(other)
    if other.is_a?(ModInt)
      ModInt.new(@n + other.n)
    else
      ModInt.new(@n + other)
    end
  end

  def -(other)
    if other.is_a?(ModInt)
      ModInt.new(@n - other.n)
    else
      ModInt.new(@n - other)
    end
  end

  def *(other)
    if other.is_a?(ModInt)
      ModInt.new(@n * other.n)
    else
      ModInt.new(@n * other)
    end
  end

  def pow(t)
    return ModInt.new(1) if t == 0
    a = pow(t >> 1)
    a = a * a
    if t[0] == 1
      a = a * self
    end
    a
  end

  def inv
    pow(MOD - 2)
  end

  def /(other)
    if other.is_a?(ModInt)
      self * other.inv
    else
      self * ModInt.new(other).inv
    end
  end
end

N, A, B = gets.split.map(&:to_i)

def factorial(n, m)
  ret = ModInt.new(1)
  n.downto(m).each do |a|
    ret = ret * a
  end
  ret
end

all = ModInt.new(2).pow(N) - 1
ans = all
ans = ans - (factorial(N, N - A + 1) / factorial(A, 1))
ans = ans - (factorial(N, N - B + 1) / factorial(B, 1))
puts ans.n

Measured memory_bytes: 1916
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <map>
#include <numeric>
#include <string>
#include <cmath>
#include <iomanip>
#include <queue>
#include <list>
#include <stack>
#include <set>
#include <cctype>
#include <cmath>

using namespace std;

/* typedef */

typedef long long ll;

/* constant */

const int INF = 1 << 30;
const int MAX = 10000;
const int mod = 1000000007;
const double pi = 3.141592653589;
/* global variables */

/* function */
void printAns(bool can);

/* main */
int main(){

    int n, m;
    cin >> n;
    vector<int> a(n);
    for (int i = 0; i < n; i++) cin >> a[i];
    cin >> m;
    vector<int> b(m);
    for (int i = 0; i < m; i++) cin >> b[i];
    /*
    if (n < m) {
        printAns(0);
        return 0;
    }
    */
    bool can = includes(a.begin(), a.end(), b.begin(), b.end());
    printAns(can);
}

void printAns(bool can) {
    if (can)
        cout << 1 << '\n';
    else 
        cout << 0 << '\n';
}



Measured memory_bytes: 4424
package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"strconv"
)

const (
	initialBufSize = 1024
	maxBufSize     = 1e6
)

var (
	scanner = bufio.NewScanner(os.Stdin)
)

func main() {
	scanner.Split(bufio.ScanWords)
	x, y, z := scanInt(), scanInt(), scanInt()
	fmt.Println(z, x, y)
}

func scanInt() int {
	i, _ := strconv.Atoi(scanText())
	return i
}

func scanInts(size int) []int {
	ints := make([]int, size)
	for i := 0; i < size; i++ {
		ints[i] = scanInt()
	}
	return ints
}

func scanFloat64() float64 {
	f, _ := strconv.ParseFloat(scanText(), 64)
	return f
}

func scanFloat64s(size int) []float64 {
	f := make([]float64, size)
	for i := 0; i < size; i++ {
		f[i] = scanFloat64()
	}
	return f
}

func scanText() string {
	scanner.Scan()
	return scanner.Text()
}

func scanTexts(size int) []string {
	s := make([]string, size)
	for i := 0; i < size; i++ {
		s[i] = scanText()
	}
	return s
}

func abs(n int) int {
	if n < 0 {
		return -n
	}
	return n
}

func pow(x, y int) int {
	return int(math.Pow(float64(x), float64(y)))
}


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

		using namespace std;

		int main()
		{ios_base::sync_with_stdio(false);
		    cin.tie(NULL);
		 	  string s;
		 	  cin>>s;
		 	  int ans=0;
		 	  for(auto i:s)
		 	  {
		 	  	if(i=='+')
		 	  		ans++;
		 	 	else
		 	 		ans--;
		 	  }
		 	  cout<<ans<<endl;
			return 0;

		}

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

int main(){
  ll n;
  cin>>n;
  ll m3,m5,m15;
  m3=n/3;
  m5=n/5;
  m15=n/15;
  ll sum=n*(n+1)/2- 3*m3*(m3+1)/2-5*m5*(m5+1)/2+15*m15*(m15+1)/2;
  cout <<sum<<endl;
  
}

Measured memory_bytes: 3568
#include <iostream>
#include <map>
#include <algorithm>
#define INF 1<<27
#define MAX_N 201

using namespace std;
int mincost[MAX_N];
int n,m;
int cost[MAX_N][MAX_N];
bool used[MAX_N];
int prim()
{
  int res = 0;
  mincost[0] = 0;
  while(1)
    {
      int v = -1;
      for(int i = 0 ; i < n ; i++ ){
	while( !used[i] && (v == -1 || mincost[i] < mincost[v]))v = i;
      }
      if(v == -1)break;
      used[v] = true;
      res += mincost[v];

      for(int i = 0 ; i < n ; i++ )
	{
	  mincost[i] = min(mincost[i],cost[v][i]);
	}
    }
  return res;
}

int main()
{
  while(cin >> n >> m,n)
    {
      fill(cost[0],cost[MAX_N],INF);
      fill(used,used+MAX_N,false);
      fill(mincost,mincost+MAX_N,INF);
      for(int i = 0 ; i < m ; i++ )
	{
	  char c;
	  int a,b,d;
	  cin >> a >> c >> b>>c >> d;
	  cost[a][b] = cost[b][a] = (d-100)/100;
	}
      int res = prim();
      cout << res << endl;
    }
  return 0;
}

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

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

  cout << (n+2*d)/(2*d+1) << endl;
}

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

int main() {
  int n, k;
  cin >> n >> k;
  
  double prob = 0;
  
  for(int i=0; i<n; i++) {
    int d = 0;
    for(int j=0; j<100000; j++) {
      if(pow(2, j) * (i + 1) >= k) {
        d = j;
        break;
      }
    }
    prob += 1.0 / (n * pow(2, d));
  }
  
  printf("%.12lf\n", prob);
}

Measured memory_bytes: 256
import java.util.*;

class Main {
	Scanner sc;
	int A, B, C;
	
	private void calc() {
		sc = new Scanner(System.in);
		A = sc.nextInt();
		B = sc.nextInt();
		C = sc.nextInt();
		if ((A == B && A != C) ||
			(B == C && B != A) ||
			(C == A && C != B)) System.out.println("Yes");
		else System.out.println("No");
	}

	public static void main(String[] args) {
		new Main().calc();
	}
}


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


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

    unordered_map<int, int> s;
    int n;
    for (cin >> n; n--;) {
        int x;
        cin >> x;
        s[x]++;
    }
    auto e = s.end(), i = s.find(1);
    int r = i != e && i->second == 1;
    if (s[1] == 0) {
        for (auto p : s) {
            if (p.second == 1) {
                int x = p.first;
                int i;
                for (i = 2; i * i <= x && (x % i || s.find(i) == e &&  s.find(x / i) == e); i++);
                if (i * i > x)
                    r++;
            }
        }
    }
    cout << r << '\n';
    return 0;
}


Measured memory_bytes: 11364
N = int(input())
A = [int(x) for x in input().split()]
 
def gcd(x, y):
    if y == 0:
        return x
    else:
        return gcd(y, x % y) #再帰定義
    
list_gcd = [(gcd(A[0],A[1]),False),(A[0],True),(A[1],True)]
#print(list_gcd)
 
for i in range(2,len(A)):
    next_gcd = []
    for j in list_gcd:
        if j[1]:
            this_gcd = (gcd(j[0],A[i]),True)
            if not(this_gcd in next_gcd):
                next_gcd.append(this_gcd)
        else:
            this_gcd = (gcd(j[0],A[i]),False)
            if not(this_gcd in next_gcd):
                next_gcd.append(this_gcd)
                
            this_gcd = (j[0],True)
            if not(this_gcd in next_gcd):
                next_gcd.append(this_gcd)
    list_gcd = next_gcd
    #print(list_gcd)
         
out = 1
for i in list_gcd:
    if i[0] > out:
        out = i[0]
        
print(out)

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

public final class Main {

    private static final int MOD = 998244353;

    public static void main(String[] args) {
        final Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        final int a = in.nextInt();
        final int b = in.nextInt();
        final int c = in.nextInt();
        final int d = in.nextInt();
        System.out.println(dfs(a, b, c, d, new Integer[c + 1][d + 1]));
    }

    private static long dfs(int a, int b, int c, int d, Integer[][] dp) {
        if (a == c && b == d) {
            return 1;
        }
        if (dp[a][b] != null) {
            return dp[a][b];
        }
        int res = 0;
        if (a < c) {
            res += Math.floorMod(b * dfs(a + 1, b, c, d, dp), MOD);
        }
        if (b < d) {
            res += Math.floorMod(a * dfs(a, b + 1, c, d, dp), MOD);
        }
        if (a < c && b < d) {
            res -= Math.floorMod(a * b * dfs(a + 1, b + 1, c, d, dp), MOD);
        }
        return dp[a][b] = Math.floorMod(res, MOD);
    }
}


Measured memory_bytes: 301780
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); ++i)
#define outl(x) cout<< (x) << '\n'
using pii = pair<int,int>;
using ll = long long;

#define J 50'000'000'000'000'000LL
#define INF (1 << 29)

string s;
ll k;

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

    cin >> s >> k;

    if (k == 1) {
        outl(s[0]);
    }
    else {
        int i = 0;
        while (i < s.length() && s[i] == '1') ++i;
        // if (i <= k) outl('1');
        // else outl(s[i]);

        if (i < k) outl(s[i]);
        else outl('1');
    }

    return 0;
}



Measured memory_bytes: 256
N, M = map(int, input().split())

Cs = []
for i in range(M):
    P, Y = map(int, input().split())
    Cs.append((P, Y, i))
Cs.sort()
Cs[0] = (Cs[0][2], Cs[0][0], 1)
for i in range(1, M):
    if Cs[i][0] == Cs[i - 1][1]:
        Cs[i] = (Cs[i][2], Cs[i][0], Cs[i - 1][2] + 1)
    else:
        Cs[i] = (Cs[i][2], Cs[i][0], 1)
Cs.sort()

for C in Cs:
    print("{:06}{:06}".format(C[1], C[2]))

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

#define rep(i,a,b) for(ll i = (ll)(a); i < (ll)(b); i++)
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define fill(x,v) memset(x,v,sizeof(x))
#define all(x) (x).begin(), (x).end()
#define trace(x) cout << #x <<": " << x << endl
#define fastio ios_base::sync_with_stdio(0); cin.tie(0);cout.tie(0);
#define pi acos(-1)

typedef long long ll;
typedef unsigned long long ull;
typedef vector<ll> vi;
typedef pair<ll,ll> ii;
typedef vector<ii> vii;

const int MAX = 1<<19;

vi arr;

bool vis[MAX];
set<pair<int, int> > lista[MAX];

void merge(int a, int b){
    lista[a].insert(*(lista[b].begin()));
    lista[a].insert(*(lista[b].rbegin()));
    while(lista[a].size() > 2){
        lista[a].erase(*(lista[a].rbegin()));
    }
}

void solve(){
    ll n;
    cin >> n;
    arr.resize(1<<n);
    for(int i = 0; i < (1<<n); i++){
        cin >> arr[i];
    }
    for(int i = 1; i < (1<<n); i++){
        lista[i].insert(mp(-arr[0],0));
        lista[i].insert(mp(-arr[i],i));
    }

    fill(vis, 0);
    queue<int> cola;
    cola.push(0);
    vis[0] = true;
    int curr, aux,aux2;
    while(!cola.empty()){
        curr = cola.front();
        cola.pop();
        aux = curr;
        for(int i = 0; i < n; i++){
            if((aux&1) == 0){
                aux2 = curr | (1<<i);
                if(curr){
                    merge(aux2, curr);
                }
                if(!vis[aux2]){
                    vis[aux2] = true;
                    cola.push(aux2);
                }
            }
            aux >>= 1;
        }
    }
    ll curr2 = -1;
    ll suma;
    int a, b;
    for(int i = 1; i < (1<<n); i++){
        a = (*(lista[i].begin())).ff;
        b = (*(lista[i].rbegin())).ff;
        suma = -a - b;
        if(suma > curr2) curr2 = suma;
        cout << curr2 << endl;
    }
    
    return ;
}

int main(){
    fastio;
    int t = 1;
    //cin >> t;
    while(t--) solve();
    return 0;
}

Measured memory_bytes: 55404
import java.util.Scanner;


public class Main {


  public static void main(String[] args) {

	  Scanner sc=new Scanner(System.in);
	 int n=Integer.parseInt(sc.next());
	 int a[]=new int[n+1];
	 int min=0,max=0;
	 long sum=0;

	 for(int i=0;i<n;i++){
		 a[i]=Integer.parseInt(sc.next());
		 if(i==0){
			 min=a[i];
			 max=a[i];
			
		 }
		
		 sum=sum+a[i];
		 min=Math.min(min, a[i]);
		 max=Math.max(a[i], max);
		 
		 
	 }

	 System.out.println(min + " " + max + " "+ sum);

  }
}

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

struct UnionFind {
    vector<int> Parent;
    vector<int> Size;

    UnionFind(int N) : Parent(N), Size(N,1){
        for(int i = 0; i < N; i++) Parent[i] = i;
    }

    int root(int A) {
        if (Parent[A] == A) return A;
        return Parent[A] = root(Parent[A]);
    }

    bool merge(int A, int B) {
        A = root(A);
        B = root(B);
        if (A == B) return false;

        if (Size[A] < Size[B]) swap(A, B);

        Size[A] += Size[B];
        Parent[B] = A;
        return true;
    }

    bool issame(int A, int B) { //
        return root(A) == root(B);
    }

    int findsize(int A) {
        return Size[root(A)];
    }
};

signed main() {
    int n,m;
    cin >> n >> m;

   vector<int> a(m), b(m);
   rep(i,m) {
       cin >> a[i] >> b[i];
       a[i]--, b[i]--;
   }
   reverse(a.begin(),a.end());
   reverse(b.begin(),b.end());

    UnionFind Tree(n);

    vector<int> ans(m+1);
    int tot = n * (n - 1) / 2;
    ans[0] = tot;
    for(int i = 0; i < m; i++){
        int x = a[i], y = b[i];
        if(Tree.issame(x,y));
        else {
            int cnt = Tree.findsize(x) * Tree.findsize(y);
            Tree.merge(x,y);
            tot -= cnt;
        }
        ans[i+1] = tot;
    }

    reverse(ans.begin(),ans.end());
    for(int i = 1; i <= m; i++){
        cout << ans[i] << endl;
    }

}


Measured memory_bytes: 5248
S = gets.chomp.split("")

for i in 0...S.length do
  if (i + 1).even? && S[i] == 'R' then
    puts 'No'
    break
  elsif (i + 1).odd? && S[i] == 'L' then
    puts 'No'
    break
  elsif (i + 1) == S.length then
    puts 'Yes'
  end
end

Measured memory_bytes: 1788
#include <iostream>
#include <iomanip>
#include <cassert>

#include <vector>
#include <algorithm>
#include <limits>

using namespace std;

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

constexpr int64_t INF = numeric_limits<int64_t>::max();

void Main()
{
	int N;
	cin >> N;

	vector<int64_t> T(N);
	rep(i, N)
	{
		cin >> T[i];
	}

	int64_t totalT = 0;
	rep(i, N)
	{
		totalT += T[i];
	}

	int M;
	cin >> M;
	vector<int64_t> actualTime(M);
	rep(i, M)
	{
		int64_t P, X;
		cin >> P >> X;
		--P;

		actualTime[i] = totalT - T[P] + X;
	}

	rep(i, M)
	{
		cout << actualTime[i] << endl;
	}
}

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

	Main();
	return 0;
}

Measured memory_bytes: 3648
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <map>
#include <vector>
#include <algorithm>
#include <set>
#include <queue>
using namespace std;
const int maxn = 100050;
typedef long long ll;
priority_queue<int>pq;


int main()
{
   int n;
   cin>>n;
   if(n%2)
   {
       cout<<n*2<<endl;
   }
   else cout<<n<<endl;

    return 0;
}


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

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

Measured memory_bytes: 1160
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <cmath>
#define FUP(i,x,y) for(int i=(x);i<=(y);i++)
#define FDW(i,x,y) for(int i=(x);i>=(y);i--)
#define MAXN 100010
#define INF 0x3f3f3f3f
#define MOD 1000000007
#define ll long long
#define db double
using namespace std;
int read(){
    int w=0,flg=1;
    char ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-')flg=-1;ch=getchar();}
    while(ch<='9'&&ch>='0'){w=w*10-'0'+ch,ch=getchar();}
    return w*flg;
}
int n,x,maxx;
ll sum;
int main(){
	n=read();
	FUP(i,1,n)
	{
		x=read();
		if(maxx>x) sum+=maxx-x;
		else maxx=x;
	}
	printf("%lld\n",sum);
    return 0;
}

Measured memory_bytes: 3752
import java.util.*;
 public class Main{
   
   	public static void main(String [] args){
      
      	Scanner sc = new Scanner(System.in);
      
      	String s = sc.next();
      	String t = sc.next();
      
      	if(t.startsWith(s) && t.length()-1 == s.length())
        {
          System.out.println("Yes");
        }
      	else
        {
          System.out.println("No");
        }
    }
 }

Measured memory_bytes: 35616
n,m=map(int,input().split())
l=[0]*(n+1)
flag=True
for _ in range(m):
    s,c=map(int,input().split())
    if s==1 and c==0 and n!=1:
        flag=False
        print(-1)
        break
    elif l[s]==0 or l[s]==c:
        if c==0:
            l[s]=-1
        else:
            l[s]=c
    elif l[s]==-1 and c==0:
        l[s]=-1
    else:
        flag=False
        print(-1)
        break
for i in range(1,n+1):
    if l[i]==-1:
        l[i]=0
if flag==True:
    if n==1:
        print(l[1])
    else:
        k=0
        for i in range(1,n+1):
            k+=l[i]*10**(n-i)
        if l[1]==0:
            print(k+10**(n-1))
        else:
            
            print(k)

Measured memory_bytes: 3064
import java.util.*;

public class Main{
	public static void main(String[] $){
		Scanner s=new Scanner(System.in);
		int[] f=new int[9];
		Arrays.setAll(f,i->s.nextInt());
		for(int n=s.nextInt();n>0;--n){
			int i=s.nextInt();
			for(int j=0;j<9;++j)
				if(i==f[j])
					f[j]=0;
		}

		boolean r=false;
		r|=f(f,0,4,8);
		r|=f(f,2,4,6);
		for(int i=0;i<3;++i){
			r|=f(f,i,i+3,i+6);
			r|=f(f,i*3,i*3+1,i*3+2);
		}
		System.out.println(r?"Yes":"No");
	}
	static boolean f(int[] f,int i,int j,int k){
		return f[i]+f[j]+f[k]==0;
	}
}


Measured memory_bytes: 28756
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < int(n); ++i)
int main(){
    int n; cin >> n;
    vector<int> d(n); rep(i,n) cin >> d[i];
    vector<int> dsum(n+1,0); rep(i,n) dsum[i+1] = dsum[i] + d[i];
    int ans = 0;
    rep(i,n-1) ans += d[i]*(dsum[n]-dsum[i+1]);
    cout << ans << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;
class Main{
	
    public static void main(String args[]){
Scanner sc=new Scanner(System.in);
String s=sc.next();
String a=s.substring(0,5);
String b=s.substring(6,13);
String c=s.substring(14,19);
System.out.println(a+" "+b+" "+c);   

 }
  }

 

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

bool contains(string s, vector<char> vec) {
	for(char c : s) {
		for(char cc : vec) {
			if(c == cc) {
				return false;
			}
		}
	}

	return true;
}
 
int main() {
  	int N, K;
  	cin >> N >> K;
  
  	vector<char> vec(K);
  
  	for(int i = 0; i < K; ++i) {
    	cin >> vec.at(i);
    }
		
	while(true) {
		string N_str = to_string(N);
		if(contains(N_str, vec)) {
			cout << N_str;
			return 0;
		} else {
			++N;
		}
	}
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cctype>

using namespace std;
int main() {
	char ch;
	int cnt[26] = {};

	while (cin >> ch) {
		ch = tolower(ch);
		if (isalpha(ch)) {
			cnt[ch - 'a']++;
		}
	}

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

	return 0;
}

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

int64_t MOD = 1000000007;
double PI = 3.141592653589793;

int main()
{
    int N;
    cin >> N;
    vector<bool> list(N);
    for (int i = 0; i < N; i++)
    {
        int x, y;
        cin >> x >> y;
        if (x == y)
            list[i] = true;
    }
    bool ans = false;
    for (int i = 0; i < N - 2; i++)
    {
        if (list[i] && list[i + 1] && list[i + 2])
            ans = true;
    }
    if (ans)
        cout << "Yes";
    else
        cout << "No";
}

Measured memory_bytes: 3624
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <string>
#include <sstream>
#include <cstring>
#include <queue>
#include <map>
using namespace std;

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

int N;
long long K, A[210000];

string ok = "POSSIBLE";
string ng = "IMPOSSIBLE";

int main() {
	while (cin >> N >> K) {
		long long maxA = 0;
		for (int i = 0; i < N; ++i) {
			cin >> A[i];
			if (maxA < A[i]) maxA = A[i];
		}
		long long g = A[0];
		for (int i = 0; i < N; ++i) g = GCD(g, A[i]);

		if (N == 1) {
			if (A[0] == K) cout << ok << endl;
			else cout << ng << endl;
		}
		else {
			if (maxA < K) cout << ng << endl;
			else if (K % g != 0) cout << ng << endl;
			else cout << ok << endl;
		}

	}
}

Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdlib>
#include <map>
#include <iomanip>
#include <set>
using namespace std;
#define pie 3.141592653589793238462643383279
#define int long long
#define mod 1000000007
#define INF 1145141919364364
#define all(vec) vec.begin(),vec.end()
#define P pair<int,int>
#define S second
#define F first
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x%y);
}
int lcm(int x, int y) {
	return x / gcd(x, y)*y;
}
bool prime(int x) {
	for (int i = 2; i <= sqrt(x); i++) {
		if (x%i == 0)return false;
	}
	return true;
}

int kai(int x) {
	if (x == 0)return 1;
	return kai(x - 1)*x%mod;
}

int mod_pow(int x, int y, int mood) {
	int res = 1;
	while (y > 0) {
		if (y & 1)res = res * x%mood;
		x = x * x%mood;
		y >>= 1;
	}
	return res;
}

int comb(int x, int y) {
	return kai(x)* mod_pow(kai(x - y), mod - 2, mod) % mod * mod_pow(kai(y), mod - 2, mod) % mod;
}

int n, b[114];
int ans;

signed main() {
	cin >> n;
	for (int i = 0; i < n - 1; i++)cin >> b[i];
	ans += b[0];
	for (int i = 0; i < n - 2; i++) {
		ans += min(b[i], b[i + 1]);
	}
	ans += b[n - 2];
	cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<algorithm>
#include<math.h>
#include<string>
#include<iostream>
#include<vector>
#include<cstdlib>
using namespace std;
 
template <class T> using V = vector<T>;
 
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
 
const long long INF = 1LL << 60;
 
using ll = long long;
using db = double;
using st = string;
using ch = char;
using bl = bool;
using vll = V<ll>;
using vpll =V<pair<ll,ll>>;
using vst = V<st>;
using vdb = V<db>;
using vch = V<ch>;
using vbl = V<bl>;
 
 
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define rFOR(i,a,b) for(ll i=(a);i>(b);i--)
#define oFOR(i,a,b) for(ll i=(a);i<(b);i+=2)
#define bgn begin()
#define en end()
#define SORT(a) sort((a).bgn,(a).en)
#define REV(a) reverse((a).bgn,(a).en)
#define M(a,b) max(a,b)
#define rM(a,b) min(a,b)
#define fi first
#define se second
#define sz size()
#define gcd(a,b) __gcd(a,b)
#define co(a) cout<<a<<endl;
#define ci(a) cin>>a;
 

vll dp(100100);

ll sum(ll n) {
  ll m=0;
  FOR(i,0,20){
    m+=n%10;
    n/=10;
    if(n==0){
      break;
    }
  }
  return m;
}
 
 
const int MAX = 510000;
const int MOD = 1000000007;
 
long long fac[MAX], finv[MAX], inv[MAX];
 
void Comuse() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
 
 
#define comuse Comuse()
 
ll combi(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
 
 
 
 
ll lcm(ll a,ll b){
  ll n;
  n=a/gcd(a,b)*b;
  return n;
}
 
 
/****************************************\
| Thank you for viewing my code:)        |
| Written by RedSpica a.k.a. RanseMirage |
| Twitter:@asakaakasaka                  | 
\****************************************/
 
 
signed main() {
  ll n;
  	ci(n);
  FOR(i,0,1910000000){
    if(i%2==0){
      n*=3;
    }
    else{
      n/=3;
    }
  }
  co(3*n*n)
}


Measured memory_bytes: 1024
/**
 * @copyright (c) 2020 Daisuke Hashimoto
 */

#include <bits/stdc++.h>
using namespace std;
using Pair = pair<int64_t, int64_t>;
constexpr int64_t kInf = INT64_MAX / 2L;

// std::cout << std::setprecision(20) << 1.1 << endl;

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

  int64_t N;
  cin >> N;
  vector<int64_t> count(5, 0);
  for (int64_t i = 0; i < N; ++i) {
    string s;
    cin >> s;
    if (s[0] == 'M') {
      ++count[0];
    } else if (s[0] == 'A') {
      ++count[1];
    } else if (s[0] == 'R') {
      ++count[2];
    } else if (s[0] == 'C') {
      ++count[3];
    } else if (s[0] == 'H') {
      ++count[4];
    } else {
      // DO NOTHING
    }
  }
  int64_t result = 0;
  for (int64_t i = 0; i < 5; ++i) {
    for (int64_t j = i + 1; j < 5; ++j) {
      for (int64_t k = j + 1; k < 5; ++k) {
        result += count[i] * count[j] * count[k];
      }
    }
  }
  cout << result << endl;
  return 0;
}


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

int xi(int r, int d, int x) {
    int xi = r*x - d;
    return xi;
}

int main() {
    int r, d, x;
    cin >> r >> d >> x;
    for (int i=0; i<10; ++i) {
        x = xi(r, d, x);
        cout << x << endl;
    }
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
	Scanner in = new Scanner(System.in);
	public static void main(String[] args) {
		new Main();
	}
	public Main(){
		new AOJ1154().doIt();
	}
	
	class AOJ1154{
		ArrayList<Integer> list;
		int N = 300010;
		boolean[] MondayPrime;
//		int N = 100;
		void doIt(){
			list = new ArrayList<Integer>();
			list = new ArrayList<Integer>();
			for(int i=2;i<N;i++)if(i%7==1||i%7==6)list.add(i);
			MondayPrime = new boolean[N];
			HashSet<Integer> set = new HashSet<Integer>();
			for(int i=0;i<list.size();i++)set.add(list.get(i));
			Arrays.fill(MondayPrime, true);
			for(int i=0;i<N;i++)if(set.contains(i)==false)MondayPrime[i] = false;
			for(int i=0;i<list.size();i++)if(MondayPrime[list.get(i)]){
				for(int s=list.get(i)*2;s<N;s+=list.get(i))MondayPrime[s]=false;
			}
			while(in.hasNext()){
				int n = in.nextInt();
				if(n==1)break;
				System.out.print(n+":");
				for(int i=0;i<=n;i++)if(MondayPrime[i]&&n%i==0)System.out.print(" "+i);
				System.out.println();
			}
		}
	}
	
}

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

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define FORR(i,a,b) for(int i=(int)(b)-1;i>=(int)(a);i--)

#define CHMIN(a,b) (a)=min((a),(b))
#define CHMAX(a,b) (a)=max((a),(b))

#define DEBUG(x) cout<<#x<<": "<<(x)<<endl

int n,k;
ll h[125252];

int main(){
	cin>>n>>k;
	REP(i,n)cin>>h[i];
	sort(h,h+n);
	ll ans = 1ll<<60;
	REP(i,n)if(i+k<=n)CHMIN(ans,h[i+k-1]-h[i]);
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 1024
#include<stdio.h> 
long long fiboDP(int n) {
    long long fibodp[200] = {0};
    fibodp[0] = 1;
    fibodp[1] = 1;
    for(int i=2; i<=n; i++) {
        fibodp[i] = fibodp[i-1] + fibodp[i-2];
        }
        return fibodp[n];
        }
        int main(void){
            int n;
            scanf("%d\n", &n);
            printf("%lld\n", fiboDP(n));
            return 0;
            }



Measured memory_bytes: 2048
#include <algorithm>
#include <iostream>
#include <vector>

#define ll long long

using namespace std;

const int MAX = 510000;
const int MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];

void COMinit() {
  fac[0] = fac[1] = 1;
  finv[0] = finv[1] = 1;
  inv[1] = 1;
  for (int i = 2; i < MAX; i++) {
    fac[i] = fac[i - 1] * i % MOD;
    inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
    finv[i] = finv[i - 1] * inv[i] % MOD;
  }
}

long long COM(int n, int k) {
  if (n < k)
    return 0;
  if (n < 0 || k < 0)
    return 0;
  return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int main() {
  ll N, K;
  cin >> N >> K;
  vector<ll> A(N);
  for (int i = 0; i < N; i++) {
    cin >> A[i];
  }
  sort(A.begin(), A.end());
  COMinit();

  ll ans = 0;
  for (int i = 0; i < N; i++) {
    ans += (A[i] * (COM(i, K - 1) - COM(N - i - 1, K - 1))) % MOD;
  }
  cout << ans % MOD << endl;
}


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

#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)

#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=int(a)-1;i>=int(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)

#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))
#define popcount(n) (__builtin_popcountll(n))

using namespace std;

template<class T>bool chmax(T &a, const T &b) { return (a<b)?(a=b,1):0;}
template<class T>bool chmin(T &a, const T &b) { return (b<a)?(a=b,1):0;}

using ll=long long;
using R=long double;
const R EPS=1e-9L; // [-1000,1000]->EPS=1e-8 [-10000,10000]->EPS=1e-7
inline int sgn(const R& r){return(r > EPS)-(r < -EPS);}
inline R sq(R x){return sqrt(max(x,0.0L));}

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

// Problem Specific Parameter:

int main(void){
	ll a,b,c,k;
	cin >> a >> b >> c >> k;
	if(k % 2 == 1)
		cout << b - a << endl;
	else
		cout << a - b << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
const double EPS = 1e-10;
typedef complex<double> P;
typedef pair<P,P> L;
double cross(const P& a, const P& b) {return imag(conj(a)*b);}
double dot(const P& a, const P& b) {return real(conj(a)*b);}
int ccw(P a, P b, P c) {
  b-=a;c-=a;
  if(cross(b,c)>EPS)return +1;
  if(cross(b,c)<-EPS)return -1;
  if(dot(b,c)<-EPS)return +2;
  if(norm(b)<norm(c))return -2;
  return 0;
}
P crosspoint(const L &l, const L &m) {
  double A=cross(l.S-l.F,m.S-m.F);
  double B=cross(l.S-l.F,l.S-m.F);
  if(fabs(A)<EPS&&fabs(B)<EPS) return m.F;
  return m.F+B/A*(m.S-m.F);
}
 
vector<P> convex_cut(vector<P> ps,P p1,P p2) {
  vector<P> v;
  for(int i=0; i<ps.size(); i++) {
    P a=ps[i];
    P b=ps[(i+1)%ps.size()];
    if(ccw(p1,p2,a)!=-1) v.push_back(a);
    if(ccw(p1,p2,a)*ccw(p1,p2,b)==-1) v.push_back(crosspoint(L(p1,p2),L(a,b)));
  }
  return v;
}
 
int main() {
  int n;
  while(cin >> n && n) {
    P a[n];
    for(int i=0; i<n; i++) {
      double x,y;
      cin >> x >> y;
      a[i]=P(x,y);
    }
    vector<P> v;
    v.push_back(P(0,0));
    v.push_back(P(10000,0));
    v.push_back(P(10000,10000));
    v.push_back(P(0,10000));
    for(int i=0; i<n; i++) v=convex_cut(v,a[i],a[(i+1)%n]);
    cout << (v.size()?1:0) << endl;
  }
  return 0;
}


Measured memory_bytes: 3076