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

using namespace std;
using ll = long long;
using ld = long double;

const int mod = 1000000007;
//const int mod = 998244353;

//#define int long long
//signed main(){
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n;
    cin >> n;
    ll a[n];
    for(ll i = 0; i < n; i++) {
        cin >> a[i];
    }
    ll cnt[3][n+1];
    cnt[0][0]=0;
    cnt[1][0]=0;
    cnt[2][0]=0;

    for(ll i = 0; i < n; i++) {
        ll c=0;
        while(cnt[c][i]!=a[i]){
            c++;
	        if(c==3){
    	        cout << "0" << "\n";
        	    return 0;
            }
        }
        for(ll j = 0; j < 3; j++) cnt[j][i+1]=cnt[j][i];
        cnt[c][i+1]++;
    }

    for(ll i = 0; i < 3; i++) {
        for(ll j = 0; j < n; j++) {
            cerr << std::right << std::setw(2) << cnt[i][j];
        }
        cerr << "\n";
    }

    ll ans=1;
    for(ll i = 0; i < n; i++) {
        ll tmp=0;
        for(ll j = 0; j < 3; j++) if(a[i]==cnt[j][i]) tmp++;
        cerr << std::right << std::setw(2) << tmp;
        ans=(ans*tmp)%mod;
    }
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 6732
#include<bits/stdc++.h>
#define pb push_back
#define pf push_front
#define ppb pop_back
#define mp make_pair
#define re(i , n) for(Long i = 0; i < (Long)n ; i++)
#define rer(i, a, b) for (Long i = a, to = b; i < to; i++)
#define rll(x) Long x;cin>>x;
#define rll2(x,y) Long x,y;cin>>x>>y;
#define rll3(x,y,z) Long x,y,z;cin>>x>>y>>z;
#define rs(s) string s;cin>>s;
using namespace std;
 
typedef long long Long;
typedef pair<Long,Long> pll;
typedef pair<Long,pll> tll;
 
typedef vector<Long> vll;
typedef vector<pll> vpll;
typedef vector<tll> vtll;
typedef vector<string> vs;
typedef set<Long> si;
 
 
const long double PI = acos(-1);
const Long MX=2e5 + 6;
const Long MOD=1000000007;
const Long MX2=9223372036854775806;
Long present[MX];
 
int main(){
	rll2(n,k);
	vll v(n+1),a;
	rer(i,1,n+1){
		cin>>v[i];
	}
 
	
	present[1]=1;
	a.pb(1);
	Long x=v[1];
    while(present[x]!=1){
        a.pb(x);
        present[x]=1;
        x=v[x];
        
    }	
	
	Long l=0,r=0;
	re(i,a.size()){
	    
		if(a[i]!=x) l++;
		else break;
	}
	
	r=a.size()-l;
//	cout<<l<<" "<<r<<endl;
	if(k<l) cout<<a[k]<<endl;
	else cout<<a[l  +((k-l)%(r))]<<endl;
	
}

Measured memory_bytes: 8488
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int A,B,i,j,a[201][201];
int main(){
	scanf("%d%d",&A,&B);
	printf("100 100\n");
	for(i=1;i<=100;i++)a[i][50]=1,a[i][51]=0;
	A--;B--;
	for(i=2;i<=100;i+=2)
	 for(j=1;j<=50;j++)a[i][j]=1,a[i][j+50]=0;
	for(i=1;i<=100;i+=2){
		for(j=49;j>=1;j-=2){
			if(A)a[i][j]=0,A--;
			 else a[i][j]=1;
			a[i][j-1]=1;
		}
		for(j=52;j<=100;j+=2){
			if(B)a[i][j]=1,B--;
			 else a[i][j]=0;
			a[i][j+1]=0;
		}
	}
	for(i=1;i<=100;i++){
		for(j=1;j<=100;j++)if(a[i][j])printf("#");
		 else printf(".");
		puts("");
	}
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#define FOR(i, a, n) for(int (i) = (int)(a); (i) < (int)(n); ++(i))
#define FORe(i, a, n) for(int (i) = (int)(a); (i) <= (int)(n); ++(i))
#define rFOR(i, a, n) for(int (i) = (int)(n)-1; (i) >= (int)(a); --(i))
#define rFORe(i, a, n) for(int (i) = (int)(n); (i) >= (int)(a); --(i))
#define REP(i, n) FOR((i), 0, (n))
#define REPe(i, n) FORe((i), 1, (n))
#define REPo(i, n) FORe((i), 0, (n))
#define rREP(i, n) rFOR((i), 0, (n))
#define rREPe(i, n) rFORe((i), 1, (n))
#define rREPo(i, n) rFORe((i), 0, (n))
#define rep(i, n) FOR((i), 0, (n))
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define fi first
#define se second
#define dup(x, y) (((x)+(y)-1)/(y))
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
using ll = long long;
using P = pair<int,int>;
using T = tuple<int,int,int>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vs = vector<string>;
using vp = vector<P>;
using vt = vector<T>;

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

const ll INF = 1e18;
const int MX = 2005;
ll dp[MX][MX];

int main() {
  int n;
  cin >> n;
  vi a(n);
  REP(i, n) cin >> a[i];
  vp p;
  REP(i, n) p.emplace_back(a[i], i);
  sort(rall(p));
  REP(i, n) {
    int pi = p[i].second;
    REP(l, i+1) {
      int r = i-l;
      chmax(dp[i+1][l+1], dp[i][l]+ll(pi-l)*a[pi]);
      chmax(dp[i+1][l], dp[i][l]+ll(n-1-r-pi)*a[pi]);
    }
  }
  ll ans = 0;
  REPo(i, n) chmax(ans, dp[n][i]);
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 26284
package main

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

var sc = bufio.NewScanner(os.Stdin)

func scanInt() int {
	num, _ := strconv.Atoi(scanString())
	return num
}

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

func init() {
	sc.Split(bufio.ScanWords)
}

func binarySearch(truckLimit int, cargos []int) int {
	left := 1
	right := 1000000000
	for left <= right {
		mid := (left + right) / 2
		if isLoad(mid, truckLimit, cargos) {
			right = mid - 1
		} else {
			left = mid + 1
		}
	}
	return left
}

func isLoad(cargoLimit, truckLimit int, cargos []int) bool {
	total, count := 0, 1
	for _, cargo := range cargos {
		if cargo > cargoLimit {
			return false
		}
		if total+cargo > cargoLimit {
			count++
			total = cargo
			if count > truckLimit {
				return false

			}
		} else {
			total += cargo
		}
	}
	return count <= truckLimit
}

func main() {
	n := scanInt()
	k := scanInt()
	cargos := make([]int, n)
	for i := 0; i < n; i++ {
		cargos[i] = scanInt()
	}

	fmt.Println(binarySearch(k, cargos))
}



Measured memory_bytes: 2320
# 狭義単調増加部分列
import bisect
from collections import deque

n = int(input())
A = [int(input()) for _ in range(n)]
que = deque()

for i in range(n):
    if len(que) == 0:
        deque.appendleft(que, A[i])
    else:
        idx = bisect.bisect_left(que, A[i])
        if idx == 0:
            deque.appendleft(que, A[i])
        else:
            que[idx - 1] = A[i]

ans = len(que)
print(ans)


Measured memory_bytes: 8188
tmp = list(map(int, input().split()))
n = tmp[0]
l = tmp[1]

eaten = 'None'
if l >= 0:
  eaten = 0
elif (l+n-1) < 0:
  eaten = n-1

total = 0
for i in range(n):
  if i != eaten:
    total += l + i

print(total)

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

int main(){
    string s;
    cin>>s;
    int ss=s.size();
    int ans=0,i=0,flag;
    for(;i<ss;i++){
        for(int j=i;j<ss;j++){
            flag=1;
            for(int k=i;k<=j;k++){
                if(!(s[k]=='A'||s[k]=='C'||s[k]=='G'||s[k]=='T'))flag=0;
            }
            if(flag==1&&ans<j-i+1)ans=j-i+1;
        }
    }
    cout<< ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
#define imfor(i, n) for(int i = 0; i < n; i++)
using namespace std;
using ll = long long;

int main() {
    char s[210];
    cin >> s;
    for (int i = 1; i <= strlen(s) - 2; i++) {
        if ((strlen(s) - i) % 2 == 0) {
            int f = 1;
            for (int j = 0; j <= ((strlen(s) - i) / 2) - 1; j++) {
                if (s[j] != s[((strlen(s) - i) / 2) + j]) {
                    f = 0;
                }
            }
            if (f == 1) {
                cout << strlen(s) - i << endl;
                return 0;
            }
        }
    }
    cout << "error" << endl;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;
int main()
{
  int D;
  cin >> D;
  
  if(D == 25){
    cout << "Christmas" << endl;
  }
  if(D == 24){
    cout << "Christmas Eve" << endl;
  }
  if(D == 23){
    cout << "Christmas Eve Eve" << endl;
  }
  if(D == 22){
    cout << "Christmas Eve Eve Eve" << endl;
  }
  
  return 0;
}

Measured memory_bytes: 256
n,m=map(int,input().split())
if n%2019>=m%2019:
  print(0)
  exit()
ans=1145141919
for i in range(n,m+1):
  for j in range(n,i):
    ans=min(ans,(i*j)%2019)
    if ans==0:
      print(0)
      exit()
print(int(ans))


Measured memory_bytes: 2940
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>

using namespace std;

#define ll long long
#define ld long double
#define EPS 0.0000000001
#define INF 1e9
#define MOD 1000000007
#define rep(i,n) for(i=0;i<n;i++)
#define loop(i,a,n) for(i=a;i<n;i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)

typedef vector<int> vi;
typedef pair<int,int> pii;

int main(void) {
  int i,j;
  int n;
  cin>>n;
  vector<ll> a(n);
  vector<ll> b(n);
  rep(i,n)
    cin>>a[i]>>b[i];
  ll ans=0;
  for(i=n-1;i>=0;i--){
    a[i]+=ans;
    if(a[i]%b[i]==0)continue;
    ans+=b[i]-a[i]%b[i];
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 1792
#include "bits/stdc++.h"
using namespace std;

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

#define FOR(i, s, e) for (ll(i) = (s); (i) < (e); (i)++)
#define FORR(i, s, e) for (ll(i) = (s); (i) > (e); (i)--)
#define debug(x) cout << #x << ": " << x << endl
#define mp make_pair
#define pb push_back
const ll MOD = 1000000007;
const int INF = 1e9;
const ll LINF = 1e16;
const double PI = acos(-1.0);
int dx[8] = {0, 0, 1, -1, 1, 1, -1, -1};
int dy[8] = {1, -1, 0, 0, 1, -1, 1, -1};

/* -----  2017/04/15  Problem: ARC 013 A / Link: http://arc013.contest.atcoder.jp/tasks/arc013_a  ----- */
/* ------問題------



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



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


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

  ll N;
  ll ans = 0LL;
  ll a[100100];
  cin >> N;
  FOR(i, 0, N) {
	  cin >> a[i];
  }
  ans = 1;
  ll m = a[0];
  int flag=2;

  FOR(i, 0, N) {
	  if (flag == 2) {
		  if (m == a[i])continue;
		  else if (m < a[i])flag = true;
		  else flag = false;
	  }
	  if (flag == true) {
		  if (a[i] >= m) {
			  m = a[i];
			  continue;
		  }
		  else {
			  flag = 2;
			  m = a[i];
			  ans++;
		  }
	  }
	  else {
		  if (a[i] <= m) {
			  m = a[i];
			  continue;

		  }
		  else {
			  flag = 2;
			  m = a[i];
			  ans++;
		  }
	  }
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 1024
h,w = map(int,input().split())

hc = 0
a=[]
for _ in [0]*h:
  x = list(input())
  if "#" in x:
    a += [x]
    hc += 1

wc = 0
b=[]
for i in range(w):
  x = [a[k][i] for k in range(hc)]
  if "#" in x:
    b += [x]
    wc += 1

for i in range(hc):
  print("".join([b[k][i] for k in range(wc)]))


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

int main(){
    int h, w;
    cin >> h >> w;
    for(int i = 0; i < h; i++){
        for(int j = 0; j < w; j++){
            string name;
            cin >> name;
            if(name == "snuke"){
                char c = 'A' + j;
                cout << c << i + 1 << endl;
                return 0;
            }
        }
    }
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#define ll long long int
using namespace std;
int main()
{
	ll N, sum = 0;
	cin>>N;
	for(int i=1; i<=N; i++)
	{
		if(i%3==0 && i%5==0)
		{
			continue;
		}
		else if(i%3==0)
		{
			continue;
		}
		else if(i%5==0)
		{
			continue;
		}
		else
		{
			sum+=i;
		}
	}
	cout<<sum;
}

Measured memory_bytes: 3584
#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  bool aaaa = true;
  vector<int> ans(0);
  while(aaaa){
    if (N == 0){
      ans.push_back(0);
      break;
    }
    if (N%(-2)==-1){
      ans.push_back((N%(-2))*(-1));
      N = N/(-2) + 1;
    }else{
      ans.push_back(N%(-2));
      N /= -2;
    }
    if (N == 1){
      aaaa = false;
      ans.push_back(1);
    }
  }
  int M = ans.size();
  for (int i = 0; i < M; i++){
    cout << ans.at(M-1-i);
  }
  cout << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>

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

using namespace std;

int    nextInt()    { int d;      cin >> d;   return d;   }
string nextString() { string str; cin >> str; return str; }

int main() {
  while(true) {
    int N = nextInt();
    int Q = nextInt();
    if (N + Q == 0) break;
    
    int D[101] = {0};
    REP(i, N) {
      int M = nextInt();
      REP(j, M) {
        int d = nextInt();
        D[d]++;
      }
    }
    
    int max_d = -1;
    int max_idx;
    REP(i, 101) {
      if (D[i] > max_d) {
        max_d = D[i];
        max_idx = i;
      }
    }
    if (max_d < Q) {
      cout << 0 << endl;
    } else {
      cout << max_idx << endl;
    }
  }
  return 0;
}

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

int main(int argc, char *argv[]) { ios::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr);

  string s;

  cin>>s;

  if(s=="SUN")puts("7");
  else if (s== "MON")puts("6");
  else if (s== "TUE")puts("5");
  else if (s== "WED")puts("4");
  else if (s== "THU")puts("3");
  else if (s== "FRI")puts("2");
  else if (s== "SAT")puts("1");
  
  return 0;
}


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

#define REP(i, a, b) for (int i = int(a); i < int(b); i++)
#define dump(val) cerr << __LINE__ << ":\t" << #val << " = " << (val) << endl

using namespace std;

typedef long long int lli;

template<typename T>
vector<T> make_v(size_t a, T b) {
    return vector<T>(a, b);
}

template<typename... Ts>
auto make_v(size_t a, Ts... ts) {
    return vector<decltype(make_v(ts...))>(a, make_v(ts...));
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    string S;
    cin >> S;
    REP(i, 0, S.size()) {
        S[i] -= '0';
    }
    int ans = 1000000;
    REP(i, 0, S.size() - 2) {
        int n = S[i] * 100 + S[i + 1] * 10 + S[i + 2];
        ans = min(ans, abs(n - 753));
    }
    cout << ans << endl;
    return 0;
}


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

using namespace std;

typedef long long ll;

vector<pair<ll,ll>> v[100001];
ll N,Q,K;
ll L[100001];
queue<ll> q;
ll x[100001];
ll y[100001];

int main(){
    cin >> N;
    ll a,b,c;
    for(int i=0;i<N-1;i++){
        cin >> a >> b >> c;
        v[a].push_back(make_pair(b,c));
        v[b].push_back(make_pair(a,c));
    }
    cin >> Q >> K;
    for(int i=0;i<Q;i++) cin >> x[i] >> y[i];
    for(int i=0;i<=N;i++) L[i] = -1;
    L[K] = 0;
    q.push(K);
    while(!q.empty()){
        ll n = q.front();
        q.pop();
         for(int i=0;i<v[n].size();i++){
             ll m = v[n][i].first;
             ll s = v[n][i].second;
             if(L[m] != -1) continue;
             L[m] = L[n] + s;
             q.push(m);
         }
    }
    for(int i=0;i<Q;i++){
        cout << L[x[i]] + L[y[i]] << endl;
    }
    return 0;
}

Measured memory_bytes: 11520
#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> a(n);
  rep(i,n){
    cin>>a.at(i);
  }
  sort(a.begin(), a.end(), greater<int>());
    int ans = 0;
    rep(j,n){
        ans = ans + pow(-1, j) * a[j];
    }
    cout<<ans<<endl;
}

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

#pragma GCC optimize("O2,no-stack-protector,unroll-loops,fast-math")

#define F first
#define S second
#define pb push_back
#define SZ(x) (ll)(x.size())
#define all(x) x.begin(),x.end()
#define MP make_pair

typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> pll;

//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

const ll maxn=1e5+10, maxm=5e3+10, lg=18, mod=1e9+7, inf=1e18;

ll n,a[maxn<<1],ans,x,y;
multiset<ll> ss;

int main(){
	ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
	
	cin>>n;
	for(int i=0;i<n;i++) cin>>a[i]>>a[n+i], ss.insert(a[i]), ss.insert(a[n+i]), x+=a[i], y+=a[n+i];
	ans=min(x,y);
	while(SZ(ss)>n) ss.erase(--ss.end());
	ll A=*ss.rbegin(); ss.erase(--ss.end());
	ll B=*ss.rbegin(); ss.erase(--ss.end());
	ll xx=0; for(auto x:ss) xx+=x;
	//cout<<xx<<endl;
	for(int i=0;i<n;i++){
		ll xxx=xx+a[i]+a[n+i];
		if(ss.count(a[i])){
			xxx-=a[i], xxx+=B;
			if(ss.count(a[n+i])>=(1+(a[i]==a[n+i])) || B==a[n+i]) xxx-=a[n+i], xxx+=A;
		}
		else if(ss.count(a[n+i])) xxx-=a[n+i], xxx+=(B==a[i] ? A:B);
		ans=min(ans,xxx);
		//cout<<i<<' '<<xxx<<endl;
	}
	cout<<ans;

	return 0;
}






Measured memory_bytes: 14528
N = int(input())
D,X = map(int,input().split())
A = []
for i in range(N):
    a = int(input())
    A.append(a)

points = []
for i in A:
    if D%i == 0:
        point = D//i
    else:
        point = D//i + 1
    points.append(point)

print(sum(points)+X)

Measured memory_bytes: 3060
/**
*	created: 29.08.2020 20:57:26
**/
#include <bits/stdc++.h>
// #include <boost/multiprecision/cpp_int.hpp>
// using bint = boost::multiprecision::cpp_int;
using namespace std;
using ll = long long;
using P = pair<int,int>;
// #define endl '\n'
#define int long long
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define rep2(i,s,n) for (int i = (s); i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define pcnt(bit) __builtin_popcountll(bit)
const long double pi = acos(-1.0);
const int MAX = 1000010;
const int INF = 1ll << 60;
const int MOD = 1000000007;
// const int MOD = 998244353;
template<typename T> bool chmax(T &a, const T &b) {if (a < b) {a = b; return 1;} return 0;}
template<typename T> bool chmin(T &a, const T &b) {if (b < a) {a = b; return 1;} return 0;}
template<typename T> T pow(T a, ll n) {T r(1); while(n) {if (n & 1) r *= a; a *= a; n >>= 1;} return r;}
struct faster_io {faster_io() {cin.tie(0); ios_base::sync_with_stdio(false);}} faster_io_;

// ModInt
template <int mod> struct ModInt {
    int x;
    ModInt() : x(0) {}
    ModInt(long long x_) {if ((x = x_ % mod + mod) >= mod) x -= mod;}
    ModInt& operator+=(ModInt rhs) {if ((x += rhs.x) >= mod) x -= mod; return *this;}
    ModInt& operator-=(ModInt rhs) {if ((x -= rhs.x) < 0) x += mod; return *this;}
    ModInt& operator*=(ModInt rhs) {x = (unsigned long long)x * rhs.x % mod; return *this;}
    ModInt& operator/=(ModInt rhs) {x = (unsigned long long)x * rhs.inv().x % mod; return *this;}
    ModInt operator-() const {return -x < 0 ? mod - x : -x;}
    ModInt operator+(ModInt rhs) const {return ModInt(*this) += rhs;}
    ModInt operator-(ModInt rhs) const {return ModInt(*this) -= rhs;}
    ModInt operator*(ModInt rhs) const {return ModInt(*this) *= rhs;}
    ModInt operator/(ModInt rhs) const {return ModInt(*this) /= rhs;}
    bool operator==(ModInt rhs) const {return x == rhs.x;}
    bool operator!=(ModInt rhs) const {return x != rhs.x;}
    ModInt inv() const {return pow(*this, mod - 2);}
    friend ostream& operator<<(ostream& s, ModInt<mod> a) {s << a.x; return s;}
    friend istream& operator>>(istream& s, ModInt<mod>& a) {s >> a.x; return s;}
};

using mint = ModInt<MOD>;

signed main() {
    int n; cin >> n;
    vector<mint> a(n), b(n);
    rep(i,n) {
        cin >> a[i];
        b[i] = a[i];
    }
    reverse(all(b));
    rep2(i,1,n) b[i] += b[i-1];
    reverse(all(b));
    mint ans = 0;
    rep(i,n-1) ans += a[i]*b[i+1];
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 6344
using System;
using System.Collections.Generic;
class Program
{
	static void Main(string[] args)
	{
		int N = int.Parse(Console.ReadLine());
		long[]A = new long[N];
		string[] str = Console.ReadLine().Split();
		for(var i=0;i<N;i++){
			A[i] = long.Parse(str[i]);
		}
		long ans = 1;
		long mod = 1000000007;
		var listA = new List<long>[N];
		var dic = new Dictionary<long,long>();
		var dicA = new Dictionary<long,long>[N];
		for(var i=0;i<N;i++){
			listA[i] = new List<long>();
			dicA[i] = new Dictionary<long,long>();
		}
		if(N>=2){
			long B = 1;
			for(var i=0;i<N;i++){
				B = Lcm(A[i],B)%mod;
				listA[i] = PrimeFactors(A[i]);
				for(var j=0;j<listA[i].Count;j++){
					if(dicA[i].ContainsKey(listA[i][j])){
						dicA[i][listA[i][j]]++;
					} else {
						dicA[i][listA[i][j]] = 1;
					}
				}
				foreach(var j in dicA[i].Keys){
					if(dic.ContainsKey(j)){
						dic[j] = Math.Max(dic[j],dicA[i][j]);
					} else {
						dic[j] = dicA[i][j];
					}
				}
			}
			ans = 0;
			long L = 1;
			foreach(var j in dic.Keys){
				long d = dic[j];
				L = L * Mpow(j,d,mod) % mod;
			}
			for(var i=0;i<N;i++){
				ans = (ans + L * Mpow(A[i],mod-2,mod)) % mod;
			}
		}
		Console.WriteLine(ans);
	}

	public static long Gcd(long a, long b) {
		if (a < b)
			return Gcd(b, a);
		while (b != 0) {
			var r = a % b;
			a = b;
			b = r;
		}
		return a;
	}
	public static long Lcm(long a, long b) {
        return a * b / Gcd(a, b);
    }
	
	public static long Mpow(long x,long n,long m)
	{
		long ans = 1;
		while(n > 0){
			if(n % 2 == 1){
				ans = ans * x % m;
				n -= 1;
			}
			x = x * x % m;
			n /= 2;
		}
		return ans;
	}
	public static List<long> PrimeFactors(long n){
		long i = 2;
		long tmp = n;
		var list = new List<long>();
		while(i*i<=n){
			if(tmp%i==0){
				tmp /= i;
				list.Add(i);
			} else {
				i++;
			}
		}
		if(tmp != 1){
			list.Add(tmp);
		}
		return list;
	}
}

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

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;

#define fi first
#define se second
#define repl(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define rep(i,n) repl(i,0,n)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt __builtin_popcountll

#define INF 1e16
#define mod 1000000007

int N,M;
vector<int> g[20];
int p[20];

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

  cin>>N>>M;
  rep(i,M){
    int k;
    cin>>k;
    rep(j,k){
      int s;
      cin>>s;
      s--;
      g[s].push_back(i);
    }
  }
  rep(i,M)cin>>p[i];

  int res=0;
  rep(S,1<<N){
    vector<int> as(M,0);
    rep(i,N){
      if((S>>i)&1){
        for(int j : g[i]){
          as[j]^=1;
        }
      }
    }
    bool ok=true;
    rep(j,M){
      if(as[j]!=p[j])ok=false;
    }
    if(ok)res++;
  }
  cout<<res<<endl;

  return 0;
}


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

#define REP(i,n) for(int i=0; i < (n); ++i)
#define REPR(i,n) for(int i=(n); i >= 0; --i)
#define FOR(i, m, n) for(int i = (m); i < (n); ++i)

using ll = long long;
#define INF 1e9

int main(){
  int A1, A2, A3;
  cin >> A1 >> A2 >> A3;
  if(A1+A2+A3 >= 22){
    cout << "bust" << endl;
  }
  else{
    cout << "win" << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int i,j,ans,sum,temp,diff,len;
    vector<int>v;
    double num=0,flag;
    string str;
    getline(cin,str);
    len=str.length();
    for(i=0;i<len-2;i++)
    {
        num=((str[i]-'0')*pow(10,2)+(str[i+1]-'0')*pow(10,1)+(str[i+2]-'0')*pow(10,0));
        v.push_back(abs(num-753));
    }
    sort(v.begin(),v.end());
    cout<<v[0]<<endl;
}


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

long long MOD = 5;

long long extGCD(long long a, long long b, long long *px, long long *py){
    if(b == 0){
        *px = 1;
        *py = 0;
        return a;
    }
    long long d = extGCD(b, a%b, py, px);
    *py -= a/b * (*px);
    return d;
}

long long modinv(long long a, long long mod){
    long long x, y;
    extGCD(a, mod, &x, &y);
    x %= mod;
    if(x < 0) x += mod;
    return x;
}

int main(){
    //input
    long long N,X;
    cin >> N >> X;

    //output
    long long x, y;
    cout << 3*(N/extGCD(N,X,&x,&y)-1)*extGCD(N,X,&x,&y) << endl;
    system("pause");
    return 0;
}

Measured memory_bytes: 3692
#include <bits/stdc++.h>
  
using namespace std;
  
template<class T> void ckmin(T &a, T b) { a = min(a, b); }
template<class T> void ckmax(T &a, T b) { a = max(a, b); }
  
#define pb push_back
#define mp make_pair
#define cotu cout
#define itn int
#define Red ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define F first
#define S second
#define sz(x) (int)x.size()
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for(int i = 0; i < n; ++i)
#define repr(i,n) for(int i = n - 1; i >= 0; --i)
#define Rep(i, a, n) for(int i = (a); i <=(n); ++i)
#define repst(i, n) for(auto it = n.begin(); it != n.end(); ++it)
#define Repr(i, a, n) for(int i = (n); i >= (a); --i)
#define setp(x) fixed << setprecision(x)
#define ordered_set tree<int , null_type,less<int >, rb_tree_tag,tree_order_statistics_node_update> 
  
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
  
typedef long long ll;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;
  
const int inf = int(1e9);
const int mod = inf + 7;
const int N = 3e5 + 555; // TL MB
const double PI = acos(-1.0);
void mul(ll &x, ll y){
	x *= y;
	if(x >= mod) x %= mod;
}
 
void add(ll &x, ll y){
	x += y;
	if(x >= mod) x -= mod;
	if(x < 0) x += mod;
}
ll bp(ll a, ll n){
	ll r = 1;
	while(n){
		if(n & 1) mul(r, a);
		mul(a, a);
		n >>= 1;
	}
	return r; 
}


void solve()
{
	string s;
	cin >> s;
	int res = 0;
	rep(i, sz(s)) res += s[i] - '0', res %= 9;
	if(!res) cout << "Yes";
	else cout << "No";
}




int main()
{
	// freopen("input.txt", "r", stdin);
	// freopen("output.txt", "w", stdout);
    // Red;
  	int T = 1;
  	// cin >> T;
  	for(int i = 1; i <= T; ++i){
  		solve();
  	}
  	return 0;

}

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

void solve(int n, string s){
    string temp ="No";

    int k = n  / 2;
    if(n % 2 == 0  && s.substr(0, k) == s.substr(k, k)) temp = "Yes";
    cout << temp << endl;
    return;
}

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

    solve(n, s);
}

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

using namespace std;

#define int long long int
#define ld long double
#define F first
#define S second
#define P pair<int,int>
#define pb push_back

const int N = 100005;

const int mod = 1e9 + 7;
const int sz = 51;

struct Mat
{
	int m[sz][sz];
	Mat() {
		memset(m, 0, sizeof m);
	}

	void eye() {
		for (int i = 0; i < sz; i++)
			m[i][i] = 1;
	}

	Mat operator* (const Mat &a) const {
		Mat r;
		for (int i = 0; i < sz; i++)
			for (int j = 0; j < sz; j++)
				for (int k = 0; k < sz; k++)
					r.m[i][j] = (r.m[i][j] + m[i][k] * 1ll * a.m[k][j]) % mod;
		return r;
	}
};

void solve() {
	int i, j, k, n, m, ans = 0, cnt = 0, sum = 0;
	cin >> n >> k;
	Mat a;
	for (i = 0; i < n; i++) {
		for (j = 0; j < n; j++) {
			cin >> a.m[i][j];
		}
	}
	Mat r;
	r.eye();
	while (k) {
		if (k & 1)
			r = r * a;
		a = a * a;
		k >>= 1;
	}
	for (i = 0; i < n; i++) {
		for (j = 0; j < n; j++) {
			// cout << r.m[i][j] << " ";
			ans += r.m[i][j];
			ans %= mod;
		}
		// cout << '\n';
	}
	cout << ans;
	return ;
}

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

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

using namespace std;

int main()
{
    vector<vector<int>> groups{{1, 3, 5, 7, 8, 10, 12}, {4, 6, 9, 11}, {2}};
    int x, y; cin >> x >> y;
    bool ok = false;
    

    for (int i = 0; i < 3; i++) {
        if (find(groups[i].begin(), groups[i].end(), x) != groups[i].end() && find(groups[i].begin(), groups[i].end(), y) != groups[i].end()) {
            ok = true;
            break;
        }
    }

    cout << (ok ? "Yes" : "No") << endl;

    return 0;
}

Measured memory_bytes: 504
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define ff first
#define ss second
#define pb push_back
#define ios                           \
    std::ios::sync_with_stdio(false); \
    cin.tie(NULL);                    \
    cout.tie(NULL);
#define fill(x, v) memset(x, v, sizeof(x))
const ll mod = 1000000007;
const double pi = 3.14159265359; // PI
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char *name, Arg1 &&arg1)
{
    cerr << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char *names, Arg1 &&arg1, Args &&... args)
{
    const char *comma = strchr(names + 1, ',');
    cerr.write(names, comma - names) << " : " << arg1 << " | ";
    __f(comma + 1, args...);
}
/*
std::cout << std::setprecision(9) << f << '\n';//3.141590000;
map<char,int>::reverse_iterator rit;
for(rit = mp.rbegin(); rit!=mp.rend(); rit++)
*/
int power(int x, unsigned int y, int p)
{
    int res = 1;

    x = x % p;

    while (y > 0)
    {
        if (y & 1)
            res = (res * x) % p;

        y = y >> 1;
        x = (x * x) % p;
    }
    return res;
}
// string parser
vector<int> parse(string s)
{
    stringstream ss(s);
    int x;
    vector<int> v;
    while (ss >> x)
    {
        v.pb(x);
    }
    return v;
}
//-----------------------------
ll q, n, m, mx = 0;
vector<ll> arr;
vector<pair<pair<ll, ll>, pair<ll, ll>>> ab;
void fun(int i, int pre)
{
    if (i == n)
    {
        ll sum = 0;
        for (int j = 0; j < q; j++)
        {
            if (arr[ab[j].ff.ss - 1] - arr[ab[j].ff.ff - 1] == ab[j].ss.ff)
                sum += ab[j].ss.ss;
        }
        mx = max(sum, mx);
        return;
    }
    for (int j = pre; j <= m; j++)
    {
        arr[i] = j;
        fun(i + 1, j);
    }
}
int main()
{
    ios;
    cin >> n >> m >> q;
    ab.resize(q);
    arr.resize(n);
    for (int i = 0; i < q; i++)
    {
        cin >> ab[i].ff.ff >> ab[i].ff.ss >> ab[i].ss.ff >> ab[i].ss.ss;
    }
    fun(0, 1);
    cout << mx << endl;
}


Measured memory_bytes: 3676
import java.util.*;

public class Main {
    public static void main(String[] args){
    
    Scanner sc = new Scanner(System.in);
    int A = sc.nextInt();
    int B = sc.nextInt();
    int C = sc.nextInt();
    int D = sc.nextInt();
    
    int e = A*B;
    int f = C*D;
    
    if(e>=f){
    System.out.println(e);
    }else{
    System.out.println(f);    
    }
    }
}


Measured memory_bytes: 35832
#include <algorithm>
#include <cmath>
#include <cstdint>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define rep(i, n) for(int(i) = 0; (i) < (n); (i)++)
#define FOR(i, m, n) for(int(i) = (m); (i) < (n); (i)++)
#define All(v) (v).begin(), (v).end()
#define pb push_back
#define MP(a, b) make_pair((a), (b))
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
const int INF = 1 << 30;
const ll LINF = 1LL << 60;
const int MOD = 1e9 + 7;

int main() {
    int N, K;
    cin >> N >> K;
    vector<int> hist(N);
    rep(i, N) {
        int a;
        cin >> a;
        a--;
        hist[a]++;
    }
    sort(All(hist));
    reverse(All(hist));
    int res = N;
    rep(i, K) { res -= hist[i]; }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define all(x) (x).begin(),(x).end()
#define REP(i,N) for(int i=0;i<N;i++)
int main(){
    int n; cin>>n;
    vector<int> v(n);
    REP(i,n){
        cin>>v[i];
    }
    REP(i,n){
        int c;cin>>c;
        v[i]-=c;
    }
    sort(all(v));
    int ans=0;
    for(auto c:v){
        if(c>0){ ans+=c; }
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.LinkedList;
import java.util.ListIterator;
import java.util.Scanner;

public class Main {
	
	public static int MAX = 10000000;
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		boolean[] is_prime = new boolean[MAX+1];
		Arrays.fill(is_prime, true);
		is_prime[0] = is_prime[1] = false;
		
		for(int i = 0; i <= MAX; i++){
			if(is_prime[i]){
				for(int j = i * 2; j <= MAX; j += i){
					is_prime[j] = false;
				}
			}
		}
		
		while (true) {
			
			final int n = sc.nextInt();
			
			if(n == 0){
				break;
			}
			
			for(int i = n; i >= 13; i--){
				if(is_prime[i] && is_prime[i-2] && is_prime[i-6] && is_prime[i-8]){
					System.out.println(i);
					break;
				}
			}
		}
	}

}

Measured memory_bytes: 34540
/*
If you want to aim high, aim high
Don't let that studying and grades consume you
Just live life young
******************************
What do you think? What do you think?
1st on Billboard, what do you think of it
Next is a Grammy, what do you think of it
However you think, I’m sorry, but shit, I have no fcking interest
*******************************
I'm standing on top of my Monopoly board
That means I'm on top of my game and it don't stop
til my hip don't hop anymore
https://www.a2oj.com/Ladder16.html
*******************************
Shining through the city with a little funk and soul
*******************************
300iq as writer = Sad!
*/
import java.util.*;
import java.io.*;
import java.math.*;

   public class Main
   {
      public static void main(String hi[]) throws Exception
      {
         BufferedReader infile = new BufferedReader(new InputStreamReader(System.in));
         StringTokenizer st = new StringTokenizer(infile.readLine());
         int N = Integer.parseInt(st.nextToken());
         System.out.println(N^1);
      }
   }

Measured memory_bytes: 32548
#include <iostream>
#include <algorithm>
#include <limits>
#include <vector>
#include <map>
#include <cmath>
#include <limits>
#include <iomanip>
#include <queue>
#include <string.h>
#include <bitset>

#define ll long long int
#define ld long double
#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 << endl
#define cosp(x) cout << x << " "
#define all(x) x.begin(),x.end()
#define allr(x) x.begin(),x.end(),greater<int>()
#define P pair<ll,ll>
#define pb push_back
#define mp make_pair
#define MOD 1000000007
#define INF 1ll << 60
#define PI 3.14159265359

using namespace std;

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

Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <cctype>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <functional>

using namespace std;
using ll = long long int;
#define rep(i,n) for(int i = 0; i < n; i++)
#define FOR(i, a, b)  for(int i = (a); i < (b) ; i++)

#define pb push_back
#define SORT(v,n) sort(v, v+n)
#define ALL(x) (x).begin(),(x).end()
#define debug(x) cerr << #x << ": " << x << '\n'
#define elif else if
#define itn ll
#define int ll
const int INF = 100100100;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;
///                →,↑,←,↓,↗,↖,↙,↘
int dx[8] = { 1, 0, -1, 0, 1, -1, -1, 1 };
int dy[8] = { 0, 1, 0, -1, 1, 1, -1, -1 };


signed main() {
	ios::sync_with_stdio(false);
	string s;
	cin >> s;
	bool isf = true;
	int first = 0, end = 0;;
	for (int i = 0; i < s.size(); i++) {
		if (s[i] == 'A' && isf) {
			first = i;
			isf = false;
		}
		if (s[i] == 'Z') {
			end = i;
		}
	}
	cout << end - first + 1<< endl;
	return 0;
}

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

int N,A,B;

int h(int x){
  int wa=0;
  int tmp=x;
  while(x){
    wa+=x%10;
    x/=10;
  }
  if(wa>=A&&wa<=B) return tmp;
  else return 0;
}

int main(){
  cin>>N>>A>>B;
  int sum=0;
  for(int i=1;i<=N;i++){
    sum+=h(i);
  }
  cout<<sum<<endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, j, n) for (ll i = j; i < n; i++)
#define all(x) (x).begin(),(x).end()
#define INF (1000000000)
#define MOD (1000000007)
#define MAX (100000)
#define pii pair<int, int>

/////////////////////////////////////////////////////////

class XY{
public:
  ll x, y;
  XY() {x = y = 0;}
  XY(ll u, ll v) {x = u; y = v;}
};

template<typename T1, typename T2>
void chmin(T1 &a, T2 b) {if(a > b) a = b;}
template<typename T1, typename T2>
void chmax(T1 &a, T2 b) {if(a < b) a = b;}

template<typename T1, typename T2>
ll mypow(T1 a, T2 n){
  if(n == 0) return 1;
  if(n == 1) return a;
  if(n % 2) return a * mypow(a, n - 1);
  ll tmp = mypow(a, n / 2);
  return tmp * tmp;
}

template<typename T>
int BS(vector<T> V, int left, int right, T key){
  int mid = (left + right) / 2;
  if(V[mid] <= key) left = mid;
  else right = mid;
  if(right - mid == 1) return left;
  else return BS(V, left, right, key);
}

ll comb(ll n, ll r){
	ll res = 1;
  rep(i, 0, r){
    res *= n - i;
    res /= i + 1;
  }
  return res;
}

/////////////////////////////////////////////////////////

void Main() {
  string X; cin >> X;
  int cnt = 0;
  int res = 0;
  rep(i, 0, X.size()){
    if(X[i] == 'S') cnt++;
    else{
      if(cnt > 0) cnt--;
      else res++;
    }
  }
  res += cnt;
  cout << res << endl;
}

/////////////////////////////////////////////////////////

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

  Main();
}


Measured memory_bytes: 720
#include <iostream>
#include <vector>
#include <cmath>

using namespace std;
using ll = long long;


int main(){
    ll n;
    cin >> n;
    if(n==1){
        cout << 0 << endl;
        return 0;
    }

    vector<pair<ll,ll>> prime_factor;
    // vector<ll> factor_dimensition;

    // factorization
    for(ll i=2; i*i<=n; i++){
        // if(is_prime(i) && n%i==0){
        //     prime_factor.push_back(i);
        //     factor_dimensition.push_back(1);
        //     n /= i;
        //     while(n%i==0){
        //         n /= i;
        //         factor_dimensition[cur]++;
        //     }
        //     cur++;
        // }
        if(n%i==0){
            ll count = 0;
            while(n%i==0){
                n /= i;
                count++;
            }
            prime_factor.emplace_back(i,count);
            // factor_dimensition.push_back(count);
        }
    }
    if(n!=1){
        prime_factor.push_back({n,1});
        // factor_dimensition.push_back(1);
    }
    

    ll ans = 0;
    // count operation possible for each prime factor
    for(ll i=0; i<prime_factor.size(); i++){
        ll count = 1;
        while((count+2)*(count+1)/2 <= prime_factor[i].second){
            count++;
        }
        ans += count;
    }
    
    cout << ans << endl;

    return 0;
}

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


int main()
{
	int A, B;

	cin >> A >> B;

	if(A > B)
	{
		cout << 2 * A - 1 << '\n';
	}
	else if(A < B)
	{
		cout << 2 * B - 1 << '\n';
	}
	else
	{
		cout << 2 * A << '\n';
	}

	return 0;
}

Measured memory_bytes: 256
/* Volume0 0003 Is it a Right Triangle? */
import java.util.Scanner;

class Main{
	public static void main(String[] args){

		int n, temp;
		Scanner stdIn = new Scanner(System.in);
		n = stdIn.nextInt();
		int[][] side = new int[n][3];

		for( int i = 0; i < n; i++) {
			for( int j = 0; j < 3; j++) {
				side[i][j] = stdIn.nextInt();
			}
			if ( side[i][0] < side[i][1] ){
				temp = side[i][0] ;
				side[i][0] = side[i][1];
				side[i][1] = temp;
			}
			if ( side[i][0] < side[i][2] ){
				temp = side[i][0] ;
				side[i][0] = side[i][2];
				side[i][2] = temp;
			}
		}

		for( int i = 0; i < n; i++) {
			if ( side[i][0]*side[i][0] == side[i][1]*side[i][1] + side[i][2]*side[i][2] ){
				System.out.println("YES");
			} else {
				System.out.println("NO");
			}
		}

	}
}

Measured memory_bytes: 36224
#include<bits/stdc++.h>
using namespace std;
#define fastio() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long
#define ull unsigned long long
#define vi vector<int>
#define pi pair<int, int>
#define F first
#define S second
#define PB push_back
#define EPB emplace_back
#define MP make_pair
#define deb(x) cerr << #x << ":" << x << endl;
#define deba(x) cerr << #x << endl; for (auto a : x) cerr << a << " "; cerr << endl;
const int MOD = 1e9 + 7;
const double EPS = 0.01;

int main() {
	fastio();
	int d, t, s;
	cin >> d >> t >> s;
	if ((double(d) / s) <= t) {
		cout << "Yes" << '\n';
	} else {
		cout << "No" << '\n';
	}

	return 0;
}


Measured memory_bytes: 3644
import java.util.Scanner;

public class Main {

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

		int input_count = sc.nextInt();

		int[] array = new int[input_count];

		int array_count = 0;
		int pre_num = 0;

		for(int i = 0;i < array.length;i++){
			int num = sc.nextInt();

			if(pre_num == num){
				continue;
			}

			pre_num = num;
			array[array_count] = num;
			array_count++;
		}


		int i_is_up = 0;

		int line_count = 1;

		for(int i = 0;i < array_count - 1;i++){
			int sign = Integer.signum(array[i + 1] - array[i]);

			if(i_is_up == 0){
				i_is_up = sign;
				continue;
			}

			if(i_is_up != sign){
				line_count++;
				i_is_up = 0;
			}
		}

		System.out.println(line_count);

		sc.close();
	}

}


Measured memory_bytes: 50692
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define TT pair<long long, long long>
#define ordered_set tree<TT, null_type, less<TT>, rb_tree_tag, tree_order_statistics_node_update>
#define fo(i,n)   for(i=0;i<n;i++)
#define mem(a,i) memset(a,i,sizeof(a))
#define pb push_back
#define mp make_pair
#define For(m) for(auto it = m.begin();it!=m.end();it++)
#define fi first
#define se second
typedef long long ll;
typedef long double mytype;
vector<ll> v[200005];
map<ll,ll> visi;
ll dp[200005]={};
ll res=0;
ll dfs(ll x){
    ll i,sum=0;
    if(visi[x]==1){
        return dp[x];
    }
    visi[x]=1;
    fo(i,v[x].size()){
        sum=max(sum,dfs(v[x][i]) + 1);
    }
    dp[x]=sum;
    res=max(res,dp[x]);
    return dp[x];
}
int main(){
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    //priority_queue <int, vector<int>, greater<int> > pq;
    //cout << fixed << setprecision(9) <<ans<<endl;
    //ordered_set os;//os.order_of_key();//os.find_by_order();
    ll l,r,count,n,m,sum=0,ans=0,i,j,k,tt,t,x,y,z,c,a[200005]={},b[200005]={};
    string ss;
    set<ll> s;
    map<ll,ll> ma;
    cin>>n>>m;
    fo(i,m){
        cin>>x>>y;
        v[x].pb(y);
    }
    for(i=1;i<=n;i++){
        if(visi[i]==0)
        dfs(i);
    }
    cout<<res<<endl;
}

Measured memory_bytes: 18560
use std::io::*;
use std::str::*;

fn read<T: FromStr>() -> Option<T> {
    let stdin = stdin();
    let s = stdin
        .bytes()
        .map(|c| c.unwrap() as char)
        .take_while(|c| !c.is_whitespace())
        .collect::<String>();
    s.parse::<T>().ok()
}

fn main() {
    let n: usize = read().unwrap();
    let mut audiences = 0;
    for _ in 0..(n) {
        let l: i32 = read().unwrap();
        let r: i32 = read().unwrap();
        audiences += r - l + 1;
    }
    println!("{}", audiences);
}


Measured memory_bytes: 4352
rvrsd_S = input()[::-1]
words = ['dream', 'dreamer', 'erase', 'eraser']
rvrsd_words = [i[::-1] for i in words]
a = 0
sw = True
while sw == True:
    sw = False
    for i in rvrsd_words:
        if rvrsd_S[a:a+len(i)] == i:
            a += len(i)
            sw = True
    if a >= len(rvrsd_S):
        print('YES')
        exit()
print('NO')

Measured memory_bytes: 3188
p="0123456789543210"
for i in range(input()):
	sp,ep=raw_input().split()
	(sp,ep)=(p.find(sp),p.find(ep)+1) if sp<ep else (p.rfind(sp),p.rfind(ep)+1)
	print " ".join(p[sp:ep]) if sp<ep else " ".join(p[sp:]+p[1:ep])

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

int main(void) {
	char str[21];
	int i;
	
	scanf("%s",str);
	
	for(i=strlen(str);i>0;i--){
		printf("%c",str[i-1]);
	}
	printf("\n");
	
	return 0;
}

Measured memory_bytes: 524
#include <stdio.h>
#include <ctype.h>
int main(){    
int count[26]={0};    
char ch;    
int i, num;    
while(scanf("%c", &ch)!=EOF){        
if(islower(ch)){            
num=ch-'a';        }
else if(isupper(ch)){            
num=ch-'A';        }
else{            
continue;        }        
count[num]++;    }    
for(i=0;i<26;i++){        
printf("%c : %d\n", 'a'+i, count[i]);    }    
return 0;
}


Measured memory_bytes: 2108
import string
c = {}
while True:
    try:
        for x in raw_input().lower():
            if not x.isalpha():
                continue
            c[x] = c.get(x, 0) + 1
    except EOFError, e:
        break

for x in string.ascii_lowercase:
    print("%s : %d" % (x, c.get(x, 0)))

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

int main() {
    int N, Y;
    cin >> N >> Y;
    int res10000 = -1, res5000 = -1, res1000 = -1;
    for (int a = 0; a <= N; ++a) {  // 10000円の枚数を 0 〜 N で調べる
        for (int b = 0; b + a <= N; ++b) {  // 5000円の枚数を 0 〜 N-a で調べる
            int c = N - a - b;  // 1000円の枚数は決まる
            int total = 10000*a + 5000*b + 1000*c;
            if (total == Y) {  // 答えが見つかったら
                res10000 = a;
                res5000 = b;
                res1000 = c;
            }
        }
    }

    // 答えを出力 (見つかっていなくても -1 -1 -1 になるので OK です)
    cout << res10000 << " " << res5000 << " " << res1000 << endl;
}

Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Random;
import java.util.Scanner;
public class Main {
	static Scanner sc = new Scanner(System.in);static void p(int i) {System.out.println(i);}static void p(long i) {System.out.println(i);}static void p(String i) {System.out.println(i);}static void p(double i) {System.out.println(i);}
	
	
	public static void main(String[] args) {
		int N=sc.nextInt();
		
		int h[]=new int[N];
		
		for(int i=0;i<N;i++) {
			h[i]=sc.nextInt();
		}
		
		int ans=0;
		
		for(int i=1;i<=100;i++) {
			
			for(int a=0;a<N;a++) {
				
				if(h[a]>=i) {
					while(h[a]>=i) {
						a++;
						if(a==N) {
							break;
						}
					}
					ans++;
					
				}
				
				
				
				
			}
			
			
		}
		p(ans);
	}
	
}
	


Measured memory_bytes: 23764
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD = 1e9 + 7;
const int inf = 1e9;
const ll INF = 1e18;
const double pi = 3.14159265358979323846;
#define rep(i,n) for(int i=0;i<n;i++)

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

	int dp[n+1][2];
	rep(i,n+1) rep(j,2) dp[i][j]=0;
	rep(i,2) dp[0][i]=1;

	for(int i=0;i<=n;i++){
		if(i>=4) dp[i][0]+=dp[i-4][0];
		if(i>=7) dp[i][1]+=dp[i-7][1];
		dp[i][1]=max(dp[i][0],dp[i][1]); 
	}
/*
	rep(i,n+1){
		rep(j,2) cout<<dp[i][j]<<",";
		cout<<"\n";
	}
*/
	if(dp[n][1]) cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#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 Would
#define you
#define please


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


	char C;
	cin >> C;

	if (C == 'A') co('T');
	if (C == 'T') co('A');
	if (C == 'G') co('C');
	if (C == 'C') co('G');

	Would you please return 0;
}


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

int main(){
    int a, b, c;
    cin >> a >> b >> c;
    int type=3;
    if(a==b){
        type--;
    }
    if(a==c){
        type--;
    }
    if(b==c){
        type--;
    }
    if(type==0){
        type=1;
    }
    cout << type << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <iomanip>
#include <numeric>
#include <queue>
#include <cmath>
using namespace std;


int main() {
    long long int a, b, c;
    cin >> a >> b >> c;
    cout << b + min(c, 1 + a + b) << endl;
}




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

int main() {
	int n;
	cin >> n;
	cout << n * 800 - n/15 * 200 << endl;
	
	return 0;
}

Measured memory_bytes: 256