akhauriyash/Code-Regression huggingface dataset:
import java.io.IOException;
import java.text.NumberFormat;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) throws IOException {
		Scanner scan = new Scanner(System.in);
		while (true) {
			int N = scan.nextInt();
			if (N == 0) {
				scan.close();
				break;
			}

			int T = scan.nextInt();
			int L = scan.nextInt();
			int B = scan.nextInt();

			double[][] dp = new double[T + 1][N + 1];// iターン目にjにいる確率
			boolean[] lose = new boolean[N + 1];
			boolean[] back = new boolean[N + 1];

			for (int i = 0; i < L; i++) {
				int l = scan.nextInt();
				lose[l] = true;
			}

			for (int i = 0; i < B; i++) {
				int l = scan.nextInt();
				back[l] = true;
			}

			dp[0][0] = 1;
			for (int turn = 0; turn < T; turn++) {
				for (int n = 0; n < N; n++) {
					for (int dice = 1; dice <= 6; dice++) {
						int end = n + dice;
						if (end > N) {
							end = 2 * N - end;
						}
						if (lose[end]) {
							// 移動先がLの時
							if (turn + 2 <= T) {
								dp[turn + 2][end] += dp[turn][n] / 6;
							} else {
								dp[turn + 1][end] += dp[turn][n] / 6;
							}
						} else if (back[end]) {
							// 移動先がBの時
							dp[turn + 1][0] += dp[turn][n] / 6;
						} else {
							dp[turn + 1][end] += dp[turn][n] / 6;
						}
					}
				}
			}

			double ans = 0;
			for (int i = 0; i < dp.length; i++) {
				ans += dp[i][N];
			}
			NumberFormat format = NumberFormat.getInstance();
			format.setMaximumFractionDigits(6);
			System.out.println(format.format(ans));
		}

	}
}

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

int main() {
	int n, k;
	//string s;
	cin >> n >> k ;
	//for (i = 0; i < n; i++)
	//{
	//	if (s[i] != s[k - 1]) s[i] = '*';
	//}
	cout << n+1-k << endl;
}

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

int main()
{
  ll n;
  cin >> n;
  vector<double> d(n);
  for (ll i = 0; i < n; i++)
  {
    cin >> d[i];
  }
  double tmp = 0;
  for (ll i = 0; i < n; i++)
  {
    tmp += 1/d[i];
  }
  printf("%.16f",1/tmp);
  return 0;
}

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

using namespace std;
using ll = long long;

ll modpow(ll a, ll n, int mod) {
    ll res = 1;
    while (n > 0) {
        if (n & 1) {
            res *= a;
            res %= mod;
        }
        a *= a;
        a %= mod;

        n >>= 1;
    }
    return res;
}

ll gcd (ll a, ll b) {
    if (a%b) return b;
    else return(gcd(b, a%b));
}

ll lcm(ll a, ll b) {
    return a * b / gcd(a, b);
}

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

    ll c = n / (a + b);
    ll d = n % (a + b);

    ll ans = c * a + min((ll)a, d);

    cout << ans << endl;

    return 0;

}

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

/* メモリ食い過ぎ注意 */
#define int long long

typedef long long ll;

/* define const */
const ll INF = (1ll << 60);
const ll MOD = (ll)1e9 + 7;
/* end defineing */

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

    bool f = false;
    for (int i = 0; 4 * i <= n; i++)
    {
        for (int j = 0; 7 * j <= n; j++)
        {
            if (4 * i + 7 * j == n)
                f = true;
        }
    }

    if (f)
        cout << "Yes" << endl;
    else
    {
        cout << "No" << endl;
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define endl '\n'
#define pii pair<ll,ll>
using namespace std;
#define N 100007
#define pb push_back;
vector<ll> g[N];
#define FAST ios_base::sync_with_stdio(false); cin.tie(NULL);

int main()
{
    ll n;
    cin>>n;
    ll sm=0;
    ll mn=LLONG_MAX;
    ll x;
    ll i;
    vector<ll> v;
    for(i=0;i<n;i++)
    {
        cin>>x;
        v.push_back(x);
    }
    sort(v.begin(),v.end());
    reverse(v.begin(),v.end());
    ll cnt=2;
    sm=v[0];
    i=1;
    while(cnt<n)
    {
        sm+=v[i];
        cnt++;
        if(cnt<n)
        {
            sm+=v[i];
            cnt++;
        }
        i++;
    }
    cout<<sm;
}

Measured memory_bytes: 7688
s=list(input())
t=list(input())

import sys
dic_s={}
dic_t={}

for i in range(len(s)):
  a=dic_s.get(s[i],t[i])
  b=dic_t.get(t[i],s[i])
  if a!=t[i] or b!=s[i]:
    print("No")
    sys.exit()
  dic_s[s[i]]=t[i]
  dic_t[t[i]]=s[i]
print("Yes")



Measured memory_bytes: 90868
from bisect import bisect_left as bl
while True:
    n = input()
    if n == 0:
        break
    d = map(lambda (x,y):x-y, [map(int, raw_input().split()) for _ in xrange(12)])
    print (range(1,13)+["NA"])[bl([sum(d[:i+1]) for i in xrange(12)], n)]

Measured memory_bytes: 4308
n = int(input())
arr = [list(map(int, input().split())) for _ in range(n-1)]
for i in range(n):
    t = 0  # 初期条件
    for j in range(i, n-1):
        ci, si, fi = arr[j]  # 各駅の条件を代入
        if t <= si:  # まだ始発が出発していないとき
            t = si
        else:  # すでに出発している時
            t = ((t + fi - 1)//fi) * fi
        t += ci  # 電車に乗っている時間
    print(t)

Measured memory_bytes: 3188
#include <stdio.h>
#include <string.h>
#include <stdlib.h>


int desc(const void *a, const void *b) {
  return *(int *)b - *(int *)a;
}
//qsort(buf, sizeof(buf) / sizeof(*buf), sizeof(*buf), desc);
int main(){
  char s[10],t[10];
  int a,b;
  char u[10];
  scanf("%s %s",s,t);
  scanf("%d %d",&a,&b);
  scanf("%s",u);
  if(strcmp(s,u)==0){
    a--;
  }else{
    b--;
  }
  printf("%d %d",a,b);
  return 0;
}


Measured memory_bytes: 128
#include <algorithm>
#include <array>
#include <bitset>
#include <complex>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <queue>

using namespace std;

struct Initializer {
  Initializer() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout << fixed << setprecision(15);
  }
} initializer;

int main() {
  int64_t x, y;
  cin >> x >> y;
  cout << (x % y ? x : -1) << endl;
}



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

using pii = pair<int, int>; using vpii = vector<pii>;
using vi = vector<int>; using vvi = vector<vi>;
using ll = long long;
using pll = pair<ll, ll>; using vpll = vector<pll>;
using vll = vector<long long>; using vvll = vector<vll>;
template <class T> using min_queue = priority_queue<T, vector<T>, greater<T>>;
template <class T> istream &operator>>(istream &, vector<T> &);
template <class T> ostream &operator<<(ostream &, const vector<T> &);
template <class T, class U> istream &operator>>(istream &, pair<T, U> &);
template <class T, class U> ostream &operator<<(ostream &, const pair<T, U> &);
template <class T> struct Inf { static constexpr T inf() { return std::numeric_limits<T>::has_infinity ? std::numeric_limits<T>::infinity() : std::numeric_limits<T>::max(); } };
template <> struct Inf<int> { static constexpr int inf() { return 0x3f3f3f3f; } };
template <> struct Inf<long long> { static constexpr long long inf() { return 0x3f3f3f3f3f3f3f3fLL; } };
constexpr int INF = Inf<int>::inf(); constexpr ll BINF = Inf<ll>::inf();
// mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
// }}}
// Preprocessing & "Global" variables {{{
struct Solver {
	Solver() {}
	int solve();
};
// }}}

int Solver::solve() {
	int n; cin >> n;
	vi a(n); cin >> a;
	sort(a.rbegin(), a.rend());
	vi b;
	for (int i = 0; i < n; i++) {
		b.push_back(a[i]);
		if (i > 0) b.push_back(a[i]);
	}
	ll ans = accumulate(b.begin(), b.begin() + n - 1, 0LL);
	cout << ans << endl;
	return 0;
}

// Template Main {{{
int main() {
	ios::sync_with_stdio(0); cin.tie(0);
	Solver solver;
	#ifdef JUDGE_MULTI_CASE
		int t; cin >> t; for (int i = 1; i <= t; i++)
	#endif
	solver.solve();
	// cout << "Case #" << i << ": ", solve();
	return 0;
}

template <class T> istream &operator>>(istream &is, vector<T> &v) {
	for (auto it=v.begin();it!=v.end();++it) is >> *it;
	return is;
}

template <class T> ostream &operator<<(ostream &os, const vector<T> &v) {
	for (auto it=v.begin();it!=v.end();) os << *it, os << " \n"[++it==v.end()];
	return os;
}

template <class T, class U> istream &operator>>(istream &is, pair<T, U> &p) {
	return is >> p.first >> p.second;
}

template <class T, class U> ostream &operator<<(ostream &os, const pair<T, U> &p) {
	return os << p.first << ' ' << p.second;
}
// }}}

// vim: fdm=marker


Measured memory_bytes: 6096
#include<bits/stdc++.h>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) for(int i = 0; i < (b); i++)
#define all(a) (a).begin(), (a).end()
#define show(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
const int INF = 2000000000;
using namespace std;

const int MAX_V = 210; //MAX_X + MAX_Y
const int MAX_X = 105;
const int MAX_Y = 105;

class Edge{
    public:
        int to, cap, rev;
};

typedef vector<vector<Edge>> AdjList;
AdjList G(MAX_V);
bool used[MAX_V];

void addEdge(int from, int to, int cap){
    G[from].emplace_back(Edge{to, cap, static_cast<int>(G[to].size())});
    G[to].emplace_back(Edge{from, 0, static_cast<int>(G[from].size() - 1)});
}

int dfs(int v, int t, int f){
    if(v == t) return f;
    used[v] = true;
    rep(i,G[v].size()){
        Edge &e = G[v][i];
        if(not used[e.to] && e.cap > 0){
            int d = dfs(e.to, t, min(f, e.cap));
            if(d > 0){
                e.cap -= d;
                G[e.to][e.rev].cap += d;
                return d;
            }
        }
    }
    return 0;
}

int maxFlow(int s, int t){
    int flow = 0;
    while(true){
        memset(used, 0, sizeof(used));
        int f = dfs(s, t, INF);
        if(f == 0) return flow;
        flow += f;
    }
}

int bipartiteMatching(int x, int y, bool edge[MAX_X][MAX_Y]){
    int s = x + y, t = s + 1; //set x : 0 ~ x-1, set y : x ~ x+y-1

    rep(i,x) addEdge(s, i, 1); //s??¨??????x????????¶
    rep(i,y) addEdge(x + i, t, 1); //??????y??¨t????????¶

    rep(i,x) rep(j,y) if(edge[i][j]) addEdge(i, x + j, 1); //??????x??¨??????y????????¶

    return maxFlow(s, t);
}

int main(){
    int x, y, e;
    cin >> x >> y >> e;

    bool edge[MAX_X][MAX_Y] = {0};
    rep(i,e){
        int a, b;
        cin >> a >> b;
        edge[a][b] = 1;
    }
    cout << bipartiteMatching(x, y, edge) << endl;
}

Measured memory_bytes: 3312
#include <bits/stdc++.h>
#include <iostream>
#include <queue>
#include <stack>
#include <vector>
#include <string>
#include <set>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define repp(i,n,m) for (int i = m; i < (n); ++i)
#define repl(i,n) for (long long i = 0; i < (n); ++i)
#define reppl(i,n,m) for (int i = m; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;
using PL = pair<long long, long long>;
const int INF = 1001001007;
const int MOD = 1000000007;
template <typename T>
void printvec(vector<T> &ar){
    rep(i,ar.size()-1) cout << ar[i] << " ";
    cout << ar[ar.size()-1] << endl;
}
template <typename Q>
void printvvec(vector<vector<Q>> &ar){
    rep(i,ar.size()){
        rep(j,ar[0].size()-1) cout << ar[i][j] << " ";
        cout << ar[i][ar[0].size()-1] << endl;
    }
}
template <typename S>
bool range(S a, S b, S x){
    return (a <= x && x < b);
}

int main(){
    int n; cin >> n;
    int m; cin >> m;
    ll a = 0;
    ll b;
    rep(i,m){
        cin >> b;
        a += b;
    }
    if (n - a >= 0) cout << n-a;
    else cout << -1 << endl;
}

Measured memory_bytes: 3596
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <map>
using namespace std;

typedef long long ll;
typedef vector<int> vi;

int N; vi A; map<int,int> M;
void input()
{
    cin>>N;
    for(int i=0;i<N;++i){
        int a; cin>>a; A.emplace_back(a);
    }
}

void solve()
{
    ll ans=0;
    for(auto i:A){
        ans+=(ll)M[i]++;
    } 
    
    // for(auto m:M) ans+=m.second*(m.second-1)/2;
    for(int i=0;i<N;++i){
        cout<<ans-(ll)(M[A[i]]-1)<<endl;
    }
}

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

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

int main() {
int A,B;
  cin >>A>>B;
  if(A==B){
    cout <<"Draw";
  }
  else if(A==1){
    cout <<"Alice";
  }
  else if(B==1){
    cout <<"Bob";
  }
  else if(A<B){
    cout <<"Bob";
  }
  else{
    cout <<"Alice";
  }

}
  

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

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

    int g[n][n];
    rep(i, n) rep(j, n) g[i][j] = -1;
    rep(i, n) {
        int a;
        cin >> a;
        rep(j, a) {
            int x, y;
            cin >> x >> y;
            g[i][x - 1] = y;
        }
    }

    int ans = 0;
    rep(bit, 1 << n) {
        int d[n] = {0};
        rep(i, n) if (bit & (1 << i)) d[i] = 1;

        bool ok = true;
        rep(i, n) if (d[i]) {
            rep(j, n) {
                if (g[i][j] == -1) continue;
                if (g[i][j] != d[j]) ok = false;
            }
        }
        if (ok) ans = max(ans, __builtin_popcount(bit));
    }

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


Measured memory_bytes: 256
#include <bits/stdc++.h>
#pragma GCC optimize("O3")

#define fi first
#define se second
#define vi vector<int>
#define vpi vector<pair<int,int>>
#define vll vector<ll>
#define vpll vector<pair<ll,ll>>
#define endl '\n'

#define si(v) int((v).size())
#define all(v) (v).begin(), (v).end()
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i) 
#define rep2(i, n, m) for (ll i = n; i <= (ll)(m); ++i)
#define rep3(i, n, m) for (ll i = n; i >= (ll)(m); --i)

template<class T, class U> void chmax(T &a, U b) { if (a < b) a = b; }
template<class T, class U> void chmin(T &a, U b) { if (a > b) a = b; }

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

constexpr ll MOD = 1000000007;

signed main()
{
  cout << fixed << setprecision(20);
  ios::sync_with_stdio(false);
  cin.tie(0);

  int k; cin >> k;

  int odd = (k + 1) / 2;
  int even = k / 2;

  cout << odd * even << endl;

  return (0);
}


Measured memory_bytes: 3656
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
#include <iomanip>
#include <stack>
#include <queue>
#include <numeric>
#include <map>
#include <unordered_map>
#include <set>
#include <fstream>
#include <chrono>
#include <random>
#include <bitset>
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define sz(x) ((int)(x).size())
#define pb push_back
using ll = long long;
using namespace std;
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; }
ll gcd(ll a, ll b) {return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) {return a/gcd(a,b)*b;}

const ll mod = 998244353;

int main(){
  ll N, K; cin >> N >> K;
  vector<pair<ll,ll>> LR(K);
  rep(i,K) {
    cin >> LR[i].first >> LR[i].second;
    LR[i].second++;
  }
  sort(all(LR));
  vector<ll> cus(N+10,0);
  vector<ll> dp(N+10,0);
  dp[1] = 1;
  cus[1] = 1;
  for(ll i=2;i<=N;i++){
    rep(j,K){
      int li = max(0LL,i-LR[j].second);
      int ri = max(0LL,i-LR[j].first);
      dp[i] += cus[ri]-cus[li];
      while(dp[i]<0) dp[i]+=mod;
      dp[i] %= mod;
    }
    cus[i] = cus[i-1]+dp[i];
    cus[i]%=mod;
  }

  cout << dp[N]%mod << endl;
  return 0;
}


Measured memory_bytes: 6404
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cctype>
#include <ctime>
#include <climits>
#include <cfloat>
#include <cstdint>
#include <cstddef>
#include <cinttypes>
#include <memory>
#include <iostream>
#include <sstream>
#include <iomanip>
#include <vector>
#include <array>
#include <valarray>
#include <string>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <stack>
#include <bitset>
#include <queue>
#include <complex>
#include <tuple>
#include <utility>
#include <functional>
#include <algorithm>
#include <numeric>

using namespace std;

const double EPS = 1e-10;
const int64_t INF = 1e9;

int main()
{
	char S[10000];
	scanf("%s", S);
	int l = strlen(S);
	if (S[l-1] == 's') {
		printf("%ses\n", S);
	} else {
		printf("%ss\n", S);
	}
	return 0;
}


Measured memory_bytes: 3240
using namespace std;
#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#define rep(i, n) for (int i=0; i<n; i++)
string s;
int n,k;

int main() {
  cin >> n >> s >> k;
  char c = s[k-1];
  rep(i, n) {
    char t = s[i]==c?c:'*';
    cout << t;
  }
  cout << endl;
  return 0;
}

Measured memory_bytes: 3568
#include <iostream>
#include <queue>
#include <map>
#include <algorithm>
using namespace std;

typedef pair<int, int> P;
typedef map<string, P> IM;
const int NMAX = 100;
int N, M;
int depends[NMAX][NMAX];
int origCosts[NMAX];
int target;
int counts[NMAX];
int costs[NMAX];
string names[NMAX];

bool input() {
  IM items;

  cin >> N;
  if (!N) {
    return false;
  }
  for (int i = 0; i < N; ++i) {
    string name;
    int cost;
    cin >> name;
    cin >> cost;
    items.insert(IM::value_type(name, P(i, cost)));
    names[i] = name;
    origCosts[i] = cost;
  }
  for (int i = 0; i < N; ++i) {
    for (int j = 0; j < N; ++j) {
      depends[i][j] = 0;
    }
  }
  cin >> M;
  for (int i = 0; i < M; ++i) {
    string s1;
    int num;
    cin >> s1 >> num;
    int a = items[s1].first;
    for (int j = 0; j < num; ++j) {
      string s2;
      cin >> s2;
      int b = items[s2].first;
      ++depends[a][b];
    }
  }

  string st;
  cin >> st;
  target = items[st].first;
  return true;
}

int solve() {
  for (int i = 0; i < N; ++i) {
    counts[i] = 0;
  }
  for (int i = 0; i < N; ++i) {
    for (int j = 0; j < N; ++j) {
      if (depends[i][j]) {
        ++counts[i];
      }
    }
  }

  queue<int> q;
  while (1) {
    for (int i = 0; i < N; ++i) {
      if (!counts[i]) {
        q.push(i);
      }
    }
    if (q.empty()) {
      break;
    }
    while (!q.empty()) {
      int x = q.front();
      q.pop();
      int y = 0;
      bool assembled = false;
      for (int i = 0; i < N; ++i) {
        if (depends[x][i]) {
          y += depends[x][i] * costs[i];
          assembled = true;
        }
      }
      if (!assembled) {
        costs[x] = origCosts[x];
      } else {
        costs[x] = min(origCosts[x], y);
      }
      --counts[x];
      for (int i = 0; i < N; ++i) {
        if (depends[i][x]) {
          --counts[i];
        }
      }
    }
  }

  return costs[target];
}

int main() {
  while (input()) {
    cout << solve() << endl;
  }
}

Measured memory_bytes: 3160
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <map>
#include <queue>
#include <functional>
#include <vector>
#include <stack>
#include <set>
#include <bitset>
using namespace std;
typedef  long long ll;
const int maxn=1e6+50;
const int inf=0x3f3f3f3f;
const int MOD=1e9+7;
const int HASH=131;

int main()
{
    string s,ss;
    cin>>s>>ss;
    int len=s.size();
    int ans=0;
    for(int i=0;i<len;i++)
    {
        if(s[i]!=ss[i]) ans++;
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 3888
#include  <iostream>
#include  <stdio.h>
#include <algorithm>
using namespace std;

/*
#include <math.h>
int standerd = int(pow(10.0,9.0)) + 7;
*/
string ans_Yes = "Yes"; 
string ans_No = "No"; 
string ans_yes = "yes"; 
string ans_no = "no"; 
 
int main(){

    int N;
    cin >> N;

    long long A[N];
    int minus_count=0;
    long long min=100000000000;
    long long sum=0;
    for( int ni = 0 ; ni < N ; ni++ ){
        cin >> A[ni];
        if(A[ni]<0)   minus_count++;
        A[ni] = abs(A[ni]);
        if(A[ni]<min) min = A[ni];
        sum += A[ni];
    }

    if(minus_count % 2 == 1) sum = sum - min * 2;

    cout << sum;    

}

Measured memory_bytes: 1024
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<map>
#include<algorithm>
using namespace std;
map<int,int> num;
int a[101010],b[101010];
int rt[101010];
bool mk[101010];
int getr(int x)
{
	if(x==rt[x])
		return x;
	rt[x]=getr(rt[x]);
	return rt[x];
}
int main()
{
	int n,cnt=0,ans=0,an,bn;
	scanf("%d",&n);
	n++;
	a[n]=b[n]=0;
	num.clear();
	for(int i=1;i<n;i++)
	{
		scanf("%d",&a[i]);
		a[n]^=a[i];
		if(!num.count(a[i]))
			num[a[i]]=++cnt;
	}
	if(!num.count(a[n]))
		num[a[n]]=++cnt;
	for(int i=0;i<=cnt;i++)
		rt[i]=i;
	for(int i=1;i<n;i++)
	{
		scanf("%d",&b[i]);
		b[n]^=b[i];
	}
	memset(mk,0,sizeof(mk));
	for(int i=1;i<n;i++)
		if(a[i]!=b[i])
		{
			ans++;
			an=num[a[i]];
			bn=num[b[i]];
			mk[an]=mk[bn]=true;
			rt[getr(an)]=getr(bn);
		}
	if(mk[num[a[n]]])
		ans--;
	sort(a+1,a+1+n);
	sort(b+1,b+1+n);
	for(int i=1;i<=n;i++)
		if(a[i]!=b[i])
		{
			printf("-1");
			return 0;
		}
	for(int i=1;i<=cnt;i++)
		if(mk[i]&&rt[i]==i)
			ans++;
	printf("%d",ans);
	return 0;
}

Measured memory_bytes: 7808
#include <iostream>
#include <tuple>
#include <set>

using namespace std;

int main(int argc, char *argv[])
{
	int Q;
	multiset<long long> l, r;
	std::tuple<int, long long, long long> q[200001];

	cin >> Q;
	for (int i = 0; i < Q; i++) {
		int c;
		long long a, b;
		cin >> c;
		if (c == 1) {
			cin >> a >> b;
			q[i] = make_tuple(c, a, b);
		} else {
			q[i] = make_tuple(c, 0, 0);
		}
	}
	long long sum_b = 0;
	long long min = 0;
	long long x = 0;
	for (int i = 0; i < Q; i++) {
		int c = get<0>(q[i]);
		long long a = get<1>(q[i]);
		long long b = get<2>(q[i]);
		if (c == 1) {
			if (l.size() > 0) {
				auto litr = l.end();
				litr--;
				auto ritr = r.begin();
				if (*litr <= a && a <= *ritr) {
					x = a;
				}
				if (a < *litr) {
					min += abs(a - *litr);
				}
				if (*ritr < a) {
					min += abs(a - *ritr);
				}
			}

			l.insert(a);
			r.insert(a);
			auto litr = l.end();
			litr--;
			auto ritr = r.begin();
			if (*litr > *ritr) {
				l.erase(litr);
				r.erase(ritr);
				l.insert(*ritr);
				r.insert(*litr);
			}
			litr = l.end();
			litr--;
			ritr = r.begin();
			x = *litr;
			sum_b += b;
		} else {
			printf("%lld %lld\n", x, min + sum_b);
		}
	}

	return 0;
}

Measured memory_bytes: 23680
from collections import deque
N,M=map(int,input().split())
C=[[] for i in range(N+1)]
for i in range(M):
  A,B=sorted(list(map(int,input().split())))
  C[A].append(B)
  C[B].append(A)

d=[-1]*(N+1)
d[0]=0
d[1]=0

queue=deque([1])
while queue:
  now = queue.popleft()
  for i in C[now]:
    if d[i]!=-1:continue
    d[i]=now
    queue.append(i)

if d.count(0)>2:print('No');exit
print('Yes')
for i in range(2,N+1):
  print(d[i])

Measured memory_bytes: 33984
#include <cstdio>
#define _USE_MATH_DEFINES
#include <cmath>
#include <algorithm>
using namespace std;

const double EPS = 1e-8;

int main() {
  for(int tci = 0; ; tci++) {
    double result[2];
    for(int ii = 0; ii < 2; ii++) {
      int m; scanf("%d", &m); if(m==0) goto done;
      int rdegree = 360;
      double area = 0.0;
      for(int i = 1; i < m; i++) {
        int d; scanf("%d", &d);
        area += sin(M_PI*d/180);
        rdegree -= d;
      }
      area += sin(M_PI*rdegree/180);
      result[ii] = area;
    }
    if(result[0]-result[1]>EPS)
      printf("1\n");
    else if(result[1]-result[0]>EPS)
      printf("2\n");
    else
      printf("0\n");
  }
done:
  return 0;
}

Measured memory_bytes: 1048
import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int canEatDays = scanner.nextInt();
        int beforeExpirationDays = scanner.nextInt();
        int ateAfterBoughtDays = scanner.nextInt();
        int canBeSafeDays = beforeExpirationDays + canEatDays;

        if(ateAfterBoughtDays > canBeSafeDays) {
            System.out.println("dangerous");
        } else {
            if(beforeExpirationDays >= ateAfterBoughtDays) {
                System.out.println("delicious");
            } else {
                System.out.println("safe");
            }
        }
    }
}


Measured memory_bytes: 21844
#include <bits/stdc++.h>
// debug
#define d(x) cerr << #x ":" << x << endl;
#define dd(x, y) cerr << "(" #x "," #y "):(" << x << "," << y << ")" << endl;
#define ddd(x, y, z) cerr << "(" #x "," #y "," #z "):(" << x << "," << y << "," << z << ")" << endl;
#define dump(v)              \
  cerr << #v ":[ ";          \
  for (auto macro_vi : v)    \
  {                          \
    cerr << macro_vi << " "; \
  }                          \
  cerr << "]" << endl;
#define ddump(v)                     \
  cerr << #v ":" << endl;            \
  for (auto macro_row : v)           \
  {                                  \
    cerr << "[";                     \
    for (auto macro__vi : macro_row) \
    {                                \
      cerr << macro__vi << " ";      \
    }                                \
    cerr << "]" << endl;             \
  }
#define damp(m)                                                   \
  for (auto macro_pair : m)                                       \
  {                                                               \
    cerr << macro_pair.first << ":" << macro_pair.second << endl; \
  }
#define dpair(p) cerr << #p ":" \
                      << "(" << p.first << "," << p.second << ")" << endl;
// iterate
#define rep(i, n) for (int i = (int)(0); i < (int)(n); i++)
#define all(v) v.begin(), v.end()
#define itr(macro_v, i) macro_v.begin() + i
// etc
#define chmin(mi, val) mi = min(mi, val);
#define chmax(ma, val) ma = max(ma, val);
using ll = long long;

using namespace std;

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  string s;
  cin >> n >> s;
  if (n % 2 != 0)
  {
    cout << "No" << endl;
  }
  else
  {

    if (s.substr(0, n / 2) == s.substr(n / 2, n / 2))
    {
      cout << "Yes" << endl;
    }
    else
    {
      cout << "No" << endl;
    }
  }
  return 0;
}

Measured memory_bytes: 256
/*
** Author: MAC45
*/

#include <bits/stdc++.h>
using namespace std;
#define ll long long int
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    //freopen("input.txt", "rt", stdin);
    //freopen("output.txt","wt",stdout);
    ll N, tc = 0;
    cin >> N;
    N = N % 10;
    if (N == 3)
        cout << "bon" << endl;
    else if (N == 0 || N == 1 || N == 6 || N == 8)
        cout << "pon" << endl;
    else
        cout << "hon" << endl;
    return 0;
}


Measured memory_bytes: 3664
a, v = map(int, input().split())
b, w = map(int, input().split())
t = int(input())
if a < b and (a + v * t >= b + w * t):
    print('YES')
elif a > b and (a - v * t <= b - w * t):
    print('YES')
else:
    print('NO')

Measured memory_bytes: 9188
//g++ -std=gnu++14 a.cpp

#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <iostream>
#include <istream>
#include <iterator>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#include <tuple>
#include <iomanip>
#include <random>
#include <math.h>
#include <stdio.h>

using namespace std;

#define ll long long
#define rep(i, n) for(ll i = 0; i < (n); i++)
ll MOD = 1e9 + 7;
int INF = 1 << 30;
ll INFL = 1LL << 60;

ll MODP = 998244353;


int main(){
  ll N;
  cin >> N;
  string S;
  cin >> S;
  if(N < 3){
    cout << 0 << endl;
    return 0;
  }
  vector<ll> cnt(3,0);
  rep(i,S.size()){
    if(S.at(i) == 'R')cnt[0]++;
    if(S.at(i) == 'G')cnt[1]++;
    if(S.at(i) == 'B')cnt[2]++;
  }
  ll all = cnt[0]*cnt[1]*cnt[2];

  for(int i = 2;i <= N-1;i += 2){
    for(int j = 0;j <= S.size()-1-i;j++){
      if(S.at(j) != S.at(j+i/2) && S.at(j) != S.at(j+i) && S.at(j+i/2) != S.at(j+i))all--;
    }
  }

  cout << all <<  endl;



  return 0;
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
const string ln = "\n";
constexpr int INF = 1001001001;
constexpr int MOD = 1000000007;

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

  int n, k;
  cin >> n >> k;

  vector<int> ans;
  while (n > 0) {
    int a = n % k;
    ans.push_back(a);
    n /= k;
  }

  cout << ans.size() << ln;

  return 0;
}

Measured memory_bytes: 256
import numpy as np
H, W, M = map(int, input().split())

C = [0] * W
R = [0] * H
S = set()
for _ in range(M):
    h, w = map(int, input().split())
    h, w = h - 1, w - 1  # 0-indexed
    C[w] += 1
    R[h] += 1
    S.add((h, w))

col_max = max(C)
col_idx = [i for i in range(W) if C[i] == col_max]
row_max = max(R)
row_idx = [i for i in range(H) if R[i] == row_max]

ans = col_max + row_max
for r in row_idx:
    for c in col_idx:
        if not (r, c) in S:
            print(ans)
            exit()
print(ans - 1)


Measured memory_bytes: 101328
#include <bits/stdc++.h>
using namespace std;
using lint = long long int;
#define FOR(i, begin, end) for(int i=(begin),i##_end_=(end);i<i##_end_;i++)
#define IFOR(i, begin, end) for(int i=(end)-1,i##_begin_=(begin);i>=i##_begin_;i--)
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
#define ALL(a)  (a).begin(),(a).end()
constexpr int MOD = 1000000007;
constexpr int INF = 2147483647;
void yes(bool expr) {
  cout << (expr ? "Yes" : "No") << "\n";
}
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    lint A;
    cin >> A;
    string B;
    cin >> B;
    string C = "";
    REP(i, B.size()) if(B[i] != '.') C += B[i];
    int D = stoi(C);
    lint E = A*D/100;
    cout << E << endl;
}

Measured memory_bytes: 3644
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>

using namespace std;

#define FOR(i,a,b) for(long long i=(a);i<(b);i++)
#define REP(i,N) for(long long i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define fi first
#define se second

#define PI acos(-1.0)
#define INF 1000000007
#define EPS 1e-10

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<double, double> PD;
typedef pair<string, ll> PS;
typedef vector<ll> V;
typedef pair<P, char> PC;

int n;
int is_prime[10000010];
int prime[10000000];
int prime4[10000000];
vector<int> vi;

int main(){
	int p = 0;
	fill(is_prime, is_prime + 10000010, 1);
	is_prime[0] = is_prime[1] = 0;
	for (int i = 2; i <= 10000000; i++){
		if (is_prime[i]){
			prime[p++] = i;
			for (int j = 2 * i; j <= 10000000; j += i){
				is_prime[j] = 0;
			}
		}
	}
	int q = 0;
	for (int i = 3; i <= p; i++){
		if (prime[i] == 0)break;
		if (prime[i - 3] + 8 == prime[i] && prime[i - 3] + 6 == prime[i - 1]
			&& prime[i - 3] + 2 == prime[i - 2]){
			prime4[q++] = prime[i];
		}
	}

	while (cin >> n&&n){
		REP(i, q){
			if (prime4[i] > n){
				cout << prime4[i - 1] << endl;
				break;
			}
			if (i == q - 1){
				cout << prime4[i] << endl;
			}
		}
	}
}

Measured memory_bytes: 44628
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int,int>;


int main(){

string S;
cin >> S;
int Q;
cin >> Q;
int counter=0;
deque<char> deq;
for(int i=0;i<S.size();i++){
    deq.emplace_back(S.at(i))
;}

for(int i=0;i<Q;i++){
    int T;
    cin>>T;
    if(T==1){counter++;}
    if(T==2){
        int F; char C;
        cin>>F>>C;
        if((counter+F)%2==0){
            deq.emplace_back(C);
        }
        if((counter+F)%2==1){
            deq.emplace_front(C);
        }
    }
;}
int Size=deq.size();
if(counter%2==0){
    for(int i=0;i<Size;i++){
        cout<<deq.front();
        deq.pop_front();
    ;}
}
if(counter%2==1){
    for(int i=0;i<Size;i++){
        cout<<deq.back();
        deq.pop_back();
    ;}
}

return 0;

}  



Measured memory_bytes: 896
#include <bits/stdc++.h>
using namespace std;
//#include <atcoder/all>
//using namespace atcoder;
using ll=long long;
using Graph=vector<vector<int>>;
using pp=pair<ll,pair<ll,ll>>;
#define MAX 1000000
#define MOD 1000000007
#define INF 1000000000000000000

int main(){
  int x;
  cin>>x;
  cout<<1-x<<endl;
}


Measured memory_bytes: 3588
#include <iostream>
#include <vector>
#include <math.h>
#include <string>
#include <algorithm>

using namespace std;

const int MAX = 1e5;
bool prime[MAX + 1] = { true, true, false, };

void eratos() {
	for (int i = 2; i*i <= MAX; i++) {
		if (!prime[i]) {
			for (int j = 2 * i; j <= MAX; j += i)
				prime[j] = true;
		}
	}
}

int main() {
	eratos();
	int data[MAX + 2] = { 0, };
	// 1 2 3
	// 0 1 3 6
	for (int i = 1; i <= MAX+1; i++) {
		data[i] += data[i - 1];
		if (!prime[i] && !prime[(i + 1) / 2])
			data[i] += 1;
	}
	int tc;
	cin >> tc;
	while (tc--) {
		int l, r;
		int ans = 0;
		scanf("%d %d", &l, &r);
		printf("%d\n", data[r] - data[l - 1]);
	}
}

Measured memory_bytes: 1152
#include<bits/stdc++.h>
using namespace std;
const int N=10010;
const int mod=1e9+7;
typedef long long ll;
int n,ans;
int a[N];
int cnt,head[N];
struct Edge{
	int to,next;
}e[N<<1];
void ade(int u,int v){e[++cnt]=(Edge){v,head[u]},head[u]=cnt;}
int bk[N],f[N];
void dfs(int x,int ff){
	for(int t=n;t>=1;t--)
		if(!bk[t]){
			bk[t]=1;
			f[x]=a[t];
			break;
		}
	for(int i=head[x];i;i=e[i].next){
		int to=e[i].to;
		if(to==ff)continue;
		dfs(to,x);
	}
}
int main(){
	scanf("%d",&n);
	for(int i=1;i<n;i++){
		int u,v;scanf("%d%d",&u,&v);
		ade(u,v);ade(v,u);
	}
	for(int i=1;i<=n;i++)scanf("%d",&a[i]),ans+=a[i];
	sort(a+1,a+n+1);ans-=a[n];
	dfs(1,0);
	printf("%d\n",ans);
	for(int i=1;i<=n;i++)printf("%d ",f[i]);
	return 0;
}
/*
4 50 50 0
*/

Measured memory_bytes: 896
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <cctype>
#define len length()
#define sz size()
#define rng(i, a, b) for(int i = a; i < b; i++)
#define rep(i, n) rng(i, 0, n)
#define srt(v) sort(v.begin(), v.end())
#define rev(s) reverse(s.begin(), s.end())
#define vi(a, n) vector<int> a(n)
#define vs(a, n) vector<string> a(n)
#define vc(a, n) vector<char> a(n)
#define psb(a) push_back(a)
#define ppb pop_back()
#define erc(S, i) S.erase(S.begin() + i)
#define ers(S, i, j) S.erase(S.begin() + i, S.begin() + j)
#define sp(n) cout << setprecision(n) << fixed
#define fst(s) s.at(0)
#define lst(s) s.at(s.len - 1)
using namespace std;

int main(){
    int N, M;
    cin >> N >> M;
    vs(A,N);
    vs(B,M);
    rep(i,N) cin >> A[i];
    rep(i,M) cin >> B[i];
    rep(i, N - M + 1){
        rep(j, N - M + 1){
            int c=0;
            rep(k, M){
                rep(l, M){
                    if(A[i+k].at(j+l)==B[k].at(l)) c++;
                }
            }
            if(c==M*M){
                cout << "Yes" << endl;
                return 0;
            }
        }
    }
    cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
#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 int 		long long
#define vi 			vector<int>
#define vec(x) 		vector<x>
#define matrix 		vector<vector<int>>
#define pii 		pair<int,int>
#define rep(i,s,e)  for(int i=s;i<e;i++)
#define rrep(i,e,s) for(int i=e;i>=s;i--)
#define MOD			1000000007
#define pb 			push_back
#define ff 			first
#define ss 			second		
#define w(x)		int x; cin>>x; while(x--)

#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
	cerr << name << " : " << arg1 << std::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...);
}
#else
#define trace(...)
#endif
 
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;
// find_by_order(k-1)  returns iterator to kth element starting from 0; Returns the kth smallest element
// order_of_key(k) returns count of elements strictly smaller than k;Returns the number of elements less than k
// erase,insert same as normal set

const int mxn=1e5+13;
const int INF=1e18;
int n;
int a[mxn],b[mxn],c[mxn];
int dp[mxn][4];

int func(int idx,int prev){
	if(idx==n) return 0;

	if(dp[idx][prev]!=-1) return dp[idx][prev];

	int ans=-INF;
	if(prev==0){
		ans=max({a[idx]+func(idx+1,1),b[idx]+func(idx+1,2),c[idx]+func(idx+1,3)});
	}
	if(prev==1){
		ans=max({ans,b[idx]+func(idx+1,2),c[idx]+func(idx+1,3)});
	}
	else if(prev==2){
		ans=max({ans,a[idx]+func(idx+1,1),c[idx]+func(idx+1,3)});
	}
	else if(prev==3){
		ans=max({ans,a[idx]+func(idx+1,1),b[idx]+func(idx+1,2)});
	}

	return dp[idx][prev]=ans;
}

void solve(){
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>a[i]>>b[i]>>c[i];
	}

	memset(dp,-1,sizeof(dp));

	int ans=func(0,0);

	cout<<ans<<endl;
}
 
int32_t main(){
	ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
// #ifndef ONLINE_JUDGE
// 	freopen("input.txt","r",stdin);
// 	freopen("output.txt","w",stdout);
// #endif
	int t=1;
	//cin>>t;
	while(t--){
		solve();
	}
}

Measured memory_bytes: 12032
#include<iostream>
#include<math.h>
#include<algorithm>
#include<stdint.h>
#include<vector>
#include<deque>
#include<string>
#include<cstring>
#include<time.h>
#include<iomanip>
#include<list>
#include<set>
#include<unordered_map>
#include<unordered_set>
#include<random>
#include<bitset>
#include <queue>
#include <map>


using namespace std;
using ll = long long;
using ull = unsigned long long;
using uint = unsigned int;
using ldouble = long double;

#define repi(i,a,b) for(ll i = (a); i < (b); i++)
#define rep(i, n) for(ll i = 0; i < (n); ++i)


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



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define S second
#define F first
#define pb push_back
#define mm make_pair
const int MX=2e5;
int N, M, k;
int arr[MX];
int main()
{
    cin>>N;
    if(N == 1)
    {
        cout<<"Hello World\n";
    }
    else
    {
        int a, b;
        cin>>a>>b;
        cout<<a+b;
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,a,n)  for (int i=(int)(a); i<=(int)(n); ++i)
#define rrep(i,a,n) for (int i=(int)(a); i>=(int)(n); --i)
#define debug(x) cerr << #x << " = " << x << "\n"
#define debugv(x) rep(i, x.size()) cerr << x[i] << (i == x.size() - 1 ? "\n" : " ")
#define all(x) x.begin(),x.end()
#define int long long
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int INF = ((1LL << 30) + (1LL << 29));
const int MOD = 1000000007;

//=============================
int N,M,K;
string S,T;
vector<int> A;
vector<int> B;
//=============================
void input()
{
    cin>>N;
    A.resize(N);
    rep(i,0,N-1){
        cin>>A[i];
    }

}
//=============================
void func(){}

//=============================
void solve()
{
    sort(A.rbegin(),A.rend());
    sort(all(A));

    priority_queue<double,vector<double>, greater<double>> q;
    for(auto x : A){
        q.push(x);
    }

    long double ans = 0;
    while(q.size() > 1){
        double k = q.top();
        q.pop();
        k += q.top();
        q.pop();
        k/= 2.0;
        q.push(k);
    }
    ans = q.top();
    q.pop();
    ans += q.top();
    ans /= 2.0;
    cout<<ans<<endl;


}
//=============================
signed main()
{
    input();
    solve();
    return 0;
}

Measured memory_bytes: 256
package main

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

var (
	scanner = bufio.NewScanner(os.Stdin)
	write   = bufio.NewWriter(os.Stdout)
)

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

const (
	initialBufSize = 2e8
	maxBufSize     = 2e8
)

func main() {
	buf := make([]byte, initialBufSize)
	scanner.Buffer(buf, maxBufSize)
	scanner.Split(bufio.ScanWords)

	n := readString()

	ans := 0
	for _, c := range n {
		num, _ := strconv.Atoi(string(c))
		ans = (num + ans) % 9
	}

	if ans%9 == 0 {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}


Measured memory_bytes: 8604
#include <cstdio>
#include <iostream>

using namespace std;

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

  for (int x = 0; x <= N; ++x) {
    for (int y = 0; y <= N; ++y) {
      const int z = N - x - y;
      if (z < 0 || x + y + z != N) {
        continue;
      }

      if (10000 * x + 5000 * y + 1000 * z == Y) {
        printf("%d %d %d\n", x, y, z);
        return 0;
      }
    }
  }
  printf("-1 -1 -1\n");

  return 0;
}

Measured memory_bytes: 256
N = int(input())
H = input().split(' ')
H = [int(H[i]) for i in range(N)]
max = 0
count = 0
for i in range(N-1):
  if H[i]>=H[i+1]:
    count += 1
    if max<count:
      max=count
  else:
    count = 0
print(max)

Measured memory_bytes: 20060
#include <bits/stdc++.h>
using namespace std;
bool IsPrime(int num){
    if (num < 2) return false;
    if (num == 2) return true;
    if (num % 2 == 0) return false; // 偶数はあらかじめ除く
    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)if (num % i == 0)return false;
    return true;
}
int main(){
  vector<int>A(100010,0);
  for(int i=3;i<100010;i++){
    A[i]=A[i-1];
    if(IsPrime(i)&&IsPrime((i+1)/2))A[i]++;
  }
  int N;cin>>N;
  for(int i=0;i<N;i++){
    int a,b;cin>>a>>b;
    cout<<A[b]-A[a-1]<<endl;
  }
}

Measured memory_bytes: 3760
//=========================================\\   
  //          @Author : SajidZakaria           \\
 //     @File Created : 2020-05-31 17:59:55     \\
//===============================================\\

#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
#define endl '\n'

int main(){
	ios_base::sync_with_stdio(false);
	int a, b;
	cin >> a >> b;
	cout << a * b << endl;
	
	return 0;
}

Measured memory_bytes: 3636
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>
#include<stack>
#include<queue>
#include<vector>
#include<algorithm>
#include<string>
#include<iostream>
#include<set>
#include<map>
#include<bitset>

using namespace std;
typedef long long ll;
#define i_7 (ll)(1E9+7)
#define i_5 (ll)(1E9+5)
ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    else return c+i_7;
}
typedef pair<int,int> i_i;
typedef pair<ll,ll> l_l;
ll inf=(ll)1E12;/*10^12*/
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}

////////////////////////////////////////
//[1,n]
#define max_n 300000//調節！！！！！！！！！！！！！！！！！！！！！！！！！！！！！！！！！！！！
int bit[max_n+1],n;
int su(int i){//a[1]~a[i]の和を求める
    int s=0;
    while(i>0){
        s+=bit[i];
        i-=i&-i;
    }
    return s;
}
void add(int i,int x){//a[i]にxを加える
    while(i<=n){
        bit[i]+=x;
        i+=i&-i;
    }
}
////////////////////////////////////////

#define N 200005
ll m,k;
ll a[N];
int main(){
    cin>>m>>k;
    rep(i,1,m)cin>>a[i];
    ll sum[m+1];sum[0]=0;
    rep(i,1,m){
        sum[i]=sum[i-1]+a[i];
    }
    rep(i,1,m){
        sum[i]-=k*i;
    }
    //rep(i,0,m)cout<<sum[i]<<" ";cout<<endl;
    vector<ll>s;
    rep(i,0,m)s.pb(sum[i]);
    sort(s.begin(),s.end());
    int num[m+2];
    rep(i,0,m){
        int ite=lower_bound(s.begin(),s.end(),sum[i])-s.begin();
        num[i+1]=ite+1;
    }
    //rep(i,1,m+1)cout<<num[i]<<" ";cout<<endl;
    n=m+1;
    ll ans=0;
    rep(i,1,m+1){
        ans+=su(num[i]);
        add(num[i],1);
    }
    cout<<ans<<endl;
    
    return 0;
}


Measured memory_bytes: 6640
#include <iostream>
#include <vector>
#include <deque>
#include <algorithm>
#include <numeric>
#include <string>
#include <cstring>
#include <list>
#include <unordered_set>
#include <tuple>
#include <cmath>
#include <limits>
#include <type_traits>
#include <iomanip>
#include <map>
#include <unordered_map>
#include <queue>
#include <stack>
#include <set>
#include <bitset>
#include <regex>
#include <random>
#include<bits/stdc++.h>

using namespace std;

typedef long long ll;
#define rep(i,n)for(ll i=0;i<n;++i)
#define exout(x) printf("%.10f\n", x)
const double pi = acos(-1.0);
const ll MOD = 1000000007;
const ll INF = 1e18;
const ll MAX_N = 201010;

//最大公約数
ll gcd(ll x, ll y) {
	return y ? gcd(y, x % y) : x;
}

ll lcm(ll x, ll y) {
	if (x == 0 || y == 0)return 0;
	return (x / gcd(x, y) * y);
}

ll dx[4] = { 0,0,-1,1 };
ll dy[4] = { -1,1,0,0 };
ll ans[110][110];

//long longしか使わない
//素数は1より大きい
//lower_boundは指定したkey以上の要素の一番左のイテレータをかえす
//upper_boundは指定したkeyより大きい要素の一番左のイテレータをかえす
int main() {
	int H, W, M;
	cin >> H >> W >> M;
	set<pair<int, int>>p;
	vector<int>gyo(H), retu(W);
	for (int i = 0;i < M;++i) {
		int h, w;
		cin >> h >> w;
		h--;
		w--;
		gyo[h]++;
		retu[w]++;
		p.emplace(h, w);
	}
	int mh = 0, mw = 0;
	for (int i = 0;i < H;++i) {
		mh=max(mh, gyo[i]);
	}
	for (int i = 0;i < W;++i) {
		mw=max(mw, retu[i]);
	}
	vector<int>is, js;
	for (int i = 0;i < H;++i) {
		if (mh == gyo[i])is.push_back(i);
	}
	for (int i = 0;i < W;++i) {
		if (mw == retu[i])js.push_back(i);
	}
	int ans = mh + mw;
	for (int i:is) {
		for (int j:js) {
			if (p.count(pair<int, int>(i, j)))continue;
			cout << ans << endl;
			return 0;
		}
	}
	ans--;
	cout << ans << endl;
	return 0;
	return 0;
}


Measured memory_bytes: 23808
import scala.io.StdIn._
import scala.math.abs

object Main extends App {
  val s = readLine()

  require(4 <= s.length && s.length <= 10)

  var i    = 0
  var list = Seq.empty[Int]
  while (i < s.length - 2) {
    val j = s.substring(i).take(3).toInt
    list = list.appended(j)
    i = i + 1
  }
  println(abs(list.minBy(i => abs(i - 753)) - 753))
}


Measured memory_bytes: 54688
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n;
  cin>>n;
  if(n%1000==0)
    cout<<0<<endl;
  else
  {
    int could=n%1000;
    //cout<<could<<endl;
    cout<<(1000-could)<<endl;
  }
}

Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define MOD 1000000007
#define PI 3.141592653589793

int main(){
    int n;
    cin >> n;
    int ans = 0;
    for(int i = 1; i <= n; i+=2){
        int cnt = 0;
        for(int j = 1; j*j <= i; j++){
            if(i % j == 0){
                cnt++;
                if(j != i / j)
                    cnt++;
            }
        }
        if(cnt == 8)
            ans++;
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

/* attention
    long longのシフト演算には気をつけよう
    タイポした時のデバッグが死ぬほどきつくなるので変数名は最低3字くらい使った方がいいかも
    sizeは(int)とキャストしよう
    ごちゃごちゃ場合分けを考える前に全探索は考えましたか？
*/

const ll mod = 1e9+7;

void chmod(ll &M){
    if(M >= mod) M %= mod;
    else if(M < 0){
        M += (abs(M)/mod + 1)*mod;
        M %= mod;
    }
}

ll modpow(ll x, ll n){
    if(n == 0) return 1;

    ll res = modpow(x, n/2);
    if(n%2 == 0) return res*res%mod;
    else return res*res%mod*x%mod;
}

ll power(ll x, ll n){
    if(n == 0) return 1;

    ll res = power(x, n/2);
    if(n%2 == 0) return res*res;
    else return res*res*x;
}

int getl(int i, int N) { return i==0? N-1:i-1; };
int getr(int i, int N) { return i==N-1? 0:i+1; };

/* <--------------------------------------------> */

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

    ll N,W; cin >> N >> W;
    vector<ll> w(N+5), v(N+5);

    for(int i=1; i<=N; ++i) cin >> w[i] >> v[i];


    // dp[i][j] := i番目までの商品から価値の総和がjとなるように選んだ時の、重さの最小値（存在しなければinf）
    const ll inf = 1LL<<60;
    vector< vector<ll> > dp(N+5, vector<ll>(100005, inf));
    dp[0][0] = 0;

    for(int i=1; i<=N; ++i){
        for(int j=0; j<100005; ++j){
            chmin(dp[i][j], dp[i-1][j]);
            if(j-v[i]>=0) chmin(dp[i][j], dp[i-1][j-v[i]]+w[i]);
        }
    }

    ll ans = 0;
    for(int v=0; v<100005; ++v) if(dp[N][v] <= W) ans = v;
    cout << ans << endl;

    

	return 0;
}


Measured memory_bytes: 83456