akhauriyash/Code-Regression huggingface dataset:
/*
гонфлад
*/
#pragma ARCENIY_KIRILLOV_UVIDEL_KROKODILOV
//#pragma comment(linker, "/stack:200000000")
//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#pragma GCC optimize("no-stack-protector")
//#pragma GCC push_options
//#pragma GCC optimize ("unroll-loops")
//#pragma GCC pop_options
#include<bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define rng(a) a.begin(), a.end()
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
using namespace std;
typedef long long ll;



main(){
    int n;
    cin >> n;
    vector <int> a(n);
    map <int,int> b;
    for (int i = 0; i < n; i++){
        cin >> a[i];
        b[a[i]]++;
    }
    if (b.size() > 3){
        cout << "No";
        return 0;
    }
    if (b.size() == 3){
        vector<pair<int,int> > c;
        for (auto x : b)
            c.pb(x);
        if ( (c[0].fi ^ c[1].fi) == c[2].fi){
            if (c[0].se == c[1].se && c[1].se == c[2].se){
                cout << "Yes";
                return 0;
            }
        }
        cout << "No";
        return 0;
    }
    if(b.size() == 1){
            int c;
            for (auto x : b)
                c = x.fi;
            if (c == 0){
                cout << "Yes";
            }else cout << "No";
            return 0;
    }
    int c = -1;
    int d = -1;
    for (auto x : b){
        if (d == -1){
            if (x.fi != 0){
                cout << "No";
                return 0;
            }
            d = x.se;
        }else c = x.se;
    }
    if (d + d == c){
        cout << "Yes";
        return 0;
    }
    cout << "No";

}


Measured memory_bytes: 4224
#include <bits/stdc++.h>
using namespace std;
int main()
{
	int n, k, ans=0;
	string s;
	cin >> n >> k >> s;
	s = ' ' + s + ' '; //为便于统一操作 
	for(int i = 1; i <= n; i++)
	{
		if(s[i]=='L'&&s[i-1]=='L' || s[i]=='R'&&s[i+1]=='R')
		{
			ans++;
		}
	}
	
	ans = min(ans+k*2, n-1);//每次操作能最多增加2人满意，但总共不超过n-1人 
	cout << ans;
	return 0;
}

Measured memory_bytes: 512
#!/usr/bin/env python3


def solv(s):
    counts = []
    lc = 0
    rc = 0
    cur = 'R'
    for ch in s:
        if cur == 'R':
            if ch == 'R':
                rc += 1
            else:
                cur = 'L'
                lc = 1
        else:
            if ch == 'L':
                lc += 1
            else:
                counts.append((rc, lc))
                cur = 'R'
                lc = 0
                rc = 1
    counts.append((rc, lc))

    slen = len(s)
    ans = [0] * slen
    idx = 0
    for (rc, lc) in counts:
        idx += rc
        rh = rc // 2
        ans[idx] += rh
        ans[idx-1] += (rh + rc % 2)
        lh = lc // 2
        ans[idx] += (lh + lc % 2)
        ans[idx-1] += lh
        idx += lc
    return ans


if __name__ == '__main__':

    s = input().strip()

    ans = solv(s)

    print(' '.join(map(str, ans)))


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

#define rep(i,n) for(long long int (i)=0;(i)<(int)(n);(i)++)
#define rrep(i,a,b) for(long long int i=(a);i<(b);i++)
#define rrrep(i,a,b) for(long long int i=(a);i>=(b);i--)
#define all(v) (v).begin(), (v).end()
#define pb(q) push_back(q)
#define Size(n) (n).size()
#define Cout(x) cout<<(x)<<endl

typedef long long ll;

using namespace std;

const int INF = 1e9,MOD = 1e9 + 7,ohara = 1e6;
const ll LINF = 1e18;
long long int n,cnt=0,ans=0,a,b,c,d,cmp,cmpp,m,h,w,x,y,sum=0,pos;
int dy[]={1,0,-1,0};
int dx[]={0,1,0,-1};
string alph("abcdefghijklmnopqrstuvwxyz"),s;
bool fl;
struct edge{int to,cost;};

//-------------------------↓↓↓↓↓↓------------------------

int main(void){
  
       cin.tie(0);
    ios::sync_with_stdio(false);
      
      cin>>n>>m;
      if(m-2*n>=0){
        ans=n;
        m-=2*n;
        ans+=m/4;
      }
      else{
        ans=m/2;
      }
      Cout(ans);
       
return 0;
}


Measured memory_bytes: 256
S = list(input())

ans = "Yes"
for i in range(len(S)):
    cnt = i +1
    if cnt % 2 != 0:
        if S[i] == "L":
            ans = "No"
            break
    else:
        if S[i] == "R":
            ans = "No"
            break
print(ans)

Measured memory_bytes: 9096
#include <iostream>
#include <string>
#include <vector>

using namespace std;

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

    vector<long long> cnt(5, 0);
    for (int i = 0; i < n; i++) {
        string s;
        cin >> s;

        if (s[0] == 'M') { cnt[0]++; }
        if (s[0] == 'A') { cnt[1]++; }
        if (s[0] == 'R') { cnt[2]++; }
        if (s[0] == 'C') { cnt[3]++; }
        if (s[0] == 'H') { cnt[4]++; }
    }

    long long res = 0;
    for (int i = 0; i < 5; i++) {
        for (int j = i + 1; j < 5; j++) {
            for (int k = j + 1; k < 5; k++) {
                long long r = 1;
                r *= cnt[i];
                r *= cnt[j];
                r *= cnt[k];
                res += r;
            }
        }
    }

    cout << res << endl;
}


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

int main() {
	int a, b, c;
	cin >> a >> b >> c;
	int count = 0;
	for (int i = 0; i < c; i++) {
		b -= a;
		if (b < 0)break;
		count++;
	}
	cout << count << endl;
}

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

//宣言
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;

//数値
#define MOD 1000000007
#define INF (1<<20)
const double EPS = 1e-10;
const double PI = acos(-1.0);

//操作
#define FOR(i,a,b) for(int i=a;i<b;++i)
#define REP(i,n) FOR(i,0,n)
#define REPB(i,n) for(int i=n;i>=0;--i)
#define SORT(A) sort(A,A+sizeof(A)/sizeof(A[0]))
#define VSORT(A) sort(A.begin(),A.end())
#define EXIST(s,e) (s.find(e)!=s.end())
#define PB push_back
#define MP make_pair
#define Int(x) int x; scanf("%lld", &x);
#define int2(x, y) int x, y; scanf("%lld %lld", &x, &y);

//DEBUG
//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;


int main() {
	int N;cin >> N;
	int a[20001] = { 0 }, b[20001] = { 0 };
	REP(i, N) {
		a[i] = 20005 * (i + 1); b[i] = 20005 * (N - i);
	}
	int p=0;
	REP(i, N) {
		cin >> p; p--;
		a[p] += i;
	}

	REP(i, N){
		cout << a[i]<<(i!=N-1? " " : "\n");
	}
	REP(i, N) {
		cout << b[i] << (i != N - 1 ? " " : "\n");
	}
}


Measured memory_bytes: 768
import java.util.Scanner;
import java.util.stream.IntStream;

public class Main {

	private static final int N = 3;

	public static void main(String[] args) {
		try (Scanner scanner = new Scanner(System.in)) {
			int[][] c = new int[N][N];
			IntStream.range(0, N).forEach(i -> IntStream.range(0, N).forEach(j -> c[i][j] = scanner.nextInt()));
			boolean result = true;
			for (int i = 0; i < N - 1; i++) {
				int diff1 = c[i + 1][0] - c[i][0];
				int diff2 = c[0][i + 1] - c[0][i];
				for (int j = 1; j < N; j++) {
					if ((c[i + 1][j] - c[i][j]) != diff1) {
						result = false;
						break;
					}
					if ((c[j][i + 1] - c[j][i]) != diff2) {
						result = false;
						break;
					}
				}
			}
			System.out.println(result ? "Yes" : "No");
		}
	}
}


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

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


int main()
{
    long long A;
    cin >> A;
    string b;
    cin >> b;

    long long B = 100*(b[0] -'0') + 10*(b[2]-'0') + (b[3]-'0');
    cout << (A*B) / 100 << endl;

    return 0;
}

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

int main() {
  int N , x = 1 , y = 0;
  cin >> N;
  
  vector<int> vec(N);
  for(int i = 0 ; i < N ; i++) {
    cin >> vec.at(i);
  }//配列を受け取る
  
	for(int i = 0 ; i < N ; i++)/*N回ループ*/ {
      
      x = vec.at(x-1); //xにx(=0)項目を代入
      
      if(x == 2) {
        y = i + 1; 
        break;
    }
  
    }
  
  if(x == 2){
    cout << y << endl;
  }
      
  else {
    cout << -1 << endl;
  }

      
      
    
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define int long long
const int M = 2e5 + 5;
const int mod = 998244353;
int n, m, k, f[M], inv[M];

int power(int a, int b)
{
	int res = 1;
	while(b)
	{
		if(b & 1)
			res = (res * a) % mod;
		b >>= 1;
		a = (a * a) % mod;
	}
	return res % mod;
}

int modInv(int a)
{
	return power(a, mod - 2);
}

void precompute()
{
	f[0] = f[1] = 1;
	for(int i = 2; i < M; i++)
		f[i] = (f[i - 1] * i) % mod;
	inv[M - 1] = modInv(f[M - 1]);
	for(int i = M - 2; i >= 0; i--)
		inv[i] = (inv[i + 1] * (i + 1)) % mod;
}

int nCr(int n, int r)
{
	if(n < r)	return 0;
	int res = f[n];
	res = (res * inv[r]) % mod;
	res = (res * inv[n - r]) % mod;
	return res % mod;
}
 
int32_t main() 
{
	ios_base::sync_with_stdio(0);	cin.tie(0);	cout.tie(0);
	precompute();
	cin >> n >> m >> k;
	int ans = 0;
	for(int i = 0; i <= k; i++)
	{
		int cur = nCr(n - 1, i);
		cur = (cur * m) % mod;
		cur = (cur * power(m - 1, n - 1 - i)) % mod;
		ans = (ans + cur) % mod;
	}
	cout << ans;
    	return 0;
}

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

int main(){
  int n;
  cin >> n;
  if(n >= 30) cout << "Yes" << endl;
  else cout << "No" << endl;
}


Measured memory_bytes: 3616
import sys

n, k, q = map(int, sys.stdin.readline().split())

def solve():
	if k  > q:
		return [1]*n
	S = [k-q]*n
	for _ in range(q):
		i = int(sys.stdin.readline())
		S[i-1] += 1
	return S
S = solve()
for i in range(n):
	if S[i] > 0:
		print("Yes")
	else:
		print("No")

Measured memory_bytes: 6472
#include <iostream>
#include <cmath>
#include <cassert>
#include <vector>
#include <map>
#include <string>
#include <algorithm>
#include <numeric>
#include <queue>
#include <type_traits>
#include <fstream>
//#include <bits/stdc++.h>

typedef long long ll;
const ll INF = (ll)1e18 + 1;
const ll MOD = 1e9 + 7;

// print(x, y, z);
// printVec(va.begin(), va.end());
void print(){ std::cout << std::endl; }
template <typename Head> void print(Head&& head) { std::cout << head << std::endl; }
template <typename Head, typename... Tail> void print(Head&& head, Tail&&... tail)
{
  std::cout << head << " ";
  print(std::forward<Tail>(tail)...); // or print(tail...);
}
template<typename Iterator> void printVec(Iterator begin, Iterator end)
{
  for (Iterator it = begin; it != end; it++) {
    std::cout << "[" << it - begin << "] " << *it << " ";
    if ((it - begin) % 20 == 19 || it == end - 1) { std::cout << std::endl; }
  }
}
template<typename Iterator> void printVecPair(Iterator begin, Iterator end)
{
  for (Iterator it = begin; it != end; it++) {
    std::cout << "[" << it - begin << "] " << it->first << " " << it->second << " ";
    if ((it - begin) % 10 == 9 || it == end - 1) std::cout << std::endl;
  }
}

template<typename T> T bitnum(T x)
{
  T cnt = 1;
  T ret = 0;
  while (x > 0) {
    ret += (x % 2) * cnt;
    x /= 2;
    cnt *= 10;
  }
  return ret;
}

template<typename T> T lminimum(const std::vector< T >& v) {return *std::min_element(v.begin(), v.end());}
template<typename T> T lmaximum(const std::vector< T >& v) {return *std::max_element(v.begin(), v.end());}
template<typename T> void lunique(std::vector< T >& v) {v.erase(std::unique(v.begin(), v.end()), v.end());}
template<typename T> void lsort(std::vector< T >& v) {std::sort(v.begin(), v.end());}
template<typename T> void lgreatersort(std::vector< T >& v) {std::sort(v.begin(), v.end(), std::greater<>());}
template<typename T> bool lnext_permutation(std::vector< T >& v) {return std::next_permutation(v.begin(), v.end());}

int main(int argc, char* argv[])
{
  ll N, C;
  std::cin >> N >> C;
  //std::vector< ll > vs(N, 0LL);
  //std::vector< ll > vt(N, 0LL);
  //std::vector< ll > vc(N, 0LL);
  std::vector< std::vector<ll> > vrecord(30, std::vector<ll>(1e5+10, 0LL));

  for (ll i = 0; i < N; i++) {
    ll s, t, c;
    std::cin >> s >> t >> c;
    s--; t--; c--;
    vrecord[c][s]++;
    vrecord[c][t]--;
    //std::cin >> vs[i] >> vt[i] >> vc[i];
  }

  std::vector< ll > vt(1e5+1, 0LL);
  for (ll c = 0; c < C; c++) {
    for (ll t = 0; t < (ll)1e5; t++) {
      if (vrecord[c][t] > 0) vt[t]   += vrecord[c][t];
      if (vrecord[c][t] < 0) vt[t+1] += vrecord[c][t];
    }
  }

  for (ll t = 0; t < (ll)1e5; t++) {
    vt[t+1] += vt[t];
  }

  ll ans = lmaximum(vt);
  //printVec(vt.begin(), vt.begin() + 20);
  print(ans);
  return 0;
}


Measured memory_bytes: 24576
#include <iostream>
#define INF 1e+9
using namespace std;

int main(){
	int h,w;
	int d[100][100];
	cin >> h >> w;
	for(int i = 0;i < h;i++){
		for(int j = 0;j < w;j++) d[i][j] = -INF;
	}
	for(int i = 0;i < h;i++){
		for(int j = 0;j < w;j++){
			char t;
			cin >> t;
			if(t == 'c') {
				d[i][j] = 0;
				cout << (j == 0 ? "" : " ") << 0;
			}
			else if(j >= 1) {
				d[i][j] = d[i][j - 1] + 1;
				cout << " " << max(-1,d[i][j]);
			}
			else cout << -1;
		}
		cout << endl;
	}
	return 0;
}

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

#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;

// auto mod int
// https://youtu.be/L8grWxBlIZ4?t=9858
// https://youtu.be/ERZuLAxZffQ?t=4807 : optimize
// https://youtu.be/8uowVvQ_-Mo?t=1329 : division
const int mod = 998244353;
struct mint {
	ll x; // typedef long long ll;
	mint(ll x=0):x((x% mod+mod)%mod){}
	mint operator-() const { return mint(-x); }
	mint& operator+=(const mint a) {
		if((x += a.x) >= mod) x -= mod;
		return *this;
	}
	mint& operator-=(const mint a) {
		if((x += mod-a.x) >= mod) x -= mod;
		return *this;
	}
	mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this; }
	mint operator+(const mint a) const { return mint(*this) += a; }
	mint operator-(const mint a) const { return mint(*this) -= a; }
	mint operator*(const mint a) const { return mint(*this) *= a; }
	mint pow(ll t) const {
		if(!t) return 1;
		mint a = pow(t>>1);
		a *= a;
		if(t&1) a *= *this;
		return a;
	}

	// for prime mod
	mint inv() const { return pow(mod-2); }
	mint& operator/=(const mint a) { return *this *= a.inv(); }
	mint operator/(const mint a) const { return mint(*this) /= a; }
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x; }
ostream& operator<<(ostream& os, const mint& a) { return os << a.x; }


int main() {
	int n, s;
	cin >> n >> s;
	vector<int> a(n);
	rep(i, n) cin >> a[i];
	vector<mint> q(s+1);
	mint ans = 0;
	rep(i, n) {
		q[0] += 1; // q += 1
		{ // q *= (1 + x^a[i])
			vector<mint> q2(s+1);
			rep(j, s+1) {
				q2[j] += q[j];
				if(j+a[i] <= s) q2[j+a[i]] += q[j];
			}
			q = q2;
		}
		ans += q[s];
	}
	cout << ans << endl;
	return 0;
}


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

#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl "\n"
#define PI 3.14159265358979
#define MOD 1000000007 // = 10^9 + 7

using namespace std;
using ll = long long;

void solve()
{
	ll n;
	cin >> n;
	if (n & 1)
	{
		cout << 0;
		return;
	}

	ll ans = 0;

	// 5 の個数を数える
	ll five_pow = 5;
	while(five_pow < n)
	{
		ans += n / five_pow / 2;
		five_pow *= 5;
	}
	cout << ans;
}

int main()
{
	fastio;
	solve();

	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
 #include <cstring>
 #include <cmath>
 using namespace std;
 //dp   dp[i][j]=max(dp[i-1][j],dp[i][j-1])+a[i][j]
 const int maxn=1e2+10; 
 int n;
 int a[maxn][maxn];
 int dp[maxn][maxn];
 
 int max(int a,int b)
 {
 	return a>b?a:b;
  } 
 
 void solve()
 {
 	dp[1][1]=a[1][1];
 	for(int i=1;i<=2;i++)
 	{
 		for(int j=1;j<=n;j++)
 		{
 			if(i==1)
 				dp[i][j]=dp[i][j-1]+a[i][j];
 			else
 				dp[i][j]=max(dp[i-1][j],dp[i][j-1])+a[i][j]; 
 		}
 	}
 } 
 int main()
 {
 	while(~scanf("%d",&n))
 	{
 	
 	memset(a,0,sizeof(a));
 	memset(dp,0,sizeof(dp));
 	for(int i=1;i<=2;i++)
 	{
 		for(int j=1;j<=n;j++)
 		{
 			scanf("%d",&a[i][j]);
 		}
 	}
 	solve();
 	printf("%d\n",dp[2][n]);
 }
 	return 0;
 }

Measured memory_bytes: 256
#include <stdio.h>
int main(void) {
int n, i, j, k, x, p;
int a[1000];
scanf("%d", &n);
for (i = 0;i < n;i++) {
scanf("%d", &a[i]);
} for (p = 0;p < n;p++) {
if (p == n - 1) {
printf("%d", a[p]);
} else {
printf("%d ", a[p]);
}
} putchar('\n');
 for (i = 1; i < n;i++) {
j = i - 1;
k = a[i];
while (j >= 0 && a[j] > k) {
a[j + 1] = a[j];
j--;
a[j + 1] = k;
} for (p = 0;p < n;p++) {
if (p == n - 1) {
printf("%d", a[p]);
} else {
printf("%d ", a[p]);
} } putchar('\n');
}
return 0;
}


Measured memory_bytes: 2104
N = int(input())
S = str(input())

ans = ''
for i in S:
  chatonum = lambda i: ord(i) - ord('A') + 1
  num = chatonum(i)
  num += N
  if 26 < num:
    num -= 26
  numtocha = lambda num: chr(num+64)
  cha = numtocha(num)
  ans += cha
  
print(ans)

Measured memory_bytes: 3064
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")

#include <iostream> // cout, endl, cin
#include <iomanip>
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <math.h>
using namespace std;

int main(){
  int X;
  cin >> X;
  if(X >= 400 && X <=599) cout << 8 << endl;
  else if(X >= 600 && X <= 799) cout << 7 << endl;
  else if(X >= 800 && X <= 999) cout << 6 << endl;
  else if(X >= 1000 && X <= 1199) cout << 5 << endl;
  else if(X >= 1200 && X <= 1399) cout << 4 << endl;
  else if(X >= 1400 && X <= 1599) cout << 3 << endl;
  else if(X >= 1600 && X <= 1799) cout << 2 << endl;
  else if(X >= 1800 && X <= 1999) cout << 1 << endl;
}

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

int main(){
	int a,b,c,i,n;
	cin >> n;
	for(i=0;i<n;i++){
		cin >> a >> b >> c;
		if(a*a+b*b==c*c||a*a+c*c==b*b||b*b+c*c==a*a) cout << "YES" << endl;
		else cout << "NO" << endl;
	}
	return 0;
}

Measured memory_bytes: 1152
/*
ID: rchalam1
LANG: C++14
TASK:
*/
// For train.usaco.org, fill the template above.

// Competitive Coding Template

// GCC OPTIMIAZTION FLAGS
#ifdef ONLINE_JUDGE
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#endif

#include <bits/stdc++.h>

/*
#include <fstream>
#include <iostream>
#include <string>
#include <vector>
*/
// All Includes for Competitive Coding Template

using namespace std;

using ll = long long;
using ull = unsigned long long;
using ld = long double;

using vi = std::vector<int>;
using vll = std::vector<long long>;
using vull = std::vector<unsigned long long>;

#define FOR(i, a, b) for (auto i = (a); i < (b); ++i)
#define F0R(i, a) FOR(i, 0, a)
#define ROF(i, a, b) for (auto i = (a); i >= (b); --i)
#define R0F(i, a) ROF(i, a, 0)
#define ITR(a, x) for (auto& a: x)

#define FSRT(set) sort((set).begin(),(set).end())
#define RSRT(set) sort((set).rbegin(),(set).rend())
#define CSRT(set, function) sort((set).begin(),(set).end(), (function))
#define TRS(set) sort((set).begin(),(set).end(), greater<>())
#define REV(set) reverse((set).begin(),(set).end());

#define ALL(set) (set).begin(), (set).end()

#define mp make_pair
#define mt make_tuple
#define pb push_back
#define eb emplace_back
#define ff first
#define ss second

// For stdio, call setIO() or setIO("").
void setIO(std::ifstream &readFile, std::ofstream &writeFile, const std::string &name = "", bool stdIO = false)
{
	std::ios_base::sync_with_stdio(false);
	std::cin.tie(nullptr);
	std::cout.tie(nullptr);
	if(!name.empty() && !stdIO)
	{
		readFile.open(name + ".in");
		if(readFile.fail()) return;
		writeFile.open(name + ".out");
		std::cin.rdbuf(readFile.rdbuf());
		std::cout.rdbuf(writeFile.rdbuf());
	}
}

// To time program, create object Timer  to start timing, and call Timer.elapsed().
#include <chrono>

class Timer
{
	std::chrono::time_point<std::chrono::high_resolution_clock> m_beg;
public:
	Timer() : m_beg(std::chrono::high_resolution_clock::now())
	{}

	void reset()
	{ m_beg = std::chrono::high_resolution_clock::now(); }

	[[nodiscard]] long double elapsed() const
	{
		return std::chrono::duration_cast<std::chrono::duration<long double, std::ratio<1> >>(
				std::chrono::high_resolution_clock::now() - m_beg).count();
	}
};

// Defines datatype
using dt = int;
// Defines MAXN value
constexpr dt MAXN = 1e5 + 1;
// Defines Modulus
constexpr dt MOD = 1e9 + 7;
// Defines Floating Point Correction
constexpr long double EPS = 1e-9;

//*****
//START CODE BELOW
//*****

int main(int argc, char *argv[])
{
	static std::ifstream readFile;
	static std::ofstream writeFile;
	setIO(readFile, writeFile);
	string w;
	cin >> w;
	map<char, int> counts;
	for(auto &c : w) ++counts[c];
	for(auto &count : counts) if(count.second % 2) return cout << "No\n", 0;
	cout << "Yes\n";
}

Measured memory_bytes: 3596
import sys
n=int(input())
x=[]
y=[]
h=[]
for i in range(n):
    a,b,c=map(int,input().split())
    x.append(a)
    y.append(b)
    h.append(c)
inf=2e31-1
for i in range(101):
    for j in range(101):
        judge=True
        H1=inf
        for k in range(n): 
            if h[k]!=0:
                H1=h[k]+abs(i-x[k])+abs(j-y[k])
                break

        for k in range(n):
            if h[k]==0:
                if H1>abs(i-x[k])+abs(j-y[k]):
                    judge=False
                    break
            else:
                H2=h[k]+abs(i-x[k])+abs(j-y[k])
                if H1!=H2:
                    judge=False
                    break
                    
        if judge:
            sys.stdout.write(str(i))
            sys.stdout.write(' ')
            sys.stdout.write(str(j))
            sys.stdout.write(' ')
            print(H1)
            sys.exit()

Measured memory_bytes: 3064
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long a = sc.nextLong();
		long v = sc.nextLong();
		long b = sc.nextLong();
		long w = sc.nextLong();
		long t = sc.nextLong();
		
		String ans = Math.abs(a - b) <= t * (v - w) ? "YES" : "NO";
		System.out.println(ans);
		
		sc.close();
	}
	
}




Measured memory_bytes: 26684
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();

        if (Math.abs(a - b) % 2 != 0) {
            System.out.println("IMPOSSIBLE");
        } else {
            int tmp = Math.abs(a - b) / 2;
            if (a < b) {
                System.out.println(a + tmp);
            } else {
                System.out.println(b + tmp);
            }
        }
    }
}


Measured memory_bytes: 23252
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String line = br.readLine();
		String[] arr = line.split(" ");
		int a = Integer.parseInt(arr[0]);
		int b = Integer.parseInt(arr[1]);
		if (a < b) System.out.println("a < b");
		else if (a > b) System.out.println("a > b");
		else System.out.println("a == b");
	}
}

Measured memory_bytes: 16928
#include <bits/stdc++.h>
#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++)
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef long double ld;
const ll MOD = 1e9+7;

ll dfs(const vector<vector<int>> &G, int k, int now, int per)
{
  int can = k-2;
  if(per==-1){ 
    can = k-1;         
  }
  
  if(k < G[now].size()) return 0;
  
  ll cnt = 1;
  for(auto v : G[now]){
    if(v==per) continue;
    cnt *= can;
    cnt %= MOD;
    can--;
  }
  for(auto v: G[now]){
    if(v==per) continue;
    cnt *=dfs(G, k, v, now);
    cnt %= MOD;
  }
  return cnt;
}

int main()
{
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int n,k;
  cin >> n >> k;
  vector<vector<int>> G(n);
  REP(i,n-1){
    int a,b; cin >> a >> b;
    a--, b--;
    G[a].push_back(b);
    G[b].push_back(a);
  }
  ll ans = dfs(G, k, 0, -1) * k;
  cout << ans % MOD << endl;
  return 0;
}


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

int main() {
    int n;
    cin >> n;
    ll l[87];
    
    l[0] = 2;
    l[1] = 1;
    
    for(int i = 2; i <= n; i++) {
        l[i] = l[i - 1] + l[i - 2];
    }
    
    cout << l[n] << endl;
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main ( )
{
    int a,b,k;
    scanf("%d",&k);
    scanf("%d %d",&a,&b);
    int i;
    int flag=0;
    for(i=a;i<=b;i++)if(i%k==0){flag=1;break;}
    if(flag)printf("OK");
    else printf("NG");
    return 0;
}


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

using namespace std;

typedef long long LL;
#define N 600

LL n,mod,ans,l[N],r[N],f[N];

LL sqr(LL x){return x*x;}

void upd(LL &x,LL y){x=(x+y)%mod;}

int main(){
	scanf("%lld%lld",&n,&mod);
	for (LL i=0;i<n*2;++i){
		for (LL j=0;j<n*2;++j)
			if (sqr(i)+sqr(j)<=sqr(n*2)) r[i]=j;
			else break;
		++r[i];
	}
	for (LL i=0;i<n;++i){
		for (LL j=0;j<n*2;++j)
			if (sqr(i)+sqr(j)<sqr(n)) l[i]=j;
			else break;
		++l[i];
	}
	for (LL i=0;i<=n;++i){
		memset(f,0,sizeof f); f[0]=1;
		for (LL j=n*2-1,k=n-1;j>=n||k>=0;){
			if (j<n||(k>=0&&l[k]<=r[j])){
				for (LL t=i;~t;--t){
					upd(f[t+1],f[t]*(l[k]-t-(n*2-1-j)));
					f[t]=f[t]*(r[k]-n-(n-1-k)-(i-t))%mod;
				}
				--k;
			}
			else{
				for (LL t=i;~t;--t){
					f[t]=f[t]*(r[j]-(n*2-1-j)-t)%mod;
				}
				--j;
			}
		}
		upd(ans,f[i]*(i&1?-1:1));
	}
	printf("%lld\n",(ans+mod)%mod);
	
	return 0;
}
			

Measured memory_bytes: 256
from collections import deque

S = input()
Q = int(input())
Queries = [input().split() for i in range(Q)]

state = {
    "S": S,
    "is_reversed": False,
    "left": deque(),
    "right": deque(),
}

def T1(state):
    state['is_reversed'] = not state['is_reversed']

def T2(state, F, C):
    if not state['is_reversed']:
        if F == '1':
            state['left'].appendleft(C)
        else:
            state['right'].append(C)
    else:
        if F == '1':
            state['right'].append(C)
        else:
            state['left'].appendleft(C)

def output(state):
    output = ''.join(state['left']) + state['S'] + ''.join(state['right'])
    if state['is_reversed']:
        output = ''.join(list(reversed(output)))

    return output


for Query in Queries:
    if Query[0] == '1':
        T1(state)
    else:
        T2(state, Query[1], Query[2])

answer = output(state)

print(answer)


Measured memory_bytes: 44212
using System;

class Program
{
  public static void Main(string[] args)
  {
    while(true)
    {
      string[] read = Console.ReadLine().Split(' ');
      int H = int.Parse(read[0]);
      int W = int.Parse(read[1]);
      if(H == 0 && W == 0) break;
      for(int i = 0;i < H;i++)
      {
        for(int j = 0;j < W;j++)
        {
          if((i + j)%2 == 0) Console.Write("#");
          else Console.Write(".");
        }
        Console.WriteLine();
      }
      Console.WriteLine();
    }
  }
}

Measured memory_bytes: 8768
# https://atcoder.jp/contests/abc142/tasks/abc142_c
# 最小コストソートの際に使った、ソートしたあとの要素についてソート前の並び順が知りたい

#  AとA_sortedでA_sorted[j]はA[i]の要素であるiの配列が知りたい

# pythonっぽい書き方
N = int(input())
A = list(map(int, input().split()))
tmp = []
for n, a in enumerate(A, start=1):
    tmp.append((a, n))

tmp.sort()
print(*[x[1] for x in tmp])


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

using namespace std;

typedef unsigned long ll;


int main() {

    string target = "AC";

    vector<ll> num;
    ll N ,Q;
    string S;
    vector<ll> l;
    vector<ll> r;

    cin >> N >> Q;
    cin >> S;
    l.resize(Q);
    r.resize(Q);
    num = vector<ll>(N, 0);

    for(int i=0; i<Q; ++i)
        cin >> l[i] >> r[i];

    for(int i=0; i<N; i++)
    {
        num[i] = num[i-1];
        if(S[i-1] =='A' && S[i] =='C')
            num[i]++;
    }


    for(int i=0; i<Q; ++i)
        cout<<num[r[i]-1] - num[l[i]-1]<<endl;



    return 0;
}

Measured memory_bytes: 3456
#include <stdio.h>
int main(void){
   char s[101];
   int n;
   
   scanf("%d%s",&n,s);
   if(n%2!=0){printf("No");return 0;}
   for(int i=0;i<n/2;i++){
       if(s[i]!=s[n/2+i]){printf("No");return 0;}
   }
   printf("Yes");
    return 0;
}


Measured memory_bytes: 128
use std::io::*;
use std::str::FromStr;

pub fn read<T: FromStr>() -> T {
  let stdin = stdin();
  let stdin = stdin.lock();
  let token: String = stdin
    .bytes()
    .map(|c| c.expect("failed to read char") as char)
    .skip_while(|c| c.is_whitespace())
    .take_while(|c| !c.is_whitespace())
    .collect();
  token.parse().ok().expect("failed to parse token")
}

fn main() {
  let n = read::<usize>();
  let q = read::<i32>();
  let s = read::<String>();
  let mut a: Vec<(i32, i32)> = vec![];
  let mut memo = vec![0; n];
  let mut count = 0;

  for _ in 0..q {
    let start = read::<i32>();
    let end = read::<i32>();
    a.push((start, end))
  }

  let mut prev_char: char = '#';

  for (k, v) in s.chars().enumerate() {
    if v == 'C' && prev_char == 'A' {
      count += 1;
    }

    memo[k] = count;
    prev_char = v;
  }

  for (s, e) in a {
    println!("{:?}", memo[(e - 1) as usize] - memo[(s - 1) as usize]);
  }

}



Measured memory_bytes: 4860
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int A , B , L ;	//左のおもり
  int C , D , R ;	//右のおもり
  
  cin >> A >> B >> C >> D ; 

  L = A + B ; 
  R = C + D ;
  
  if ( R == L ) cout << "Balanced" << endl ;
  if ( R > L ) cout << "Right" << endl ;
  if ( R < L ) cout << "Left" << endl ;

}

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

int main() {
  int x, y, z;
  int cnt = 0;
  cin >> x >> y >> z;
  while (true) {
    x -= y + z;
    if (x - z < 0) break;
    cnt++;
  }
  cout << cnt << endl;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#define INF 0x3f3f3f3f
#include <cstdio>
#include <iostream>
#include <sstream>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>
#include <deque>
#include <bitset>
#include <list>
#include <cctype>
#include <utility>
 
using namespace std;
 
typedef long long ll;
typedef pair <int,int> P;
typedef pair <int,P > PP;
 
const static int tx[] = {0,1,1,1,0,-1,-1,-1};
const static int ty[] = {-1,-1,0,1,1,1,0,-1};

class Link{
public:
  Link() : parent("") {}
  string parent;
  vector<string> children;
};

int dfs(map<string,Link>& nodes,const string& node_name,map<string,bool>& visited){
  vector<string>& children = nodes[node_name].children;
  if(children.size() == 0){
    return 1;
  }
  int res = 0;
  for(int i=0;i<children.size();i++){
    if(visited.find(children[i]) == visited.end()){
      res += dfs(nodes,children[i],visited);
      visited[children[i]] = true;
    }
  }
  return res;
}

int main(){
  int N;
  while(~scanf("%d",&N)){
    if(N==0) break;

    string str;
    map<string,Link> nodes;
    string first_group = "";
    for(int i=0;i<N;i++){
      cin >> str;
      string parent = "";
      
      int scan_idx = 0;
      for(;scan_idx<str.size() && str[scan_idx] != ':';
	  scan_idx++){
	parent.push_back(str[scan_idx]);
      }
      if(i==0) first_group = parent;

      string child = "";
      for(scan_idx++;scan_idx<str.size();scan_idx++){
	if(str[scan_idx] == ','
	|| str[scan_idx] == '.'){
	  nodes[child].parent = parent;
	  nodes[parent].children.push_back(child);
	  // cout << child << "\n";
	  child = "";
	  continue;
	}
	child.push_back(str[scan_idx]);
      }
    }

    map<string,bool> visited;
    printf("%d\n",dfs(nodes,first_group,visited));
  }
}

Measured memory_bytes: 1504
#include <bits/stdc++.h>
using namespace std;
#define ROUNDUP(divisor,dividend) (divisor + (dividend - 1)) / dividend
int n,m;
int main(){
  cin >> n >> m;
  std::vector<int> a(m,0);
  for (size_t i = 0; i < n; i++) {
    int k=0;
    cin >> k;
    for (size_t l = 0; l < k; l++) {
      int temp;
      cin >> temp;
      a[temp-1]++;
    }
  }
  int ans=0;
  for (size_t i = 0; i < m; i++) {
    if(a[i] == n)ans++;
  }
  cout << ans << endl;
}


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

int main(){
  int n,m,x,y;cin>>n>>m>>x>>y;
  int z;
  rep(i,n){
    cin>>z;
    x=max(x,z);
  }
  rep(i,m){
    cin>>z;
    y=min(y,z);
  }
  y-x>0?cout<<"No War":cout<<"War";
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main(){
  int n;
  cin >> n;
  vector<ll> sum(n + 1);
  for(int i = 0; i < n; i++){
    ll a;
    cin >> a;
    sum[i + 1] = sum[i] + a;
  }
  sort(sum.begin(), sum.end());
  ll cnt = 0, ans = 0;
  for(int i = 0; i < n; i++){
    if(sum[i] == sum[i + 1]){
      cnt++;
    }else{
      ans += cnt * (cnt + 1) / 2;
      cnt = 0;
    }
  }
  ans += cnt * (cnt + 1) / 2;
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 1792
#include "bits/stdc++.h"

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

    int n;
    std::cin >> n;

    long long ans = 0;
    std::vector<int> a(n);
    for (int i = 0; i < n; i++) {
        std::cin >> a[i];
    }
    
    int m = a[0];
    for (int i = 1; i < n; i++) {
        if (a[i] < m) {
            ans += m - a[i];
            a[i] = m;
        } else {
            m = a[i];
        }
    }

    std::cout << ans;
}

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

int main(){
  long long K,i,num=9,temp;//numにはメイン処理に入る段階での個数(9個)を指定
  queue<long long> memo;
  cin>>K;
  if(K<=9){//9以下ならここで片づける
    cout<<K<<endl;
    return 0;//プログラム終了
  }
  for(i=1;i<10;i++) memo.push(i);//1~9まで生成(主処理の種)
  
  //主処理
  while(num<K){//Kに達していなければ続行
    for(i=-1;i<=1;i++){
      temp=memo.front()%10+i;//次期1の位候補
      if(temp<0 || temp>9) continue;//1の位にありえない数なら破棄
      memo.push(memo.front()*10+temp);//最終的な数を生成
      num++;//個数のカウントを進める
      if(num>=K) break;
    }
    memo.pop();
  }
  
  //答え
  cout<<memo.back()<<endl;
}

Measured memory_bytes: 768
#include<bits/stdc++.h>
#define llu unsigned long long
#define ll long long
#define INF 0x3f3f3f3f
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl "\n"
#define to_lower(s) transform(s.begin(), s.end(), s.begin(), ::tolower);
#define to_upper(s) transform(s.begin(), s.end(), s.begin(), ::toupper);
#define Mod 1000000007
using namespace std;

// scan vector
template <typename T> 
inline istream &operator>>(istream &in, vector<T> &a) {
    for(auto &x : a) in >> x;
    return in;
}
// print vector
template <typename T> 
inline ostream &operator<<(ostream &out, vector<T> &a) {
    for(auto &x : a) out << x <<" ";
    // return in;
}
// scan pair
template <typename T, typename U> 
inline istream &operator>>(istream &in, pair<T,U> &a) {
    in >> a.first >> a.second; 
    return in;
}
vector<ll> dp;
vector<bool> visited;
vector<vector<int> > g;
vector<int> pos;
void dfs(int v) 
{
	visited[v]=true;
	for (auto to : g[v])
	{
		if(!visited[to]) 
			dfs(to);
		dp[v]=max(dp[v],1+dp[to]);
	}
}

int main()	
{
	#ifdef SANS
		freopen("ongoingin.txt","r",stdin);
		freopen("ongoingout.txt","w",stdout);
	#endif
	fast
	int t=1;
	// cin>>t;
	while(t--)	
	{
		int n,m;
		cin>>n>>m;
		g.resize(n+1);
		dp.resize(n+1,0);
		visited.resize(n+1,0);
		for(int i=0; i<m; i++)
		{
			int u,v;
			cin>>u>>v;
			g[u].push_back(v);
		}
		for(int i=1; i<=n; i++)
		{
			if(!visited[i])
				dfs(i);
		}
		ll ans=0;
		for(int i=1; i<=n; i++)
			ans=max(ans,dp[i]);
		cout<<ans<<endl;
	}
	#ifdef SANS
		cout<<"\nTime Elapsed:"<<1.0*clock()/CLOCKS_PER_SEC <<"sec\n";
	#endif
}

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

using namespace std;

int main()
{
    long long int n,k,x,y; cin>>n>>k>>x>>y;
    long long int res=min(n,k)*x+max(0LL,n-k)*y;
    cout<<res;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<map>
#include<string>
#include<numeric>
#include<set>
using namespace std;

int main(){
    int r;
    cin >> r;
    cout << 3*r*r << endl;
    return 0;
}

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

int main(){
    string s;
    cin >> s;
    int n=0;
    bool flag = false;
    for(int i=0;i<s.length();++i){
        if(((1 << (s[i] - 'a')) & n) != 0){
            puts("no");
            flag = true;
            break;
        }
        n ^= (1 << (s[i] - 'a'));
    }
    if(!flag)puts("yes");

    return 0;
}


Measured memory_bytes: 256
S = input()
T = input()
ans ='Yes'
d = {}
d2 = {}
for s, t in zip(S, T):

    if d.get(s) is not None:
        if d[s] != t:
            ans = 'No'
            break
    else:
        d[s] = t

    if d2.get(t) is not None:
        if d2[t] != s:
            ans = 'No'
            break
    else:
        d2[t] = s

print(ans)

Measured memory_bytes: 3632
using System;
using System.Collections.Generic;
using System.Linq;

namespace csharp
{
    class Program
    {
        private const float V = 1.0f;
        private const string Separator = " ";

        static void Main(string[] args)
        {
            string lineStr;
            lineStr = Console.ReadLine();

            int n = int.Parse(lineStr);

            lineStr = Console.ReadLine();
            string[] a = lineStr.Split(' ');

            Dictionary<int, int> dic = new Dictionary<int, int>();

            for (int i = 0; i < n; i++)
            {
                dic.Add(int.Parse(a[i]), i + 1);
            }

            var v2 = dic.OrderBy((v) => v.Key);
            Console.WriteLine(string.Join(Separator, v2.Select(selector: (v) => v.Value)));
            return;
        }
    }
}


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

int N,cnt;
int main(){

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

cin>>N;
for(int i=0; i<N; i++){
	int l,r;
	cin>>l>>r;
	cnt+=(r-l+1);
}
cout<<cnt<<endl;

}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef complex<double> P;
int N,M;
vector<P> ps;
const int INF = (1<<29);

struct state {
  double c;
  int id;
  state(){}
  state(double c,int id):c(c),id(id){}
  bool operator<(const state& st) const{
    return c > st.c;
  }
};

bool check( P a, P b ){
  return abs( a - b ) <= 50.0;
}

void dijk(int s,int g){
  priority_queue<state> q;
  vector<double> H(N,1e20);
  vector<int> R(N,-1);
  q.push( state(0,s) );
  H[s] = 0.0;
  R[s] = -1;
  while( !q.empty() ){
    state p = q.top(); q.pop();
    for(int to=0;to<N;to++){
      if( check( ps[p.id], ps[to] ) ){
        double nc = p.c + abs( ps[ p.id ] - ps[ to ] );
        if( H[ to ] > nc ){
          H[ to ] = nc;
          R[ to ] = p.id;
          q.push( state( nc, to ) );
        }
      }
    }
  }
  vector<int> ret;
  if( H[ g ] >= INF/10.0 ) {
    cout << "NA" << endl; return;
  }
  for( int i = g; i != -1; i=R[i] ) 
    ret.push_back( i );
  
  reverse( ret.begin(), ret.end() );
  for( int i=0;i<(int)ret.size();i++ ){
    if( i ) cout << " ";
    cout << ret[i]+1;
  }
  cout << endl;
}

int main(){
  while( cin >> N && N ) {
    ps = vector<P>(N);
    for(int i=0;i<N;i++){
      int b,x,y; cin >> b >> x >> y; --b;
      ps[b] = P(x,y);
    }
    cin >> M;
    for(int i=0;i<M;i++){
      int s,g; cin >> s >> g; --s; --g;
      dijk( s, g );
    }
  }
}

Measured memory_bytes: 3116
from __future__ import division, print_function
from sys import stdin, exit
from operator import add, sub, mul, floordiv
d = {'+': add, '-': sub, '*': mul, '/': floordiv, '?': lambda a,b: exit(0)}
while True:
    a, op, b = stdin.readline().split()
    print(d[op](int(a), int(b)))

Measured memory_bytes: 4372
n = int(input())
arr = list(map(int, input().split()))
res, i, j = 0, 0, 0
while j < n-1:
    i = j
    while i < n-1 and arr[i] >= arr[i+1]:
        i += 1
    res = max(res, i-j)
    j = i+1
print(res)

Measured memory_bytes: 63984
#include <iostream>
#include <algorithm>
using namespace std;
int main()
{
	int a, b;
	cin >> a >> b;
	if (a > b)
	{
		cout << "a > b" << endl;
	}
	else if (a < b)
	{
		cout << "a < b" << endl;
	}
	else
	{
		cout << "a == b" << endl;
	}
	return 0;
}

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

void solve(){
	
	int n,k ;
	cin>>n>>k ;

	vector<int> v(n) ;

	rep(i,n){
		cin>>v[i] ;
	}

	sort(v.rbegin(),v.rend()) ;

	if(k<n){

		ll x=0 ;
		for(int i=k;i<n;i++){
			x+=v[i] ;
		}

		cout<<x ;
	}
	else{
		cout<<0 ;
	}

}

int main(){
	
	int y ;

	y=1 ;
	//cin>>y ;

	while(y--)
	{	
		solve() ;
	}

}

Measured memory_bytes: 4028
#include <bits/stdc++.h>
#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 REPP(I, A, B) for (int I = (A); I < (B); ++I)
#define RI(X) scanf("%d", &(X))
#define RII(X, Y) scanf("%d%d", &(X), &(Y))
#define RIII(X, Y, Z) scanf("%d%d%d", &(X), &(Y), &(Z))
#define DRI(X) int (X); scanf("%d", &X)
#define DRII(X, Y) int X, Y; scanf("%d%d", &X, &Y)
#define DRIII(X, Y, Z) int X, Y, Z; scanf("%d%d%d", &X, &Y, &Z)
#define RS(X) scanf("%s", (X))
#define CASET int ___T, case_n = 1; scanf("%d ", &___T); while (___T-- > 0)
#define MP make_pair
#define PB push_back
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define LEN(X) strlen(X)
#define VPII vector<pair<int,int> >
#define F first
#define S second
#define RF(x) freopen(x,"r",stdin)
#define WF(x) freopen(x,"w",stdout)
typedef long long LL;
using namespace std;
typedef pair<LL,LL> PLL;
typedef pair<int,int> PII;
const LL MOD = 1e9+7;
const LL INF = 1LL<<50;
const double eps = 1e-13;

int ans[509][509];

int main(){
	DRII(r,c);DRII(h,w);
	REP(i,r){
		REP(j,c){
			if((i+1)%h==0&&(j+1)%w==0){
				ans[i][j]=-h*w-(h*w-1)*999;
			}
			else ans[i][j]=1000;
		}
	}
	LL sum=0;
	REP(i,r)REP(j,c)sum+=ans[i][j];
	if(sum>0){
		puts("Yes");
		REP(i,r){
			REP(j,c){
				if(j)printf(" ");
				printf("%d",ans[i][j]);
			}puts("");
		}
	}
	else puts("No");
}


Measured memory_bytes: 2560
import java.util.*;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = Integer.parseInt(sc.next());
		int p = Integer.parseInt(sc.next());
		int sum  = 3*a + p;
		int pie = sum/2;
		System.out.println(pie);
	}
}

Measured memory_bytes: 21716
#include<bits/stdc++.h>
using namespace std;
void generate(vector<vector<int> > &comb, int n, vector<int> &curr)
{
	if(curr.size() == n)
	{
		comb.push_back(curr);
		return;
	}
	curr.push_back(1);
	generate(comb, n, curr);
	curr.pop_back();
	curr.push_back(0);
	generate(comb, n, curr);
	curr.pop_back();
	return;
}

int correct(vector<int> &v, vector<vector<pair<int,int> > > &comb)
{
	for(int i = 0; i<(int)v.size(); i++)
	{
		if(v[i] == 1)
		{
			for(int j = 0; j<(int)comb[i].size(); j++)
			{
				pair<int,int> temp = comb[i][j];
				if(temp.second == 1)
				{
					if(v[temp.first-1] == 0)
					return 0;
				}
				else
				{
					if(v[temp.first-1] == 1)
					return 0;
				}
			}
		}
	}
	return 1;
}
int main()
{
	int n, i, j;
	cin>>n;
	vector<vector<pair<int,int> > > m(n+1);
	for(i = 0; i<n; i++)
	{
		int one;
		cin>>one;
		for(j = 0; j<one; j++)
		{
			int x,y;
			cin>>x>>y;
			m[i].push_back(make_pair(x,y));
		}
	}
	vector<vector<int> > comb;

	vector<int> current;
	generate(comb, n, current);
	
	int an = 0;

	for(int i = 0; i<(int)comb.size(); i++)
	{
		if(correct(comb[i], m))
		{
			int c = 0;
			for(j = 0; j<(int)comb[i].size(); j++)
			if(comb[i][j] == 1)
			c++;
			an = max(an, c);
		}
	}
	cout<<an<<endl;
}


Measured memory_bytes: 3640
#include <bits/stdc++.h>
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl;
#define ll long long
#define REPS(i, a, n) for (ll i = (a); i < (ll)(n); ++i)
#define REP(i, n) REPS(i, 0, n)
using namespace std;
int main() {
    int k,a,b,c;
    cin >> k >> a>> b;
    c = k;
    while(c <= b) {
        if (a <= c  && c <= b) {
            cout << "OK";
            return 0;
        }
        c += k;
    }
    cout << "NG";
}

Measured memory_bytes: 3592
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;

class Main {
    static class Graph {
        int V;
        List<Integer> adj[];
        int[] indegree;
        int[] dist;
        public Graph(final int V) {
            this.V = V;
            adj = new List[V];
            indegree = new int[V];
            dist = new int[V];
            for(int i = 0; i < V; i++) {
                adj[i] = new ArrayList<>();
            }
        }
        public void addEdge(int u, int v) {
            adj[u].add(v);
            indegree[v]++;
        }
    }
    public static void dfs(Graph g, int i, boolean[] visited) {
        if(visited[i]) {
            return;
        }
        visited[i] = true;
        for(int j : g.adj[i]) {
            g.dist[j] = Math.max(g.dist[j], g.dist[i] + 1);
            --g.indegree[j];
            if(g.indegree[j] == 0) {
                dfs(g, j, visited);
            }
        }
    }
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        if(m == 0) {
            System.out.println(0);
            return;
        }
        Graph g = new Graph(n);
        for(int i = 0; i < m; i++) {
            g.addEdge(sc.nextInt() - 1, sc.nextInt() - 1);
        }
        boolean[] visited = new boolean[n];
        for(int i = 0; i < n; i++) {
            if(g.indegree[i] == 0) {
                dfs(g, i, visited);
            }
        }
        int max = 0;
        for(int d : g.dist) {
            if(max < d) {
                max = d;
            }
        }
        System.out.println(max);
    }
}


Measured memory_bytes: 110676
#include <stdio.h>
int main(void){
    // Your code here!
    char S[5];
    int flag = 0;
    
    scanf("%s",S);
    for(int i = 0; i < 3 && flag == 0; i++)
    {
        if(S[i] == S[i+1])
        {
            //printf("%c %c\n",S[i],S[i+1]);
            flag = 1;
        }
    }
    
    printf("%s\n", (flag == 1)? "Bad":"Good");
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
int father[100500];
int dis[100500];
int find_father(int x) {
	if(father[x]==x)return x;
	int a1=father[x];
	int a2=find_father(father[x]);
	father[x]=a2;
	dis[x]=dis[x]+dis[a1];
	return a2;
}
int find_dis(int x) {
	if(father[x]==x)return 0;
	return find_dis(father[x])+dis[x];
}
int main(void) {
	int num,cas,L,R,D;
	cin>>num>>cas;
	for(int i=0; i<=num; i++) {
		father[i]=i;
		dis[i]=0;
	}
	while(cas--) {
		cin>>L>>R>>D;
		int fl=find_father(L);
		int fr=find_father(R);
		if(fl==fr) {
			if(dis[L]+D!=dis[R]) {
				cout<<"No"<<endl;
				return 0;
			}
		} else {
			father[fr]=fl;
			dis[fr]=find_dis(L)-find_dis(R)+D;
		}
	}
	cout<<"Yes"<<endl;
	return 0;
}


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

int main(void)
{
    int N, A, B, C, D;
    string S;
    cin >> N >> A >> B >> C >> D >> S;

    for (int i = A-1; i < C-1; i++)
    {
        if(S[i] == S[i+1] && S[i] == '#'){
            cout << "No" << endl;
            return 0;
        }
    }

    for (int i = B-1; i < D-1; i++)
    {
        if(S[i] == S[i+1] && S[i] == '#'){
            cout << "No" << endl;
            return 0;
        }
    }

    if(C < D){
        cout << "Yes" << endl;
    } else {
        bool ok = false;
        for(int i = B-1; i <=D-1; i++){
            if(S[i] == '.' && S[i-1] == '.' && S[i+1] == '.'){
                ok = true;
            }
        }

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

    return 0;
}


Measured memory_bytes: 3748