akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#include<algorithm>
#include<math.h>
#include<string>
#include<iostream>
#include<vector>
#include<cstdlib>
#include<stdio.h>
#include<cmath>
#include<limits>
#include<iomanip>

using namespace std;

template <class T> using V = vector<T>;

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

const long long INF = 1LL << 60;

using ll = long long;
using db = long double;
using st = string;
using ch = char;
using bl = bool;
using vll = V<ll>;
using vpll =V<pair<ll,ll>>;
using vst = V<st>;
using vdb = V<db>;
using vch = V<ch>;
using vbl = V<bl>;
using graph = V<V<int>>;
using pq = priority_queue<ll>;



#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define rFOR(i,a,b) for(ll i=(a);i>=(b);i--)
#define oFOR(i,a,b) for(ll i=(a);i<(b);i+=2)
#define bgn begin()
#define en end()
#define SORT(a) sort((a).bgn,(a).en)
#define REV(a) reverse((a).bgn,(a).en)
#define M(a,b) max(a,b)
#define rM(a,b) min(a,b)
#define fi first
#define se second
#define sz size()
#define gcd(a,b) __gcd(a,b)
#define co(a) cout<<a<<endl;
#define pb(a) push_back(a);



ll Sum(ll n) {
ll m=0;
  while(n){
    m+=n%10;
    n/=10;
  }
  return m;
}



const int MAX = 510000;
const int MOD = 1000000007;
 
long long fac[MAX], finv[MAX], inv[MAX];
 
void Comuse() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}


#define comuse Comuse()

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

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


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


vll div(ll n){
  vll ret;
  for(ll i=1;i*i<=n;i++){
    if(n%i==0){
      ret.push_back(i);
      if(i*i!=n){
        ret.push_back(n/i);
      }
    }
  }
  SORT(ret);
  return (ret);
}

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

    a=a*a%mod;
    
    n>>=1;
  }

  return ans;
}

void Solve();


const int MAX_N = 131072;
//segment tree 
int NN;
int seg[MAX_N*2-1];
void seguse(){
  for(int i=0;i<2*NN-1;i++){
    seg[i]=INT_MAX;
  }
}

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


/****************************************\
| Thank you for viewing my code:)        |
| Written by RedSpica a.k.a. RanseMirage |
| Twitter:@asakaakasaka                  | 
\****************************************/
//segtreeの葉の先頭の添え字はn-1
void Solve(){
  //vll segtree(524287);
  //ll N=262144;
  st s;
    cin>>s;
  ll p=0;
  ll n=s.sz;
  FOR(i,0,n){
    if(s[i]=='p'){
      p++;
    }
  }

  cout<<n/2-p<<"\n";
}

Measured memory_bytes: 512
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <regex>
#include <numeric>
using namespace std;

/*--- Macro ---*/
#define rep(i, n) for(int i=0; i<(int)n; i++)
#define rep1(i, n) for(int i=1; i<(int)n; i++)
#define mp make_pair
#define pb push_back
#define all(a) a.begin(), a.end()

/*---  Type ---*/
typedef long long ll;

/*--- Constants ---*/
template <typename T> const T INF = numeric_limits<T>::max() / 10;
const int MOD = (int)1e9 + 7;

// Floating
const double EPS = 1e-11;
#define EQ0(x) (abs(x) < EPS)
#define EQ(x, y) (abs(a-b) < EPS)

// Util
int max(int a, int b, int c) {return max(a, max(b, c));}
int min(int a, int b, int c) {return min(a, min(b, c));}
ll max(ll x, ll y) {return x > y ? x : y;}
ll min(ll x, ll y) {return x < y ? x : y;}
ll max(ll a, ll b, ll c) {return max(a, max(b, c));}
ll min(ll a, ll b, ll c) {return min(a, min(b, c));}

// -------------------------------------------------------------------------------------



int main() {
  int n, a;
  cin >> n >> a;
  if((n % 500) <= a) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 256
fun main(args: Array<String>) {
    val (H, W) = listOfInt()
    val S = Array(H) { next() }
    val dp = Array(H) { IntArray(W) { 1000000007 } }
    repeat (H) { h ->
        repeat (W) { w ->
            if (h + w == 0) {
                dp[0][0] = (S[0][0] == '#').toInt()
            } else {
                if (h > 0) dp[h][w] = Math.min(dp[h][w], dp[h - 1][w] + (S[h - 1][w] == '.' && S[h][w] == '#').toInt() )
                if (w > 0) dp[h][w] = Math.min(dp[h][w], dp[h][w - 1] + (S[h][w - 1] == '.' && S[h][w] == '#').toInt() )
            }
        }
    }
    println(dp[H - 1][W - 1])
}
fun Boolean.toInt() = if (this) 1 else 0
fun next() = readLine()!!
fun nextInt() = Integer.parseInt(next())
fun nextInt(offset: Int = 0) = nextInt() + offset
fun nextLong() = java.lang.Long.parseLong(next())
fun nextLong(offset: Long = 0L) = nextLong() + offset
fun nextDouble() = next().toDouble()
fun listOfString() = next().split(" ")
fun listOfInt() = listOfString().map { Integer.parseInt(it) }
fun listOfInt(offset: Int = 0) = listOfString().map { Integer.parseInt(it) + offset }
fun listOfLong() = listOfString().map { java.lang.Long.parseLong(it) }
fun listOfLong(offset: Long = 0L) = listOfString().map { java.lang.Long.parseLong(it) + offset }
fun listOfDouble() = listOfString().map { it.toDouble() }


Measured memory_bytes: 38000
#include <stdio.h>
int main(void)
{
  int n, l;
  scanf("%d%d", &n, &l);
  
  if(l<=0&&0<=l+n-1)
    printf("%d", (n*n+(2*l-1)*n)/2);
  else if(l>0)
    printf("%d", (n*n+(2*l-1)*n)/2-l);
  else
    printf("%d", (n*n+(2*l-1)*n)/2-l-n+1);
  return 0;
}

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

using namespace std;

struct UnionFind
{
  vector< int > data;

  UnionFind(int sz)
  {
    data.assign(sz, -1);
  }

  void unite(int x, int y)
  {
    x = find(x), y = find(y);
    if(x != y) {
      if(data[x] > data[y]) swap(x, y);
      data[x] += data[y];
      data[y] = x;
    }
  }

  int find(int k)
  {
    if(data[k] < 0) return (k);
    return (data[k] = find(data[k]));
  }

  int size(int k)
  {
    return (-data[find(k)]);
  }
};

vector< int > g[100000];
bool v[100000];
int black, white;

void dfs(int idx, bool pre)
{
  if(v[idx]++) return;
  if(pre) ++black;
  else ++white;
  for(auto &to : g[idx]) dfs(to, 1 - pre);
}

int main()
{
  int V, E;
  cin >> V >> E;
  UnionFind tree(V + V);
  for(int i = 0; i < E; i++) {
    int a, b;
    cin >> a >> b;
    --a, --b;
    g[a].push_back(b);
    g[b].push_back(a);
    tree.unite(a + V, b);
    tree.unite(a, b + V);
  }

  for(int i = 0; i < V; i++) {
    if(tree.find(i) == tree.find(i + V)) {
      cout << -1 << endl;
      return (0);
    }
  }

  bitset< 50001 > dp;
  dp[0] = 1;

  for(int i = 0; i < V; i++) {
    if(v[i]) continue;
    black = white = 0;
    dfs(i, 0);
    dp = (dp << black) | (dp << white);
  }

  long long ret = 0;
  for(int i = 0; i <= V / 2; i++) {
    if(dp[i]) ret = max(ret, 1LL * i * (V - i));
  }
  cout << ret - E << endl;
}

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

using namespace std;

string S;

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cin >> S;
    if(S == "ABC") {
        cout << "ARC\n";
    }
    else {
        cout << "ABC\n";
    }

    return 0;
}


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

using namespace std;

using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int ddx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll MOD = 1000000007;
const ll INF = 1000000000000000000L;
#ifdef __DEBUG

/**
 * For DEBUG
 * https://github.com/ta7uw/cpp-pyprint
 */
#include "cpp-pyprint/pyprint.h"

#endif

void solve() {
    ll N;
    cin >> N;
    string S;
    cin >> S;
    ll r = 0, g = 0, b = 0;
    rep(i, N) {
        if (S[i] == 'R') r++;
        if (S[i] == 'G') g++;
        if (S[i] == 'B') b++;
    }
    ll ans = r * g * b;
    rep(i, N) {
        rep2(j, i + 1, N) {
            ll k = 2 * j - i;
            if (k >= 0 && k < N && S[i] != S[j] && S[j] != S[k] && S[i] != S[k]) ans--;
        }
    }
    cout << ans << '\n';
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    solve();
    return 0;
}


Measured memory_bytes: 3656
N = int(input())
Sum = 0
flag = False
for i in range(N):
    a, b = map(int, input().split())
    if a == b:
        Sum += 1
    else:
        Sum = 0
    if Sum == 3:
        flag = True

if flag:
    print("Yes")

else:
    print("No")


Measured memory_bytes: 62264
import sys
input = sys.stdin.readline
N = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
res = 0
ln = max(max(a), max(b)).bit_length() + 1
for i in range(ln):
  y = (1 << (i + 1))
  u = [x % y for x in a]
  v = [x % y for x in b]
  y >>= 1
  u.sort(reverse = True)
  v.sort()
  t = 0
  k = 0
  kk = 0
  for x in u:
    while k < N and x + v[k] < y: k += 1
    t += N - k
    while kk < N and x + v[kk] < y * 2: kk += 1
    t -= N - kk
  k = 0
  kk = 0
  #print(t)
  for x in u:
    while k < N and x + v[k] < y * 2 + y: k += 1
    t += N - k
    while kk < N and x + v[kk] < y * 4: kk += 1
    t -= N - kk
    #print(t)
  #print(u, v, t)
  res ^= t % 2 * y
print(res)


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

typedef long long ll;
typedef long double ld;

const int inf = 1e9;

int main(){
  int n;
  cin>>n;
  string s;
  cin>>s;
  ll t, r, g, b;
  r = g = b = t = 0;
  for(int i = 0; i < n; ++i){
    if(s[i]=='R')r++;
    if(s[i]=='G')g++;
    if(s[i]=='B')b++;       
    for(int j = i + 1; j < n; ++j){
      if(s[i] != s[j]){
	int d = j - i;
	if(j + d < n && s[j + d] != s[i] && s[j+d] != s[j])t++;
      }
    }
  }
  cout<<r * g * b - t<<endl;
  return 0;
}




Measured memory_bytes: 3640
def resolve():
    A, B = list(map(int, input().split()))
    K = 50
    grid = [["." for _ in range(2*K)] for __ in range(K)]
    grid += [["#" for _ in range(2*K)] for __ in range(K)]
    acnt = 1
    bcnt = 1
    for i in range(0, K-1):
        if bcnt >= B:
            break
        for j in range(2*K):
            for di, dj in [[-1, 0], [1, 0], [0, 1], [0, -1], [-1, -1], [-1, 1], [1, -1], [1, 1]]:
                if 0 <= i+di <= 2*K-1 and 0 <= j+dj <= 2*K-1:
                    if grid[i+di][j+dj] == "#":
                        break
            else:
                grid[i][j] = "#"
                bcnt += 1
                if bcnt >= B:
                    break
    
    for i in range(K+1, 2*K):
        if acnt >= A:
            break
        for j in range(2*K):
            for di, dj in [[-1, 0], [1, 0], [0, 1], [0, -1], [-1, -1], [-1, 1], [1, -1], [1, 1]]:
                if 0 <= i+di <= 2*K-1 and 0 <= j+dj <= 2*K-1:
                    if grid[i+di][j+dj] == ".":
                        break
            else:
                grid[i][j] = "."
                acnt += 1
                if acnt >= A:
                    break
    print(2*K, 2*K)
    [print("".join(grid[i])) for i in range(2*K)]
    
if '__main__' == __name__:
    resolve()


Measured memory_bytes: 9400
// Optimise
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;

// #define MULTI_TEST
#ifdef LOCAL
#include "/home/shahraaz/bin/debug.h"
#else
#define db(...)
#define pc(...)
#endif

#define f first
#define s second
#define pb push_back
#define all(v) v.begin(), v.end()
auto TimeStart = chrono::steady_clock::now();
auto seed = TimeStart.time_since_epoch().count();
std::mt19937 rng(seed);
using ll = long long;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template <typename T>
using Random = std::uniform_int_distribution<T>;

const int NAX = 2e5 + 5, MOD = 1000000007;

class Solution
{
private:
    int k, q;
    vector<int> d, dd;

public:
    Solution()
    {
        cin >> k >> q;
        d.resize(k);
        dd.resize(k);
        for (auto &x : d)
            cin >> x;
    }
    ~Solution() {}
    void solveCase()
    {
        while (q--)
        {
            int n, x, m;
            cin >> n >> x >> m;
            --n;
            ll s, z;
            s = z = 0;
            for (int i = 0; i < k; ++i)
            {
                dd[i] = d[i] % m;
                s += dd[i];
                if (dd[i] == 0)
                    ++z;
            }
            ll y = x % m + n / k * s;
            int l = n % k;
            z *= n / k;
            for (int i = 0; i < l; ++i)
            {
                y += dd[i];
                if (dd[i] == 0)
                    ++z;
            }
            cout << (n - z - y / m) << '\n';
        }
    }
};

int32_t main()
{
#ifndef LOCAL
    ios_base::sync_with_stdio(0);
    cin.tie(0);
#endif
    int t = 1;
#ifdef MULTI_TEST
    cin >> t;
#endif
    Solution mySolver;
    for (int i = 1; i <= t; ++i)
    {
        mySolver.solveCase();
#ifdef TIME
        cerr << "Case #" << i << ": Time " << chrono::duration<double>(chrono::steady_clock::now() - TimeStart).count() << " s.\n";
        TimeStart = chrono::steady_clock::now();
#endif
    }
    return 0;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
int main(){
  string sa,sb,sc;
  cin>>sa>>sb>>sc;
  char c='a';
  for(int ia=0,ib=0,ic=0;;){
    if(c=='a'){
      if(ia==sa.size()){
        cout<<'A'<<endl;
        break;
      }
      c=sa.at(ia);
      ia++;
      continue;
    }
    if(c=='b'){
      if(ib==sb.size()){
        cout<<'B'<<endl;
        break;
      }
      c=sb.at(ib);
      ib++;
      continue;
    }
    if(c=='c'){
      if(ic==sc.size()){
        cout<<'C'<<endl;
        break;
      }
      c=sc.at(ic);
      ic++;
      continue;
    }
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define PI 3.14159265359
#define NIL (-1)
#define LL long long
using namespace std;
const int64_t MOD = 1e9 + 7;
const int INF = INT_MAX;

int main() {
	int A, B;
	cin >> A >> B;

	if ((B / A) && (B % A == 0)) cout << A + B << endl;
	else cout << B - A << endl;
}

Measured memory_bytes: 3580
#include <iostream>
#include <cmath>
#include <string>
#include <typeinfo>
#include <climits>
#include <algorithm>
#include <cctype>
#include <stdio.h>
#include <cstdlib>
using namespace std;

int main(){
    int a,b;
    cin >> a >>b;
    if(a<=b){
        cout << a;
    }else{
        cout << a-1;
    }
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
#include<algorithm>
#include<cstring>
#include<string>
#include<stdio.h>
#include<map>
#include<vector>
#include<cmath>
#include<iomanip>
#include<queue>
#include<stack>
#include<set>
#define maxn 1000005
#define INF 1e9
#define ll long long
string s;
int main()
{
	cin >> s;
	int ans1 = 0, ans2 = 0, ans3 = 0, ans4 = 0;
	for (int i = 0; i < s.length(); i++) {
		if (s[i] == 'N')ans1++;
		else if (s[i] == 'S')ans2++;
		else if (s[i] == 'W')ans3++;
		else ans4++;
	}
	if ((ans1 && !ans2) || (ans2 && !ans1) || (ans3 && !ans4) || (ans4 && !ans3))cout << "No" << endl;
	else cout << "Yes" << endl;
	return 0;
}

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

public class Main {

    public static void main(String[] args) throws Exception {
        try (BufferedReader reader = new BufferedReader(new InputStreamReader(System.in))) {
            int N = readInt(reader);
            int[] A = readIntArray(reader);

            StringBuilder sb = new StringBuilder();
            int s = 0;
            for (int i = 0; i < N; i++) {
                if (i == 0) {
                    for (int j = 0; j < N; j++) {
                        if (j % 2 == 0) {
                            s += A[j];
                        } else {
                            s -= A[j];
                        }
                    }
                } else {
                    s = -s + A[(i - 1 + N) % N] * 2;
                }

                sb.append(s).append(" ");
            }

            sb.delete(sb.length() - 1, sb.length());
            System.out.println(sb.toString());
        }
    }

    public static int readInt(BufferedReader reader) throws Exception {
        return Integer.parseInt(reader.readLine());
    }

    public static int[] readIntArray(BufferedReader reader) throws Exception {
        String[] str = reader.readLine().split(" ");
        int[] array = new int[str.length];
        for (int i = 0; i < str.length; i++) {
            array[i] = Integer.parseInt(str[i]);
        }
        return array;
    }

}


Measured memory_bytes: 48012
#include <iostream>
#include <utility>
#include <queue>
#include <vector>
#include <stack>
#include <list>
#include <map>
#include <set>
#include <algorithm>

using namespace std;

typedef long long ll;

int main() {
	ll n, d, a, r,c;
	r = c = 0;
	vector<pair<ll, ll>> xh;
	cin >> n >> d >> a;
	xh.resize(n);
	for (auto& e : xh) cin >> e.first >> e.second;
	sort(xh.begin(), xh.end());
	priority_queue<pair<ll, ll>, deque<pair<ll, ll>>, greater<>> q;
	for (auto& e : xh) {
		while (!q.empty() && (q.top()).first < e.first) {
			c -= q.top().second;
			q.pop();
		}
		ll v = (e.second + (a - 1)) / a - c;
		if (v <= 0) continue;
		r += v;
		c += v;
		q.emplace(e.first + d * 2, v);
	}
	cout << r << endl;
}

Measured memory_bytes: 4992
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, start, n) for (int i = (int)(start); i < (int)(n); ++i)
static const int INFTY = (1 << 30);
int N, M;
void func()
{
    string ss, t;
    cin >> ss;
    cin >> t;
    bool check;
    vector<string> ans;
    rep(i, 0, ss.size() - t.size() + 1)
    {
        check = true;
        rep(j, 0, t.size())
        {
            if (ss[i + j] != '?' && ss[i + j] != t[j])
            {
                check = false;
                break;
            }
        }
        if (check)
        {
            string tmp = ss;
            rep(j, 0, t.size())
            {
                tmp[i + j] = t[j];
            }
            rep(k, 0, tmp.size())
            {
                if (tmp[k] == '?')
                    tmp[k] = 'a';
            }
            ans.push_back(tmp);
        }
    }
    if (!ans.size())
        cout << "UNRESTORABLE" << endl;
    else
    {
        string min = ans[0];
        rep(i, 0, ans.size())
        {
            min = ans[i] < min ? ans[i] : min;
        }
        cout << min << endl;
    }
}
int main()
{
    func();
}

Measured memory_bytes: 3576
#include <cstdio>
#include <cstdlib>
#include <cassert>
#include <algorithm>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#define repi(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,a) repi(i,0,a)
#define all(a) (a).begin(), (a).end()

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

using ll = long long;
using PQue = std::priority_queue<ll, std::vector<ll>, std::greater<ll>>;

ll N, M;
ll a[100010];
std::vector<ll> G[100010];
bool used[100010];

void dfs( ll v, PQue &pque )
{
  used[v] = true;

  pque.push( a[v] );

  for( auto u : G[v] ) if( !used[u] )
    dfs( u, pque );

  return;
}

PQue gque;
ll ans;

int main()
{
  std::cin >> N >> M;
  
  rep( i, N )
    std::cin >> a[i];

  rep( i, M )
  {
    ll x, y;
    std::cin >> x >> y;
    
    G[x].emplace_back( y );
    G[y].emplace_back( x );
  }

  if( 2*(N-M-1) < 0 )
  {
    std::cout << "Impossible" << std::endl;

    return 0;
  }

  ll cnt = 0;

  rep( i, N ) if( !used[i] )
  {
    PQue pque;

    dfs( i, pque );

    ans += pque.top(); pque.pop();

    ++cnt;

    while( !pque.empty() )
    {
      ll x = pque.top(); pque.pop();

      gque.push( x );
    }
  }

  if( cnt == 1 )
  {
    std::cout << 0 << std::endl;

    return 0;
  }

  if( gque.size() < 2*(N-M-1)-cnt )
  {
    std::cout << "Impossible" << std::endl;

    return 0;
  }

  rep( i, 2*(N-M-1)-cnt )
  {
    ll x = gque.top(); gque.pop();

    ans += x;
  }

  std::cout << ans << std::endl;

  return 0;
}

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

int main()
{
	long long A,B,C;
	cin>>A>>B>>C;
	long long maxx=0;
	int index=1;
	
	if(A>=B&&A>=C)
	{
		maxx=A;
		index=1;
	}
		
	if(B>=A&&B>=C)
	{
		maxx=B;
		index=2;
	}
		
	if(C>=A&&C>=B)
	{
		maxx=C;
		index=3;
	}
	
		
		
	if(maxx%2==0)
		cout<<"0"<<endl;
	if(maxx%2==1)
	{
		if(index==1)
			cout<<B*C<<endl;
		if(index==2)
			cout<<A*C<<endl;
		if(index==3)
			cout<<A*B<<endl;	
	}
}

Measured memory_bytes: 256
#include <iostream>

int main()
{
    int a, b;
    std::cin >> a >> b;
    if (a % 2 == 0 or b % 2 == 0) {
        std::cout << "No" << std::endl;
    } else {
        std::cout << "Yes" << std::endl;
    }
    return 0;
}

Measured memory_bytes: 256
import sys
input = sys.stdin.readline

def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

def main():
    import queue
    mod=10**9+7
    N,K=MI()

    #0~Nまで逆元などを事前計算

    def calc(n, r, mod):
        if (r < 0) or (n < r):
            return 0
        return (fact[n] * factinv[n-r])%mod

    fact=[1,1]
    factinv=[1,1]
    inv=[0,1]

    for i in range(2, 10**5+5 + 1):
        fact.append((fact[-1] * i) % mod)
        inv.append((-inv[mod % i] * (mod // i)) % mod)
        factinv.append((factinv[-1] * inv[-1]) % mod)
    
    adj=[[]for _ in range(N)]
    for i in range(N-1):
        a,b=MI()
        a-=1
        b-=1
        adj[a].append(b)
        adj[b].append(a)
    
    #子要素を全部いっぺんに塗る
    ans=K#根の塗り方
    
    q=queue.Queue()
    q.put((0,0,-1))
    
    while not q.empty():
        v,d,p=q.get()
        cnt=0#子の個数
        for nv in adj[v]:
            if nv!=p:
                cnt+=1
                q.put((nv,d+1,v))
            
        if cnt!=0:#葉以外の場合は計算
            np=2#親方向で気にすべき個数
            if d==0:
                np=1#根の親はいない
                
            ans=(ans*calc(K-np,cnt,mod))%mod
        
    print(ans)

        
    

main()


Measured memory_bytes: 104432
#include<iostream>
#include<algorithm>
using namespace std;
int i[5];
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int a,b,c,d,e,f;
  cin >>a>>b;
  c=a+b,d=a-b,e=a*b;
  cout <<max(c,max(d,e))<<'\n';
  return(0);
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0,i##_max=(N);i<i##_max;++i)
#define repp(i,l,r) for(int i=(l),i##_max=(r);i<i##_max;++i)
#define per(i,N) for(int i=(N)-1;i>=0;--i)
#define perr(i,l,r) for(int i=r-1,i##_min(l);i>=i##_min;--i)
#define all(arr) (arr).begin(), (arr).end()
#define SP << " " <<
#define SPF << " "
#define SPEEDUP cin.tie(0);ios::sync_with_stdio(false);
#define MAX_I INT_MAX //1e9
#define MIN_I INT_MIN //-1e9
#define MAX_UI UINT_MAX //1e9
#define MAX_LL LLONG_MAX //1e18
#define MIN_LL LLONG_MIN //-1e18
#define MAX_ULL ULLONG_MAX //1e19
  typedef long long ll;
  typedef pair<int,int> PII;
  typedef pair<char,char> PCC;
  typedef pair<ll,ll> PLL;
  typedef pair<char,int> PCI;
  typedef pair<int,char> PIC;
  typedef pair<ll,int> PLI;
  typedef pair<int,ll> PIL; 
  typedef pair<ll,char> PLC; 
  typedef pair<char,ll> PCL; 

inline void YesNo(bool b){ cout << (b?"Yes" : "No") << endl;}
inline void YESNO(bool b){ cout << (b?"YES" : "NO") << endl;}
inline void Yay(bool b){ cout << (b?"Yay!" : ":(") << endl;}

int main(void){
  SPEEDUP
  cout << setprecision(15);
  ll A,B,C;cin >> A >> B >> C;
  if(A*B%2==0 || C%2==0) cout << 0 << endl;
  else cout << min({A*B,B*C,C*A}) << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF (2e9)

int main() {
  vector<vector<int>> bcard(3, vector<int>(3));
  int tmp;
  for(int i = 0; i < 3; ++i) {
    for(int j = 0; j < 3; ++j) {
      cin >> tmp;
      bcard[i][j] = tmp;
    }
  }

  int n; cin >> n;
  
  for(int k = 0; k < n; ++k) {
    cin >> tmp;
    for(int i = 0; i < 3; ++i) {
      for(int j = 0; j < 3; ++j) {
        if(tmp == bcard[i][j]) bcard[i][j] = -1;
      }
    }
  }

  string ans = "No";
  for(int i = 0; i < 3; ++i) {
    if(bcard[i][0] == -1 && bcard[i][1] == -1 && bcard[i][2] == -1) ans = "Yes";
  }

  for(int i = 0; i < 3; ++i) {
    if(bcard[0][i] == -1 && bcard[1][i] == -1 && bcard[2][i] == -1) ans = "Yes"; 
  }  

  if(bcard[0][0] == -1 && bcard[1][1] == -1 && bcard[2][2] == -1) ans = "Yes";
  if(bcard[0][2] == -1 && bcard[1][1] == -1 && bcard[2][0] == -1) ans = "Yes";

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 256
import sys

n,k=map(int,input().split())
d=list(map(int,input().split()))
count=0

for i in range(n,1000000000):
  for j in range(len(str(i))):
    if str(i)[j] in str(d):
      break
      
    else:
      count+=1
      
  if count==len(str(i)):
    print(i)
    sys.exit()
  count=0

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

import bisect, collections, copy, heapq, itertools, math, numpy, string
import sys


def S():
    return sys.stdin.readline().rstrip()


def I():
    return int(sys.stdin.readline().rstrip())


def LI():
    return list(map(int, sys.stdin.readline().rstrip().split()))


def LS():
    return list(sys.stdin.readline().rstrip().split())


def main():
    a, b, c, k = LI()
    sum = 0
    # print(a, b, c, k)
    if a >= k:
        sum = sum + k
        k = 0
    else:
        sum = sum + a
        k = k - a
    # print("xxx", a, b, c, k, sum)
    if k > 0:
        if b >= k:
            k = 0
        else:
            k = k - b
    # print("yyy", a, b, c, k, sum)
    if k > 0:
        if c >= k:
            sum = sum - k
            k = 0
        else:
            sum = sum - c
            k = k - c
    # print("zzz", a, b, c, k, sum)
    print(sum)


main()


Measured memory_bytes: 27208
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.InputMismatchException;
import java.io.OutputStream;
import java.util.StringTokenizer;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.HashMap;
import java.util.Map;
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
import java.math.BigDecimal;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Task solver = new Task();
        solver.solve(1, in, out);
        out.close();
    }

    static class Task {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int N = in.nextInt();
            int a[] = {1,2,4,8,16,32,64};
            int res=0;
            for(int i=0; i<7; i++){
                if(N>=a[i]){
                    res = a[i];
                }
            }
            out.println(res);
            
        }
    }


    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public long nextLong() {
            return Long.parseLong(next());
        }

    }
}

Measured memory_bytes: 23252
import sys

stdin = sys.stdin

ns = lambda: stdin.readline().rstrip()
ni = lambda: int(stdin.readline().rstrip())
nm = lambda: map(int, stdin.readline().split())
nl = lambda: list(map(int, stdin.readline().split()))

n = ni()
a = nl()
a = filter(lambda x:x%2==0, a)
print('APPROVED' if all((x%3)*(x%5)==0 for x in a) else 'DENIED')


Measured memory_bytes: 3060
N = int(input())
L = list(map(int,input().split()))

cnt = 0

c = []
for i in range(N):
    c.append(L[i] - (i + 1))

c.sort()
if N % 2 == 0:
    b = (c[N // 2] + c[N // 2 - 1]) / 2
else:
    b = c[N // 2]
for i in range(N):
    cnt += abs(L[i] - (b + i + 1))
print(int(cnt))


Measured memory_bytes: 25196
#include <bits/stdc++.h> 
using namespace std; 
typedef long long int ll;
typedef long double ld;
typedef unsigned long long int ull;
const long long int m=pow(10,9)+7;

int main() 
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int a, b, c, x, y;
    cin >> a >> b >> c >> x >> y;
    int ca = 0, cb = 0;
    ll ans = 0;
    while (ca < x && cb < y)
    {
    ans += min(2 * c, a + b);
    ca++;
    cb++;
    }
    while (ca < x)
    {
    ans += min(2 * c, a);
    ca++;
    }
     while (cb < y)
    {
    ans += min(2 * c, b);
    cb++;
    }
    cout << ans << endl;
    return 0;
}

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

using namespace std;

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

    int n, m;
    std::cin >> n >> m;
    std::vector<int> a(n);
    for (auto& v : a)
    {
        std::cin >> v;
    }
    auto sum = std::accumulate(a.begin(), a.end(), 0);
    int cnt{0};
    for (int i = 0; i < n && cnt < m; ++i)
    {
        if (a[i] * 4 * m >= sum)
        {
            ++cnt;
        }
    }
    std::cout << (cnt >= m ? "Yes" : "No") << "\n";
    return 0;
}

Measured memory_bytes: 256
using System;
namespace q1
{
    class q2
    {
        static void Main()
        {
            string[] x = Console.ReadLine().Split();
            if(x[0]==x[1]&&x[1]==x[2]||x[0]!=x[1]&&x[1]!=x[2]&&x[0]!=x[2])
            {
                Console.WriteLine("No");
            }
            else
            {
                Console.WriteLine("Yes");
            }
        }
    }
}


Measured memory_bytes: 25788
#include <iostream>
#include <set>
#include <functional>

using namespace std;

int main()
{
	int N;
	cin >> N;
	multiset<int, greater<>> A;

	for (int i = 0; i < N; ++i) {
		int x;
		cin >> x;
		A.insert(x);
	}

	int ans = 0;
	while (!A.empty()) {
		int x = *A.begin();
		int s = 1;
		while (s <= x) {
			s *= 2;
		}
		A.erase(A.begin());
		auto it = A.find(s - x);
		if (it != A.end()) {
			A.erase(it);
			++ans;
		}
	}
	cout << ans << endl;
}


Measured memory_bytes: 9600
#include<bits/stdc++.h>
using namespace std;
#define INF 1e9

int main(){
    int N, M;
    long long ans = 0;
    cin >> N >> M;
    vector<int> A(N);
    pair<int, int> CB[M];
    
    priority_queue<int, vector<int>, greater<int>> desc;
    for(int i=0; i<N; i++){
	cin >> A[i];
	desc.push(A[i]);
    }

    for(int i=0; i<M; i++)
	cin >> CB[i].second >> CB[i].first;
    sort(CB, CB+M);
    for(int i=M-1; i>=0; i--){
	if(CB[i].first <desc.top())
	    break;
	
	for(int j=0; j<CB[i].second; j++){
	    if(desc.top() < CB[i].first){
		desc.pop();
		desc.push(CB[i].first);
	    }
	    else break;
	}	
    }
    
    while(!desc.empty()){
	ans +=  desc.top();
	desc.pop();
    }
    cout << ans << endl;
}



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

int main()
{
	int L, N;
	cin >> N >> L;
	vector <string> vec(N);
	for (int i = 0; i < N; i++)
	{
		cin >> vec.at(i);
	}

	sort(vec.begin(), vec.end());
	
	for (int j = 0; j < N; j++)
	{
		cout << vec.at(j);
	}


}

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

#define loop(i,a,b) for(ll i=a; i<b; i++)
#define rloop(i,a,b) for(ll i=a; i>b; i--)
#define all(var) var.begin(), var.end()
#define eloop(var) for(auto elem : var)
#define debug(x) cerr<<#x<<" ----> "<<x<<endl;
#define TC ll tt; cin>>tt; while(tt--)
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define SET(a) memset(a,-1,sizeof(a))
#define CLR(a) memset(a, 0, sizeof(a))
#define INF 0x7fffffff
#define LINF 2000000000000000007
#define MOD 1000000007
#define MAX 100005
typedef long long ll;
typedef long double ld;

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

    // TC
    {
        string s;
        cin>>s;
        cout<<s[0]<<s[1]<<s[2]<<'\n';
        
    }
    return 0;
}

Measured memory_bytes: 3652
a = int(input())
b = int(input())
c = int(input())
x = int(input())
count = 0
for i in range(a + 1):
    for j in range(b + 1):
        for k in range(c + 1):
            if x == 500 * i + 100 * j + 50 * k:
                count += 1
print(count)

Measured memory_bytes: 3060
#include <iostream>
#define N 30
#define N1 1000001
using namespace std;
void DP();
int n,x,c[N];
bool prime[N1];
int main(){
  int i,j;
  for(i=0;i<=N1;i++) prime[i]=true;
  prime[0]=prime[1]=false;
  for(i=0;i<N1;i++){
    if(prime[i]==true){
      for(j=i*2;j<N1;j+=i){
	prime[j]=false;
      }
    }
  }
  while(1){
    cin >> n >> x;
    if(n==0&&x==0) break;
    for(i=0;i<n;i++){
      cin >> c[i];
    }
    DP();
  }
  return 0;
}
void DP(){
  int dp[N1],flag,ans,i,j;
  for(i=0;i<N1;i++) dp[i]=0;
  dp[0]=1;
  for(i=1;i<N1;i++){
    if(i%c[0]==0) dp[i]=1;
  }
  for(i=1;i<n;i++){
    for(j=1;j<N1;j++){
      if(dp[j]==0&&j>=c[i]){
	if(dp[j-c[i]]==1) dp[j]=1;
      }
    }
  }
  flag=0;
  for(i=x;i>=1;i--){
    if(dp[i]==1&&prime[i]==true){
      ans=i;
      flag=1;
      break;
    }
  }
  if(flag==1) cout << ans << endl;
  else cout << "NA" << endl;
}

Measured memory_bytes: 6040
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		long count = 0;
		for (int i = 1; i <= n; i++) {
			if (i % 3 == 0 || i % 5 == 0) {
				continue;
			}
			count += i;
		}
		System.out.println(count);
	}
}


Measured memory_bytes: 35788
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

a = [list(map(int, readline().split())) for i in range(3)]
n = int(readline())
b = [int(readline()) for _ in range(n)]
for bb in b:
    for j in range(3):
        for k in range(3):
            if a[j][k] == bb:
                a[j][k] = 0
ans = 'No'
for i in range(3):
    if a[i][0] == a[i][1] == a[i][2] == 0:
        ans = 'Yes'
    if a[0][i] == a[1][i] == a[2][i] == 0:
        ans = 'Yes'
if a[0][0] == a[1][1] == a[2][2] == 0:
    ans = 'Yes'
if a[2][0] == a[1][1] == a[0][2] == 0:
    ans = 'Yes'
print(ans)


Measured memory_bytes: 3064
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <random>
#include <bitset>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
typedef long long ll;
using namespace std;

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

    if (a > b) {
        cout << 0 << "\n";
    } else if (n == 1) {
        cout << (b == a ? 1 : 0) << "\n";
    } else {
        cout << (a + (n - 1) * b) - ((n - 1) * a + b) + 1 << "\n";
    }
    return 0;
}

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

using lint = long long;

constexpr lint INF = 1LL << 60;

void solve() {
    int n;
    std::cin >> n;

    std::vector<std::pair<lint, lint>> ps(n);
    for (auto& p : ps) std::cin >> p.first >> p.second;
    std::sort(ps.begin(), ps.end());

    lint ans = 0, min = INF, vsum = 0;
    for (int r = 0; r < n; ++r) {
        min = std::min(min, vsum - ps[r].first);
        vsum += ps[r].second;
        ans = std::max(ans, vsum - ps[r].first - min);
    }

    std::cout << ans << std::endl;
}

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

    solve();

    return 0;
}



Measured memory_bytes: 10764
#include <bits/stdc++.h>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<cstdlib>
#include<string.h>
using namespace std;
#define pb push_back
#define all(v) v. begin(),v. end()
#define  rep(i,n,v) for(i=n;i<v;i++)
#define per(i,n,v) for(i=n;i>v;i--)
#define ff first 
#define ss second 
#define pp pair<ll,ll>
#define ll  long long
#define endl '\n'
void solve()
{
  ll n, a,m=0,b=1, c,k=0, i, j,l=1e9+7;
  string s, r, y;
  cin>>s>>r;
  k=r.length();
  rep(i,0,s.length())
  {
    m=i;
    c=0;
    b=0;
    rep(j,0,r.length())
    {
      if(m>=s.length()) break;
      if(s[m]==r[j]) c++;
      else b++;
      m++;
    }
//    cout<<b<<" "<<c<<endl;
   if(b+c==r. length())
    k=min(b,k);
  }
  cout<<k;
} 
int main()
{
 ios_base::sync_with_stdio(false);
  cin. tie(0);cout. tie(0);
    ll t=1;
  // cin>>t;
    while(t--)
    {
      solve();
    }
    return 0;
}

Measured memory_bytes: 3524
def judge(L,i,j):
    a=0
    if L[i][j]=="#":
        a= (L[i-1][j]!="#" and L[i+1][j]!="#"
        and L[i][j-1]!="#" and L[i][j+1]!="#")
    return a

h,w=map(int,input().split())
A=[input() for _ in range(h)]
ans=0

for i in range(h):
    A[i]="/" + A[i] + "/"
 
A.insert(0, ['/']*(w+2))
A.append(['/']*(w+2))

for i in range(h+2):
    for j in range(w+2):
        if judge(A,i,j)==1:
            ans=1

print("Yes" if ans==0 else "No")



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

using namespace std;
int main(){
  long n;
   cin >>n;
   vector<long> h(n+2);
  const long inf=1000000000;
   h[0]=0;
  for(int i=1;i<=n;i++) cin >> h[i];
   h[n+1]=inf;
  
  if(n==1) { cout << "Yes" << endl;
             return 0;
  }
 
  for(long i=1;i<=n;i++){
   if(h[i]>h[i+1]) h[i]--;
   else if(h[i]==h[i+1]&&h[i]>h[i-1]) h[i]--;
  }
  
  bool flag=true;
  for(long i=0;i<n-1;i++){
   if(h[i]>h[i+1]) flag=false;
  }
 
  if(flag) cout << "Yes" << endl;
  else cout << "No" << endl;
}


Measured memory_bytes: 1024
#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>
#include <iomanip>
#include <limits>
#include <list>
#include <queue>
#include <tuple>
#include <map>
#include <stack>
#include <set>
using namespace std;
#define MOD (long long int)(1e9+7)
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
#define REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define INF (int)(1123456789)
#define LINF (long long int)(112345678901234567)
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
#define all(v) v.begin(), v.end()

const int N = (int)3e5;

ll mpow(ll a, ll b){
  if(b==0) return 1;
  else if(b%2==0){ll memo = mpow(a,b/2); return memo*memo%MOD;}
  else return mpow(a,b-1) * a % MOD;
}
ll lpow(ll a, ll b){
  if(b==0) return 1;
  else if(b%2==0){ll memo = lpow(a,b/2); return memo*memo;}
  else return lpow(a,b-1) * a;
}
ll gcd(ll a, ll b){
  if(b==0) return a;
  else return gcd(b, a%b);
}
vector<ll> kaijo_memo;
ll kaijo(ll n){
  if(kaijo_memo.size() > n) return kaijo_memo[n];
  if(kaijo_memo.size() == 0) kaijo_memo.push_back(1);
  while(kaijo_memo.size() <= n) kaijo_memo.push_back(kaijo_memo[kaijo_memo.size()-1] * kaijo_memo.size() % MOD);
  return kaijo_memo[n];
}
vector<ll> gyaku_kaijo_memo;
ll gyaku_kaijo(ll n){
  if(gyaku_kaijo_memo.size() > n) return gyaku_kaijo_memo[n];
  if(gyaku_kaijo_memo.size() == 0) gyaku_kaijo_memo.push_back(1);
  while(gyaku_kaijo_memo.size() <= n) gyaku_kaijo_memo.push_back(gyaku_kaijo_memo[gyaku_kaijo_memo.size()-1] * mpow(gyaku_kaijo_memo.size(), MOD-2) % MOD);
  return gyaku_kaijo_memo[n];
}

ll nCr(ll n, ll r){
  if(n == r) return 1;//0個の丸と-1個の棒みたいな時に時に効く？不安.
  if(n < r || r < 0) return 0;
  ll ret = 1;
  ret *= kaijo(n); ret %= MOD;
  ret *= gyaku_kaijo(r); ret %= MOD;
  ret *= gyaku_kaijo(n-r); ret %= MOD;
  return ret;
}


int main(void){
  string s;cin>>s;
  string ans[3] = {"Sunny", "Cloudy", "Rainy"};
  rep(i,3){
    if(ans[i] == s){
      cout<<ans[(i+1)%3]<<endl;
      return 0;
    }
  }
  return 0;
}


Measured memory_bytes: 384
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<climits>
#include<iostream>
#include<sstream>
#include<utility>
#include<map>
#include<vector>
#include<queue>
#include<algorithm>
#include<set>
#include<stack>
using namespace std;
typedef long long ll;
typedef pair<int,int>P;

int main()
{
	int N,T,res=1000000;
	scanf("%d%d",&N,&T);
	for(int i=0;i<N;i++)
	{
		int c,t;
		scanf("%d%d",&c,&t);
		if(t<=T)res=min(res,c);
	}
	if(res==1000000)puts("TLE");
	else printf("%d\n",res);
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n,ans;
int main(){
	cin>>n;
   for(int i=1;i<=n;i++)
   {
   	  int sum=0;
   	  int j=i;
   	  while(j)
   	  {
   	  	  sum++;
   	  	 j=j/10;	
   	  }
   	  if(sum%2==1)ans++;
   }
cout<<ans;
}

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

int main() {
  int N, check;
  cin >> N;
  check = 0;
  vector<string> words(N);
  for(int i=0;i<N;i++){
    cin >> words.at(i);
  }  
  
  for(int i=1;i<N;i++){
    if(check == 1){
      break;
    }  
    for(int j=0;j<i;j++){
      if(words.at(j)==words.at(i)){
        check = 1;
        break;
      }  
    }  
    int last = words.at(i-1).size() -1;
    
    if(words.at(i-1).at(last) != words.at(i).at(0)){
      check = 1;
    }
  }  
   
  
  if(check == 0){
    cout << "Yes" <<endl;
  }  
  else{
    cout << "No" <<endl;
  }  
  
  return 0;
}


Measured memory_bytes: 256
n = int(input())
rest = []
for i in range(n):
    c = input().split()
    a = []
    a.append(c[0])
    b = int(c[1])
    a.append(b)
    a.append(i+1)
    rest.append(a)

rest.sort(key = lambda x: (x[0],-x[1]))
for i in range(len(rest)):
    print(rest[i][2])

Measured memory_bytes: 3064
#include<stdio.h>

int main(){

    int n,m,i,j,sum;
    sum = 0;
    scanf("%d%d",&n,&m);

    //printf("%d%d",n,m);


    int arry[101][101];
    int arrycolum[101];

    for(i = 0; i < n; i++){
        for(j = 0; j < m; j++){
            scanf("%d",&arry[i][j]);
        }

    }

    for(j = 0; j < m; j++){
        scanf("%d",&arrycolum[j]);
    }



    for(i = 0; i < n; i++){
        for(j = 0; j < m; j++){
            sum += arry[i][j] * arrycolum[j];
        }
        printf("%d\n",sum);
        sum = 0;

    }

    return 0;

}


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

// templates -------------------------------------

#define ULL unsigned long long
#define LL long long
#define LLD long long double
#define REP(i, n) for(LL i = 0; i < n; i++)
#define INV_REP(i, n) for(LL i = n; 0 <= i; i--)

LL combination(LL n, LL m)
{
  LL nume = 1;
  REP(i, m) nume *= (n-i);
  LL demo = 1;
  for(int i = 1; i <= m; i++) demo *= i;
  return nume / demo;
}

template<class T>
class UnionFind
{
private:
  vector<T> par;
  vector<T> rank;
  vector<T> size;

public:
  UnionFind(T N) :
    par(N, T()), rank(N, T()), size(N, T())
  {
    REP(i, N)
    {
      par[i] = i;
      rank[i] = 0;
      size[i] = 1;
    }
  }

  inline T root(T x)
  {
    return par[x] == x ? x : par[x] = root(par[x]);
  }

  inline bool same(T x, T y)
  {
    return root(x) == root(y);
  }

  inline T getSize(T x)
  {
    return size[root(x)];
  }

  void unite(T x, T y)
  {
    T r1 = root(x);
    T r2 = root(y);
    if(r1 == r2) return;

    if(rank[r1] < rank[r2]) swap(r1, r2);
    if(rank[r1] == rank[r2]) rank[r1]++;
    par[r2] = r1;
    size[r1] += size[r2];
  }
};

// --------------------------------------

int s;
int s1, s2;

void input()
{
  cin >> s;
  s1 = s/100;
  s2 = s%100;
}

void solve()
{
  if(s1 == 0 || 12 < s1) // s1 == YY
  {
    if(s2 == 0 || 12 < s2)
    {
      cout << "NA";
      return;
    }
    cout << "YYMM";
    return;
  }
  else if(s2 == 0 || 12 < s2) // s2 == YY
  {
    if(s1 == 0 || 12 < s1)
    {
      cout << "NA";
      return;
    }
    cout << "MMYY";
    return;
  }
  else
  {
    cout << "AMBIGUOUS";
    return;
  }
}

int main()
{
  input();
  solve();
  return 0;
}

Measured memory_bytes: 256
import java.util.*;
import java.io.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s;
        s = sc.next();
        char str[] = s.toCharArray();
        str[3] = '8';
        System.out.println(str);
        sc.close();
    }
}


Measured memory_bytes: 23636
#include <bits/stdc++.h>
using namespace std;
int main(){
    int N;
    cin>>N;
    int a[N];
    for(int i=0;i<N;i++){
        cin>>a[i];
    }
    int M=a[0],m=a[0];
     for(int i=0;i<N;i++){
         if(a[i]<m){m=a[i];}
         if(a[i]>M){M=a[i];}
     }
     cout<<M-m<<endl;
}

Measured memory_bytes: 256
#include<vector>
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>

using namespace std;

const int N = 500005;

int n;

char s[N];

#define fill FILL

int fill[N];

int main() {
	scanf("%s", s);
	n = strlen(s) + 1;
	for (int i = 0; i < n; ++i) {
		if ((i == 0 || s[i - 1] == '>') && (i == n - 1 || s[i] == '<')) {
			fill[i] = 0;
			for (int j = i - 1; s[j] == '>'; --j) {
				fill[j] = max(fill[j], fill[j + 1] + 1);
			}
			for (int j = i + 1; s[j - 1] == '<'; ++j) {
				fill[j] = max(fill[j], fill[j - 1] + 1);
			}
		}
	}
	long long ans = 0;
	for (int i = 0; i < n; ++i) {
		ans += fill[i];
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 2688