akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <algorithm>


using namespace std;

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

  if(s == "Sunny") cout << "Cloudy" << endl;
  else if(s == "Rainy") cout << "Sunny" << endl;
  else if(s == "Cloudy") cout << "Rainy" << endl;

  
  return 0;    
}


Measured memory_bytes: 256
'''input
11
-1000000000 1000000000 -1000000000 1000000000 -1000000000 0 1000000000 -1000000000 1000000000 -1000000000 1000000000
'''

N=int(input())
A=list(map(int,input().split()))
count=0

for i in range(N):
	if A[i]<0:
		count+=1

for i in range(N):
	A[i]=abs(A[i])
	
if count%2==0:
	print(sum(A))
	exit()
else:
	print(sum(A)-2*min(A))
	exit()



Measured memory_bytes: 14412
n = int(input())

r = []
c = 1
i = 1
while i <= n:
    r.append([])
    for j in range(1, c+1):
        r[-1].append(i)
        i += 1
    c += 1

if i == n+1:
    print('Yes')
    print(c)
    for j in range(c-1):
        result = [c-1]
        result.extend(r[j])
        for x in range(j+1, c-1):
            result.append(r[x][j])
        print(*result)
    result = [c-1]
    for x in range(c-1):
        result.append(r[x][x])
    print(*result)
else:
    print("No")

Measured memory_bytes: 8456
// In The Name Of Allah
// Mehrkish Makuei

#include <bits/stdc++.h>

#define pb push_back
#define debug1(x) cerr << #x << " : " << x << endl;
#define debug2(x, y ) cerr << #x << " : " << x << "  " << #y << " : " << y << endl;

using namespace std;

typedef long long ll;
typedef long double ld;
typedef string str;
typedef vector <ll> vll;
typedef set <char> sch;
typedef set <ll> sll;

const ll MOD = 1e9 + 7;
const ll MAXN = 1e3 + 19;

ll a, b;

int main(){
	ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
	cin >> a >> b;
	cout << ( a + b ) % 24 << endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <vector>
#include <cmath>
#include <ctime>
#include <cassert>
#include <iomanip>
#include <vector>
#include <cstdio>
#include <float.h>
#include <queue>
#include <set>
#include <map>
#include <fstream>
#include <cstdlib>
#include <string>
#include <cstring>
#include <algorithm>
#include <numeric>
#include <stack>
#include <functional>
 
using namespace std;
 
#define endl '\n'
#define MOD 1000000007
#define INF 1ll<<30
#define MAX 100010
#define eps 1e-11
#define bit_max 1ll<<32
#define _USE_MATH_DEFINES

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
 //   freopen("input.txt","r",stdin);
 //   freopen("output.txt","w",stdout);
    
    long long int n,a,b,c,d,e;
    cin>>n>>a>>b>>c>>d>>e;
    long long int ans = min(a,min(b,min(c,min(d,e))));
    ans = (n/ans) + (n%ans==0?0:1);
    ans+=4;
    cout<<ans; 
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define f first
#define s second
#define pb push_back
#define ENDL '\n'
#define sz(a) (int)(a.size())
#define deb(a) cout << #a << ": " << a << ENDL;
#define all(a) begin(a),end(a)
#define fore(i, a, b) for(int i(a), ThkMk(b); i < ThkMk; ++i)
#define _ ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

using namespace std;

typedef long long lli;
typedef long double ld;
typedef pair<lli, lli> ii;
typedef vector<lli> vi;

lli MOD = 998244353;

int main()
{   _
    lli n, x, m; cin >> n >> x >> m;
    x %= m;
    vector<lli> occ(m + 10, -1);
    occ[x] = 0;
    vector<lli> acum(m + 10, 0);
    acum[0] = x;
    lli last = x;
    lli l, r;
    fore(i, 1, m + 10) {
        lli nxt = (last * last) % m;
        if(occ[nxt] != -1) {
            l = occ[nxt];
            r = i;
            break;
        }
        occ[nxt] = i;
        acum[i] += acum[i - 1] + nxt;
        last = nxt;
    }
    if(n <= r) {
        cout << acum[n - 1] << ENDL;
        return 0;
    }
    ///deb(l);
    ///deb(r);
    lli rest = n - l;
    ///deb(rest);
    lli length = r - l;
    ///deb(length);
    lli rep = (rest - rest % length) / length;
    ///deb(rep);
    lli left = rest % length;
    ///deb(left);
    lli cycleVal = acum[r - 1];
    if(l > 0) cycleVal -= acum[l - 1];
    ///deb(cycleVal);
    lli ans = cycleVal * rep;
    if(left + l > 0) ans += acum[left + l - 1];
    cout << ans << ENDL;
    return 0;
}


Measured memory_bytes: 4776
#include <bits/stdc++.h>
using namespace std;
void solve()
{
	unsigned long long x, sum = 0;
	cin >> x;
	for (int i = 1; i <=x; i++)
	{
		if (i % 3 != 0 && i % 5 != 0)
		{
			sum += i;
		}
	}
	cout << sum;
}
int main(void)
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);

	solve();

	return 0;
}


Measured memory_bytes: 3608
#include <stdio.h>

int main(void) {
  int t, l;
  scanf("%d", &t);
  for(l = 0; l < t; ++l) {
    int i, j, k, n, maxu = 0, maxd = 0;
    scanf("%d", &n);
    int a[n];
    for(i = 0; i < n; ++i) {
      scanf("%d", &a[i]);
      if(i) {
        if(a[i] > a[i - 1]) {
          if(a[i] - a[i - 1] > maxu) maxu = a[i] - a[i - 1];
        } else {
          if(a[i - 1] - a[i] > maxd) maxd = a[i - 1] - a[i];
        }
      }
    }
    printf("%d %d\n", maxu, maxd);
  }
  return 0;
}


Measured memory_bytes: 2724
#include <iostream>
#include <cmath>
#include <string>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>

using namespace std;

#define endl "\n"
#define PRIME 1000000007

#define int long long

#define f(i,a,n) for(int i = a; i < n; i++)
#define fs(i,a,n,k) for(int i = a; i < n; i+=k)

#define fr(i,a,n) for(int i = n; i > a; i--)
#define frs(i,a,n,k) for(int i=n; i>a; i-=k)

#define out1(a) cout << a << endl
#define out2(a,b) cout << a << " " << b << endl
#define out3(a,b,c) cout << a << " " << b << " " << c << endl


signed main(){
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif

    //enable fast I/O
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    int n;
    cin >> n;

    int num = n % 1000;

    if(num != 0)
        out1(1000 - num);
    else
        out1(0);

    return 0;
}

Measured memory_bytes: 3648
A, B, C = map(int,input().split())
K = int(input())

cnt = 0
ans = "No"
while cnt <= K:
    if not A < B:
        B *= 2
        cnt += 1
        continue
    if not B < C:
        C *= 2
        cnt += 1
        continue
    if A < B < C:
        ans = "Yes"
        break


print(ans)

Measured memory_bytes: 9180
def main():
    N = int(input())
    happiness = []
    for i in range(N):
        happiness.append([int(num) for num in input().split()])

    hap_total = [[0] * 3 for _ in range(N)]
    hap_total[0] = [happiness[0][0], happiness[0][1], happiness[0][2]]


    for i in range(1, N):
        for j in range(3):
            for k in {0, 1, 2} - {j}:
                hap_total[i][j] = max(hap_total[i][j], hap_total[i-1][k] + happiness[i][j])


    print(max(hap_total[N-1]))


if __name__ == '__main__':
    main()


Measured memory_bytes: 75224
# -*- coding: utf-8 -*-


def main():
    n = int(input())
    a = [list(map(int, input().split())) for i in range(2)]
    count = 0

    for i in range(n):
        first = sum(a[0][:i + 1])
        second = sum(a[1][i:])
        count = max(count, first + second)

    print(count)


if __name__ == '__main__':
    main()


Measured memory_bytes: 3060
#include<bits/stdc++.h>
#define ll long long
using namespace std;
typedef vector<long long> vl;
#define all(v) (v).begin(),(v).end()
#define pb push_back
#define tr(v,it) for(auto it=(v).begin();it!=(v).end();it++)
#define mp make_pair
#define REP(i,a,b) for(i=a;i<=b;i++)

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout<<fixed<<setprecision(0);
    ll num,p,n=0,m=0,x;
    cin>>num>>p;
    
    while(num--)
    {
        cin>>x;
        if(x&1) n++;
        else m++;
    }
    if(p)
    {
        if(n==0) cout<<0<<"\n";
        else cout<<pow(2,m+n-1)<<"\n";
    }
    else
    {
        if(n==0) cout<<pow(2,m)<<"\n";
        else cout<<pow(2,m+n-1)<<"\n";
    }
    
    return 0;
}

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

int main() {
    long long N; cin >> N;
    long long S = 0;
    vector<long long> a(N), b(N);
    for (int i = 0; i < N; ++i) cin >> a[i], S += a[i];
    if (S % (N * (N+1)/2) != 0) {
        cout << "NO" << endl;
        return 0;
    }
    long long num = S / (N * (N+1)/2); //cout << num << ", " << S << endl;
    long long count = 0;
    for (int i = 0; i < N; ++i) {
        b[i] = a[i] - a[(i-1+N)%N];
        b[i] -= num; //cout << i << ": " << b[i] << endl;
        if (b[i] % N != 0 || b[i] > 0) {
            cout << "NO" << endl;
            return 0;
        }
        count += abs(b[i]) / N;
    }
    cout << "YES" << endl;
}


Measured memory_bytes: 1792
#include <iostream>
#include <cstdio>
#include <stack>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;

int main() {
    stack<int> S1;
    stack<pair<int,int> > S2;
    char ch;
    int sum=0;
    for (int i=0; cin >> ch; i++) {
        if (ch=='\\') {
            S1.push(i);
        } else if (ch=='/' && S1.size()>0) {
            int j=S1.top(); S1.pop();
            sum +=i-j;
            int a=i-j;
            while (S2.size()>0 && S2.top().first>j) {
                a+=S2.top().second; S2.pop();
            }
            S2.push(make_pair(j,a));
        }
    }
    vector<int> ans;
    while (!S2.empty()) {
        ans.push_back(S2.top().second); S2.pop();
    }
    reverse(ans.begin(),ans.end());
    printf("%d\n",sum);
    printf("%d",ans.size());
    for (int i=0; i<ans.size(); i++) {
        printf(" ");
        printf("%d",ans[i]);
    }
    printf("\n");
    return 0;
}

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

using namespace std;
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
constexpr int MOD = 1000000007;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
constexpr int dx[] = {1, 0, -1, 0, 1, 1, -1, -1};
constexpr int dy[] = {0, -1, 0, 1, 1, -1, -1, 1};

template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec){os << "["; for (const auto &v : vec) {os << v << ","; } os << "]"; return os; }
template <typename T, typename U> ostream &operator<<(ostream &os, const pair<T, U> &p){os << "(" << p.first << ", " << p.second << ")"; return os;}

double retans(vector<ll> &V, int A) {
    double sum = 0;
    for(int i = 0; i < A; i++) {
        sum += V[i];
    }
    return sum / A;
}

ll memo[100][100];
ll comb(ll n, ll k) {
    if (memo[n][k]) return memo[n][k];
    if (n == k) return 1;
    if (k == 0) return 1;
    return memo[n][k] = comb(n - 1, k - 1) + comb(n - 1, k);
}

void solve() {
    int N, A, B;
    cin >> N >> A >> B;
    vector<ll> V(N);
    for (int i = 0; i < N; i++) {
        cin >> V[i];
    }
    sort(V.rbegin(), V.rend());
    if (V[A - 1] != V[0]) {
        ll v = V[A - 1];
        int cnt = 0, cnt2 = 0;
        for (int i = 0; i < N; i++) {
            if (V[i] == v) cnt++;
            if (V[i] > v) cnt2++;
        }
        cout << retans(V, A) << endl;
        cout << comb(cnt, A - cnt2) << endl;
    } else {
        cout << retans(V, A) << endl;
        ll ans = 0;
        int cnt = 0;
        for (int i = 0; i < N; i++) {
            if (V[i] == V[0]) cnt++;
        }
        for (int i = A; i <= min(cnt, B); i++) {
            ans += comb(cnt, i);
        }
        cout << ans << endl;
    }
}

int main() {
    std::cin.tie(0);
    std::ios::sync_with_stdio(false);
    cout.setf(ios::fixed);
    cout.precision(16);
    solve();
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <queue>
#include <array>
#include <unordered_set>
#include <unordered_map>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <cassert>
#include <utility>
#include <functional>

using namespace std;
using lli = long long int;
template<class T, class U> void init_n(vector<T>& v, size_t n, U x) 
{ v = vector<T>(n, x); }
template<class T> void init_n(vector<T>& v, size_t n) { init_n(v, n, T()); }
template<class T> void read_n(vector<T>& v, size_t n) 
{ v = vector<T>(n); for (lli i=0; i<n; ++i) cin >> v[i]; }
template<class T, class U> void read_n(vector<pair<T, U>>& v, size_t n)
{ v = vector<pair<T, U>>(n); 
  for (lli i=0; i<n; ++i) cin >> v[i].first >> v[i].second; }
template<class T> T gabs(const T& x) { return max(x, -x); }
#define abs gabs

lli n, h;
vector<lli> a, b;
int main() {
  cin >> n >> h;
  init_n(a, n); init_n(b, n);
  for (lli i=0; i<n; ++i) cin >> a[i] >> b[i];
  sort(begin(a), end(a));
  sort(begin(b), end(b));
  lli cnt=0;
  for (lli i=n-1; i>=0 && h>0 && b[i] > a[n-1]; --i, ++cnt) h -= b[i];
  if (h>0) cnt += h/a[n-1] + (h%a[n-1]==0 ? 0 : 1);
  cout << cnt << endl;
  return 0;
}


Measured memory_bytes: 1792
#include <cstdio>
#include <iostream>
#include <string>

int main() {
    std::string s;
    std::cin >> s;
    bool used[26] = {};
    for (char c : s) {
        if (used[c - 'a']) {
            puts("no");
            return 0;
        }
        used[c - 'a'] = true;
    }
    puts("yes");
}

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

using namespace std;

int main(){
   // while(1){
    long long a,x,m,b,c,d,e;
    cin >> a >> x >> m >> b >> c >> d >> e;
    long long sum= x*4;
    if(a%2==0&&b%2==0&&c%2==0){
        sum+=(a+b+c)*4;
        cout << sum/4 << endl;
        return 0;
    }
    else if(a%2==0&&b%2==0&&c%2==1){
        if(a!=0&&b!=0){
            sum+=12;
            a--;
            b--;
            c--;
            if(c==0){
                sum+=(a+b+c-2)*4;
            }
            else{
                sum+=(a+b+c-1)*4;
            }
        }else{
            sum+=(a+b+c-1)*4;
        }
        cout << sum/4 << endl;
        return 0;
    }
    else if(a%2==0&&b%2==1&&c%2==0){
        if(a!=0&&c!=0){
            sum+=12;
            a--;
            b--;
            c--;
            if(b==0){
                sum+=(a+b+c-2)*4;
            }
            else{
                sum+=(a+b+c-1)*4;
            }
        }
        else {
            sum += (a + b + c - 1) * 4;
        }
        cout << sum/4 << endl;
        return 0;

    }
    else if(a%2==0&&b%2==1&&c%2==1){
        if(a==0){
            sum+=(a+b+c-2)*4;
        }
        else{
            sum+=(a+b+c-1)*4;
        }
        cout << sum/4 << endl;
        return 0;
    }
    else if(a%2==1&&b%2==0&&c%2==0){
        if(b!=0&&c!=0){
            sum+=12;
            a--;
            b--;
            c--;
            if(a==0){
                sum+=(a+b+c-2)*4;
            }
            else{
                sum+=(a+b+c-1)*4;
            }
        }else{
            sum+=(a+b+c-1)*4;
        }
        cout << sum/4 << endl;
        return 0;
    }
    else if(a%2==1&&b%2==0&&c%2==1){
        if(b==0){
            sum+=(a+b+c-2)*4;
        }
        else{
            sum+=(a+b+c-1)*4;
        }
        cout << sum/4 << endl;
        return 0;
    }
    else if(a%2==1&&b%2==1&&c%2==0){
        if(c==0){
            sum+=(a+b+c-2)*4;
        }
        else{
            sum+=(a+b+c-1)*4;
        }
        cout << sum/4 << endl;
        return 0;
    }
    else if(a%2==1&&b%2==1&&c%2==1){
        sum+=(a+b+c)*4;
        cout << sum/4 << endl;
        return 0;
    }
    return 0;
}

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

h,w,n = map(int,input().split())
ab = [tuple(map(int,input().split())) for _ in range(n)]

ans = [0] * 10
ans[0] = (h-2)*(w-2)

black = set(ab)
checked = set()

for tmp in ab:
    a,b = tmp
    y0 = max(1,a-2)
    y1 = min(h,a+2)-1
    x0 = max(1,b-2)
    x1 = min(w,b+2)-1
    for i in range(x0,x1):
        for j in range(y0,y1):
            if ((j,i) in checked):
                continue
            tmp = 0
            for x in range(3):
                for y in range(3):
                    tmp += ((j+y,i+x) in black)
            ans[0] -= 1
            ans[tmp] += 1
            checked.add((j,i))

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

Measured memory_bytes: 129544
# ABC138D - Ki
from collections import deque


def main():
    N, Q, *X = map(int, open(0).read().split())
    AB, PX = X[: 2 * (N - 1)], X[2 * (N - 1) :]

    tree, cnt = [[] for _ in range(N + 1)], [0] * (N + 1)
    for a, b in zip(*[iter(AB)] * 2):
        tree[a].append(b), tree[b].append(a)
    for p, x in zip(*[iter(PX)] * 2):
        cnt[p] += x

    queue = deque([1])
    is_searched = [False] * (N + 1)
    while queue:
        u = queue.popleft()
        cur_cnt = cnt[u]
        is_searched[u] = True
        for v in tree[u]:
            if is_searched[v]:
                continue
            cnt[v] += cur_cnt
            queue.append(v)

    print(" ".join(map(str, cnt[1:])))


if __name__ == "__main__":
    main()


Measured memory_bytes: 93580
<?php

    fscanf(STDIN, "%d %d", $N, $X);

    function uec($a, $b) {
        $m = max($a, $b);
        $n = min($a, $b);

        while ($n != 0) {
            $tmp = $n;
            $n = ($m % $n);
            $m = $tmp;
        }

        return $m;
    }

    echo ($N - uec($N, $X)) * 3 . "\n";


Measured memory_bytes: 3452
/*
 * @Author: Luisvacson
 * @LastEditors: Luisvacson
 * @Descriptions: None
 * @Date: 2020-03-28 20:12:24
 * @LastEditTime: 2020-03-28 20:20:51
 * @FilePath: \VSCode\C++\Practice\AC abc160 C.cpp
 */
#include<bits/stdc++.h>
using namespace std;

signed main(){
    int n,k;
    scanf("%d%d",&n,&k);
    
    register int i;
    int x,last=0,temp;
    int sum,maxn=-1<<30;

    for(i=1;i<=k;++i){
        scanf("%d",&x);
        if(i==1) temp=x;
        sum+=x-last;
        maxn=max(maxn,x-last);
        last=x;
    }

    sum+=n-last;
    maxn=max(maxn,n-last+temp);

    printf("%d\n",n-maxn);
    return 0;
}

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

#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
#define MEMSET(v, h) memset((v), h, sizeof(v))
typedef long long ll;

using namespace std;

int main(void){
    string S;
    cin >> S;
    bool Easy = true;
    rep(i, S.length()){
        if(i%2 == 0 && S[i] == 'L') Easy = false;
        if(i%2 == 1 && S[i] == 'R') Easy = false;
    }
    cout << (Easy ? "Yes" : "No") << endl;
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void){
  int i, x[10000], n;

  i = 1;
  while(1){
    scanf("%d", &x[i]);
    if (x[i] == 0){
      break;
    }
    i++;
  }

  n = i;
  for (i = 1; i < n; i++){
    printf("Case %d: %d\n", i, x[i]);
  }

  return 0;
}


Measured memory_bytes: 2056
#include <stdio.h>

int main (void){
    int n,a,b,c;
    scanf("%d",&n);

    a=n/100;
    n=n-(a*100);
    b=n/10;
    n=n-(b*10);
    c=n/1;

    if(a==7 || b==7 || c==7){
        printf("Yes\n");
    }else{
        printf("No\n");
    }

    return 0;
}

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

using namespace std;

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


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

int main(){
    int h,w;
    cin>>h>>w;
    string s[52];
    for(int i=1;i<=h;i++){
        cin>>s[i];
        s[i]='.'+s[i];
    }
    string str(w+2,'.');
    s[0]=s[h+1]=str;
    for(int i=1;i<=h;i++){
        for(int j=1;j<=w;j++){
            if(s[i][j]=='#'&&s[i-1][j]=='.'&&s[i+1][j]=='.'&&s[i][j-1]=='.'&&s[i][j+1]=='.'){
                cout<<"No"<<endl;
                return 0;
            }
        }
    }
    cout<<"Yes"<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std; inline void fileio(const char* in, const char* out) { freopen(in, "r", stdin); freopen(out, "w", stdout); }
#define TD typedef
#define forx(i,n) for(int i = 0; i < (n); ++i)
#define forxr(i,n) for(int i = (n)-1; i >= 0; --i)
TD long long ll; TD long double ld; TD pair<int,int> pii; TD pair<ll,ll> pll; TD vector<int> VI; TD vector<bool> VB; TD vector<ll> VL;
const char nl = '\n'; const int INF = 0x3f3f3f3f; const ll LINF = 0x3f3f3f3f3f3f3f3fll; const ld EPS = 1e-9, PI = acos(-1);
#define ff first
#define ss second
#define all(c) c.begin(),c.end()

template <int MOD>
struct modint {
  int v; modint(int val=0) : v(val) { if ((v%= MOD) < 0) v += MOD; }
  modint& operator += (const modint& b) { (v += b.v) %= MOD; return *this; }
  modint& operator -= (const modint& b) { return (*this) += MOD-b.v; }
  modint& operator *= (const modint& b) { v = ((ll)v*(ll)b.v) % MOD; return *this; }
  modint& operator /= (const modint& b) { return (*this) *= b.pow(MOD-2); }
#define _op(op, op2) modint operator op (const modint& b) const { modint ans = *this; return ans op2 b; }
  _op(+, +=); _op(-, -=); _op(*, *=); _op(/, /=);
#undef _op
  modint pow(ll e) const { modint res(1), b(*this); for (; e>0; e/=2, b*=b) { if (e&1) res*=b; } return res; }
};
using mi = modint<(int)1e9+7>;

template <typename T> class PXSum {
  vector<T> d; public: PXSum() : d(1) { }
  template <class It> void build(It begin, It end) { d.resize(1); while (begin != end) push(*begin++); }
  void push(T val) { d.push_back(val + d.back()); }
  // sum[l, r)
  T query(int l, int r) const { return d[r] - d[l]; }
};

const int N = 3005;
mi dp[N][N];
int n;
string s;

int main() { // Emily <3
  atexit([](){ cerr << "Time: " << (ld)clock() / CLOCKS_PER_SEC << nl; });
  ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  cout << fixed << setprecision(12);
  cin >> n >> s;
  PXSum<mi> px;
  dp[0][0] = 1;
  px.build(dp[0], dp[0]+n);
  for (int i = 1; i < n; ++i) {
    for (int j = 0; j <= i; ++j) {
      if (s[i-1] == '>') {
        dp[i][j] = px.query(j, n);
      } else {
        dp[i][j] = px.query(0, j);
      }
    }
    px.build(dp[i], dp[i]+n);
  }
  cout << px.query(0, n).v << nl;

  return 0;
}



Measured memory_bytes: 35584
from itertools import combinations as combi

N, M, Q = map(int, input().split())
ABCD = [list(map(int, input().split())) for _ in range(Q)]

#/##//####
# M-1+N C N
max_num = 0
for l in combi(range(M-1+N), N):
    x = [t-s for t, s in zip(l, range(N))]
    # print(x)
    score = sum(d for a, b, c, d in ABCD if x[b-1]-x[a-1] == c)
    max_num = max(max_num, score)

print(max_num)


Measured memory_bytes: 75332
#include <iostream>
#include <stdio.h>
#include <string.h>
int main() {
    int N;
    std::cin >> N;
    std::string strN = std::to_string(N);
    bool isOK = false;
    for (int i =0;i<3;i++){
        if(strN[i] == '7'){isOK = true;}
    }
     
    if(isOK == true){
        std::cout << "Yes" << std::endl;
    }
    else{std::cout << "No" << std::endl;}

    return 0;
}

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

int main() {
 int a, b;
  cin >> a >> b;
  int ans = 0;
  if(a<=b) {
    ans +=b;
    --b;
  }
  else{
 ans +=a;
    --a;
  }
 if(a<=b) {
    ans +=b;
  }
  else ans +=a;
  cout << ans << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;
class Main{
  public static void main(String[] args){
  Scanner scanner = new Scanner(System.in);
  int a = scanner.nextInt();
  int b = scanner.nextInt();
  int c = scanner.nextInt();
  int z = 0;
  for(int i = a; i <= b; i++){
      if(c % i == 0){
          z++;
      }
      }
      System.out.println(z);
    }
  }

Measured memory_bytes: 26160
#include <iostream>
#include <algorithm>

using namespace std;

long long A[100001],B[100001],C[100001];

unsigned long long S,T;

int main(){
  int i,N;
  cin >> N;
  for (i=0;i<N;++i) {
    cin >> A[i];
  }
  if (N==2) {
    cout << abs(A[1]-A[0]) << endl;
    return 0;
  }
  sort(A, A+N);
  for (i=0;i<N/2;++i) {
    B[2*i+1]=A[i];
  }
  B[0]=A[N/2];
  if (N%2==1) {
    B[N-1]=A[N/2 +1];
  } else {
    B[N-2]=A[N/2 +1];
  }
  for (i=1;N/2 + i+1 < N;++i) {
    B[2*i]=A[N/2 + i+1];
  }

  for (i=0;i<N/2;++i) {
    C[2*i+1]=A[N-1-i];
  }
  C[0]=A[N-1-N/2];
  if (N%2==1) {
    C[N-1]=A[N-1-(N/2 +1)];
  } else {
    C[N-2]=A[N-1-(N/2 +1)];
  }
  for (i=1;N/2 + i+1 < N;++i) {
    C[2*i]=A[N-1-(N/2 + i+1)];
  }
  S=0;
  T=0;
  for (i=0;i<N-1;++i) {
    if (B[i+1] - B[i] > 0) {
      S+=B[i+1] - B[i];
    } else {
      S+=B[i]-B[i+1];
    }
    if (C[i+1] - C[i] > 0) {
      T+=C[i+1] - C[i];
    } else {
      T+=C[i]-C[i+1];
    }
  }
  if (S>T) {
    cout << S << endl;
  } else {
    cout << T << endl;
  }

  return 0;
}


Measured memory_bytes: 2560
'use strict';
 
process.stdin.resume();
process.stdin.setEncoding('utf-8');
 
let inputString = '';
let currentLine = 0;
 
process.stdin.on('data', function(inputStdin) {
    inputString += inputStdin;
});
 
process.stdin.on('end', function() {
    inputString = inputString.split('\n');
    main();
});
 
function readline() {
    return inputString[currentLine++];
}
 
 
// main function .... code start ... ///
function main() {
 
 //var input = readline()

var ar = readline().split(' ').map(x => parseInt(x));
var a = ar[0]
var str = readline().split(' ');
var s = str[0];

console.log(a >= 3200 ? s : 'red');
}

Measured memory_bytes: 21320
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    double ans = 0.0;
    for(int i = 0;i<n;i++){
      double x = sc.nextDouble();
      if(sc.next().equals("BTC")){
        x *= 380000;
      }
      ans+=x;
    }
    System.out.println(ans);
  }
}


Measured memory_bytes: 37420
use std::io::Read;

fn run() {
    let mut s = String::new();
    std::io::stdin().read_to_string(&mut s).unwrap();
    let mut it = s.trim().split_whitespace();
    let h: usize = it.next().unwrap().parse().unwrap();
    let w: usize = it.next().unwrap().parse().unwrap();
    let mut s: Vec<Vec<char>> = (0..h).map(|_| it.next().unwrap().chars().collect()).collect();
    let mut pos = (h - 1, w - 1);
    while pos.0 + pos.1 > 0 {
        if s[pos.0][pos.1] != '#' {
            println!("Impossible");
            return;
        }
        s[pos.0][pos.1] = '.';
        if pos.0 == 0 {
            pos.1 -= 1;
        } else if pos.1 == 0 {
            pos.0 -= 1;
        } else {
            if s[pos.0 - 1][pos.1] == s[pos.0][pos.1 - 1] {
                println!("Impossible");
                return;
            }
            if s[pos.0 - 1][pos.1] == '#' {
                pos.0 -= 1;
            } else {
                pos.1 -= 1;
            }
        }
    }
    if s[0][0] != '#' {
        println!("Impossible");
        return;
    }
    s[0][0] = '.';
    if s.iter().all(|s| s.iter().all(|c| *c == '.')) {
        println!("Possible");
    } else {
        println!("Impossible");
    }
}

fn main() {
    run();
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
#include <array>
using namespace std;
using ULL = unsigned long long;
using UL = unsigned;
using LL = long long;
#define rep(i, n) for(UL i = 0; i < (n); i++)

struct Problem {

	void Solve() {
		UL N; cin >> N;
		vector<UL> T(N), A(N);
		rep(i, N) cin >> T[i];
		rep(i, N) cin >> A[i];
		vector<pair<UL, UL>> M(N);
		rep(i, N) M[i] = { 0, 1000000010 };
		M[0].first = max(M[0].first, T[0] - 1);
		M[0].second = min(M[0].second, T[0]);
		M[N - 1].first = max(M[N - 1].first, A[N - 1] - 1);
		M[N - 1].second = min(M[N - 1].second, A[N - 1]);
		rep(i, N - 1) {
			if (T[i] < T[i + 1]) {
				M[i + 1].first = max(M[i + 1].first, T[i + 1] - 1);
			}
			if (A[i] > A[i + 1]) {
				M[i].first = max(M[i].first, A[i] - 1);
			}
		}
		rep(i, N) {
			M[i].second = min(M[i].second, A[i]);
			M[i].second = min(M[i].second, T[i]);
		}
		//rep(i, N) cout << M[i].first << " "; cout << endl;
		//rep(i, N) cout << M[i].second << " "; cout << endl;
		static const ULL MOD = 1000000007;
		ULL ans = 1;
		rep(i, N) {
			if (M[i].second <= M[i].first) { cout << 0 << endl; return; }
			ans *= (M[i].second - M[i].first);
			ans %= MOD;
		}
		cout << ans << endl;
	}


	Problem();
};
int main() {
	unique_ptr<Problem> p(new Problem());
	p->Solve();
	return 0;
}
Problem::Problem() {
	cout << fixed << setprecision(10);
}


Measured memory_bytes: 1792
import sys
import math
import collections
import itertools
import array
import inspect

# Set max recursion limit
sys.setrecursionlimit(1000000)


# Debug output
def chkprint(*args):
    names = {
        id(v): k
        for k, v in inspect.currentframe().f_back.f_locals.items()
    }
    print(', '.join(
        names.get(id(arg), '???') + ' = ' + repr(arg) for arg in args))


# Binary converter
def to_bin(x):
    return bin(x)[2:]


def li_input():
    return [int(_) for _ in input().split()]


def gcd(n, m):
    if n % m == 0:
        return m
    else:
        return gcd(m, n % m)


def gcd_list(L):
    v = L[0]

    for i in range(1, len(L)):
        v = gcd(v, L[i])

    return v


def lcm(n, m):
    return (n * m) // gcd(n, m)


def lcm_list(L):
    v = L[0]

    for i in range(1, len(L)):
        v = lcm(v, L[i])

    return v


# Width First Search (+ Distance)
def wfs_d(D, N, K):
    """
    D: 隣接行列(距離付き)
    N: ノード数
    K: 始点ノード
    """

    dfk = [-1] * (N + 1)
    dfk[K] = 0

    cps = [(K, 0)]
    r = [False] * (N + 1)
    r[K] = True
    while len(cps) != 0:
        n_cps = []
        for cp, cd in cps:
            for i, dfcp in enumerate(D[cp]):
                if dfcp != -1 and not r[i]:
                    dfk[i] = cd + dfcp
                    n_cps.append((i, cd + dfcp))
                    r[i] = True

        cps = n_cps[:]

    return dfk


# Depth First Search (+Distance)
def dfs_d(v, pre, dist):
    """
    v:  現在のノード
    pre: １つ前のノード
    dist: 現在の距離

    以下は別途用意する
    D: 隣接リスト(行列ではない)
    D_dfs_d: dfs_d関数で用いる，始点ノードから見た距離リスト
    """

    global D
    global D_dfs_d

    D_dfs_d[v] = dist

    for next_v, d in D[v]:
        if next_v != pre:
            dfs_d(next_v, v, dist + d)

    return


def sigma(N):
    ans = 0
    for i in range(1, N + 1):
        ans += i
    return ans


def comb(n, r):
    if n - r < r: r = n - r
    if r == 0: return 1
    if r == 1: return n

    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]

    for p in range(2, r + 1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p - 1, r, p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])

    return result

def bisearch(L, target):
    low = 0
    high = len(L) - 1
    
    while low <= high:
        mid = (low + high) // 2
        guess = L[mid]
        if guess == target:
            return True
        elif guess < target:
            low = mid + 1
        elif guess > target:
            high = mid - 1
    if guess != target:
        return False

# --------------------------------------------

dp = None


def main():
    N, K = li_input()
    D = li_input()

    price = N
    while True:
        dislike = False
        for p in str(price):
            if int(p) in D:
                dislike = True
                break
        
        if not dislike:
            print(price)
            return
        
        price += 1
        


main()


Measured memory_bytes: 4692
#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
typedef long long ll;
#define N 44
inline int read(){
	int x=0,f=1;
	char c=getchar();
	while(c<'0'||c>'9'){
		if(c=='-')f=-1;
		c=getchar();
	}
	while(c>='0'&&c<='9'){
		x=(x<<1)+(x<<3)+c-'0';
		c=getchar();
	}
	return x*f;
}
int n,G[N][N];
ll dp[N][N][N],ans;
char s[N];
ll dfs(int l,int x,int r){
	if(~dp[l][x][r])return dp[l][x][r];
	if(l==x&&r==x)return dp[l][x][r]=1;
	ll tot=0;
	for(int j=l;j<x;++j){
		for(int k=r;k>x;--k){
			if(!G[j][k])continue;
			for(int p=j;p<x;++p){
				for(int q=k;q>x;--q){
					tot+=dfs(l,j,p)*dfs(p+1,x,q-1)*dfs(q,k,r);
				}
			}
		}
	}
	return dp[l][x][r]=tot;
}
int main(){
	n=read()<<1;
	for(int i=1;i<=n;++i){
		scanf("%s",s+1);
		for(int j=1;j<=n;++j){
			G[i][j]=s[j]-'0';
		}
	}
	memset(dp,-1,sizeof(dp));
	for(int i=2;i<=n;++i){
		if(G[1][i]){
			ans+=dfs(2,i,n);
		}
	}
	printf("%lld\n",ans);
	return 0;
}



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



int main(){
	int n;
	int m;


	cin >> n;
	cin >> m;


	if (n < m)  cout << "a < b" << endl;
	if (n > m)  cout << "a > b" << endl;
	if (n == m)  cout << "a == b" << endl;




	return 0;
}


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

using namespace std;

using ll = long long;

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

    const ll MOD = 1e9 + 7;
    ll n;
    cin >> n;

    vector<ll> c(n);
    for (int i = 0; i < n; ++i) cin >> c[i];

    map<int, ll> memo;
    ll res = 1;
    memo[c[0]] = 1;
    for (int i = 1; i < n; ++i) {
        if (c[i] == c[i - 1]) continue;
        if (memo.count(c[i]) != 0)
            (res += memo[c[i]]) %= MOD;
        memo[c[i]] = (res % MOD);
    }
    cout << res % MOD << endl;

    return 0;
}


Measured memory_bytes: 14336
N, K = [int(x) for x in input().split()]
ans = 0
for b in range(max(K, 1), N + 1):
    ans += (N // b) * (b - K)
    if K == 0:
        ans += N % b
    else:
        if N % b - K + 1 > 0:
            ans += N % b - K + 1
print(ans)


Measured memory_bytes: 2940
n = int(input())
s = [input().split() for i in range(n)]
b = sum([int(s[i][1]) for i in range(n)])
x = input()
c = 0
for i in range(n):
    c+=int(s[i][1])
    if s[i][0] == x:
        break
print(b-c)

Measured memory_bytes: 62296
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define FOR(i,a,b) for(int i=(a); i<=(b); i++)
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define chmin(a,b) if((a)>(b)) (a)=(b);
#define chmax(a,b) if((a)<(b)) (a)=(b);
#define vi vector<int>
#define pii pair<int,int>
#define all(v) (v).begin(),(v).end()
#define allr(v) (v).rbegin(),(v).rend()
#define pb push_back
#define pf push_front
int gcd(int a,int b){/*a>=0,b>=0,￢(a=b=0)*/
  while(min(a,b)>0){if(a<b)swap(a,b);a%=b;}return max(a,b);
}
int dx[]={1,0,-1,0,1,-1,-1,1};
int dy[]={0,1,0,-1,1,1,-1,-1};
const int MOD = 1e9+7;
const long long INF = 1e18+10;

/*--------------------------------------------------------------------*/

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

	int ans=0;
	ans+=x/11*2;
	x-=x/11*11;

	if(x>0){
		ans++;
		x-=6;
	}
	if(x>0){
		ans++;
		x-=5;
	}

	assert(x<=0);
	cout<<ans<<endl;
	

	return 0;


}


Measured memory_bytes: 3600
use strict;
use warnings;

my @s;
{
  my $in = <STDIN>;
  chomp $in;
  @s = split "", $in;
}
my $n = <STDIN>;
chomp $n;
my @q;
{
  for (my $i=0; $i<$n; $i++) {
    my $in = <STDIN>;
    chomp $in;
    $q[$i] = $in;
  }
}
my $b = 1;
for (my $i=0; $i<$n; $i++) {
  if (length($q[$i])==1) {
    if ($b) {
      $b = 0;
    } else {
      $b = 1;
    }
  } elsif (substr($q[$i], 2, 1)==1) {
    if ($b) {
      unshift @s, substr($q[$i], 4, 1);
    } else {
      push @s, substr($q[$i], 4, 1);
    }
  } else {
    if ($b) {
      push @s, substr($q[$i], 4, 1);
    } else {
      unshift @s, substr($q[$i], 4, 1);
    }
  }
}
if (!$b) {
  @s = reverse @s;
}
print $_ for @s;

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

int main() {
    long long n;
    cin >> n;
    long long a[n];
    long long count=0;
    for(int i=0;i<n;i++){
        cin >> a[i];
        count+=a[i];
    }
    count-=a[n-1];
    long long com=a[n-1];
    long long ans=abs(count-com);
    for(int i=n-2;i>=1;i--){
        count-=a[i];
        com+=a[i];
        ans=min(ans,abs(count-com));
    }
    cout << ans << endl;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
#define N 400005
#define ll long long
using namespace std;
int n,m;
int head[N],ver[N],nxt[N],tot;
void add(int a,int b)
{
    tot++;nxt[tot]=head[a];head[a]=tot;ver[tot]=b;return ;
}
int v[N];
int cnt,flag,sz,szz,tp;
void dfs(int x,int c)
{
    cnt++;v[x]=c;
    for(int i=head[x];i;i=nxt[i])
    {
        if(v[ver[i]]==-1)dfs(ver[i],c^1);
        else if(v[ver[i]]!=(c^1))flag=1;
    }
    return ;
}
int main()
{
    scanf("%d%d",&n,&m);
    for(int i=1;i<=m;i++)
    {
        int t1,t2;
        scanf("%d%d",&t1,&t2);
        add(t1,t2);add(t2,t1);
    }
    ll ans=0;memset(v,-1,sizeof(v));
    for(int i=1;i<=n;i++)
    {
         cnt=0;flag=0;
         if(v[i]==-1)dfs(i,0);
         if(cnt)
         {
             //cout<<cnt<<endl;
             if(flag||cnt==1)ans++;
             else ans+=2;
             if(cnt==1)tp++;
             else
             {
                 if(!flag)szz++;
                 sz++;
             }
         }
    }
    //cout<<ans<<endl;
    ans+=1LL*2*tp*(n-1);
    ans-=1LL*tp*(tp-1);
    ans+=1LL*sz*(sz-1);
    ans+=1LL*szz*(szz-1);
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 8192
#include <cstdio>
#include <cstdlib>
#include <algorithm>


using namespace std;

int n;
int a[200001];

void debug_print_ints(int* as, int n){
  printf("%d\n", n);
  for(int i=0; i < n; i++){
    printf("%d, ", as[i]);
  }
  printf("\n");
}

long long calc(long long b){
  long long res = 0;
  for(int i=0; i < n; i++){
    res += abs(a[i] - b);
  }
  return res;
}


int main(){

  scanf("%d", &n);
  for(int i=0; i < n; i++){
    scanf("%d", &(a[i]));
    a[i] -= (i + 1);
  }

  sort(a, a + n);
  // debug_print_ints(a, n);

  long long l = a[0];
  long long r = a[n - 1] + 1;
  while(1){
    // printf("%d %d\n", l, r);
    if(r - l <= 2){
      break;
    }
    long long b_midleft = (r + l*2)/3;
    long long b_midright = (r*2 + l)/3;
    long long sad_midleft = calc(b_midleft);
    long long sad_midright = calc(b_midright);
    // printf("%d %d %d %d\n", b_midleft, b_midright, sad_midleft, sad_midright);
    if(sad_midleft <= sad_midright){
      r = b_midright;
    }else{
      l = b_midleft;
    }
  }
  long long x[3];
  x[0] = calc(l);
  x[1] = calc(l+1);
  x[2] = calc(l+2);
  // debug_print_ints(x, 3);
  printf("%lld\n", *min_element(x, x+3));
  
  return 0;
}



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

#define fi first
#define se second
#define FO(x, n) for (int x = 0; x < n; ++x)
#define FOR(x, a, b) for (int x = a; x < b; ++x)
#define RFO(x, n) for (int x = n - 1; x >= 0; --x)
#define RFOR(x, a, b) for (int x = b - 1; x >= a; --x)
using namespace std;
typedef unsigned char byte;
typedef long long llong;
typedef unsigned long long ullong;
typedef pair<int, int> pii;
typedef pair<double, double> pdd;
typedef pair<string, string> pss;
typedef pair<llong, llong> pll;
inline bool feq(const double& a, const double& b) { return fabs(a - b) < 1e-10; }

using namespace std;


int main(){
    int n = 3;
    vector<int> arr(10, 0);
    arr[4] = 2;
    arr[6] = 1;

    FOR(i, 0, n) {
        int m ;
        cin >> m;

        m -= 1;

        arr[m] -= 1;
        if (arr[m] < 0) {
            cout << "NO" << endl;
            return  0;
        }
    }
    cout << "YES" << endl;
    return 0;
}


Measured memory_bytes: 256
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author
 */

#include <iostream>
#include <fstream>

#include <iostream>
#include "bits/stdc++.h"

using namespace std;

typedef unsigned long long ll;
#define int                     long long
#define ii                      pair<int,int>
#define vii                     vector<pair<int,int>>
#define vi                      vector<int>
#define vvi                     vector<vector<int>>
#define f(a,b,c)                for(int a=b;a<c;a++)
#define s(x)                    in>>x
#define s2(x,y)                 in>>x>>y
#define s3(x,y,z)               in>>x>>y>>z
#define s4(x,y,z,w)             in>>x>>y>>z>>w
#define p(x)                    out<<x<<endl
#define p2(x,y)                 out<<x<<" "<<y<<endl
#define pl(x)                   out<<x
#define p2l(x,y)                out<<x<<" "<<y
#define p1d(a,n)                for(int ix=0;ix<n;ix++) out<<a[ix]<<" "; out<<endl
#define p2d(a,n,m)              for(int ix=0;ix<n;ix++){ for(int jx=0;jx<m;jx++) out<<a[ix][jx]<<" "; out<<endl;}
#define range(v)                v.begin(),v.end()
#define w(x)                    while(x--)
#define rst(x)                  memset(x, -1, sizeof(x))
#define UNVISITED               -1
#define VISITED                 0
#define EXPLORED                2

class DPredictionAndRestriction {
public:
	void solve(std::istream& in, std::ostream& out) {
	    int n,k;
	    int r, s, p;
	    string machine;
	    s2(n,k); s3(r,s,p);

	    map<char,int> points;
	    points['r'] = p;
	    points['s'] = r;
	    points['p'] = s;
        vector<vector<char>> plays;
        plays.assign(k,vector<char>());
        f(i,0,n){
            char buf;
            s(buf);
            plays[i%k].push_back(buf);
        }
        int total = 0;
        f(i,0,k){
            char prev = 'a';
            f(j,0,plays[i].size()){
                if(prev == plays[i][j]){
                    prev = 'a';
                }else{
                    total+=points[plays[i][j]];
                    prev = plays[i][j];
                }
            }
        }
        out<<total<<endl;





	}
};


main() {
	DPredictionAndRestriction solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
}


Measured memory_bytes: 5120
import sys,math

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

N = I()
a = [I() for _ in range(N+1)]
a.reverse()

ans = set([])

g = a[0]
for i in range(N):
    g = math.gcd(g,a[i+1])

for p in range(2,int(g**.5)+1):
    if g % p == 0:
        ans.add(p)
        g //= p
if g != 1:
    ans.add(g)

if N == 0:
    ans = list(ans)
    ans.sort()
    print(*ans, sep='\n')
    exit()


def sieve_of_eratosthenes(n):
    prime_list = []  # n以下の素数のリスト
    A = [1]*(n+1)    # A[i] = iが素数なら1,その他は0
    A[0] = A[1] = 0
    for i in range(2,math.floor(math.sqrt(n))+1):
        if A[i]:
            prime_list.append(i)
            for j in range(i**2,n+1,i):
                A[j] = 0
    for i in range(math.floor(math.sqrt(n))+1,n+1):
        if A[i] == 1:
            prime_list.append(i)
    return prime_list


prime_list = sieve_of_eratosthenes(N)

for p in prime_list:  # f(x) が x**p-x で割り切れるかを判定
    if a[0] % p != 0:
        continue
    else:
        for i in range(p-1):
            if i == 0:
                r = 0
                for j in range(p-1,N+1,p-1):
                    r += a[j]
                    r %= p
                if r != 0:
                    break
            else:
                r = 0
                for j in range(i,N+1,p-1):
                    r += a[j]
                    r %= p
                if r != 0:
                    break
        else:
            ans.add(p)

ans = list(ans)
ans.sort()
print(*ans,sep='\n')

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

int main() {
    int n;
    Long t;
    double a;
    cin >> n >> t >> a;
    vector<double> H(n);
    for(auto &h : H) cin >> h;
    double curdif = (1 << 30);
    int bi = -1;
    for(int i = 0; i < n; i++) {
        if (fabs((t - H[i]*0.006) - a) < curdif) {
            curdif = fabs((t - H[i]*0.006) - a);
            bi = i + 1;
        }
    }
    cout << bi << endl;
    return 0;
}

Measured memory_bytes: 256
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();
		int c =sc.nextInt();
		 if(a<b&&b<c) {
			 System.out.println("Yes");
		 }else{
		System.out.println("No");
		 }
	}
}


Measured memory_bytes: 26156
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#include <cmath>
#include <bitset>
#include <iomanip>
#include <stack>
#include <list>
#include <map>
#include <unordered_map>
#include <chrono>
#include <numeric>
using namespace std;
using ll = long long;
const ll INF = (ll)1e18+1;
const ll DIV = 1000000007;
//#define TEST

ll all_divs(ll n){
    vector<ll> 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);
            }
        }
    }
    return ret.size();
}

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
#ifdef TEST
    chrono::system_clock::time_point start, end;
    start = chrono::system_clock::now();
#endif
    ll N;
    cin >> N;
    vector<ll> divN(10000001);
    ll total = 0;
    for(size_t i=1;i<=N; i++)
    {
        for(size_t j=i;j<=N; j+=i)
        {
            if(j % i == 0) total += j;
        }
    }
    cout << total << endl;
#ifdef TEST
    end = chrono::system_clock::now();
    cerr << static_cast<double>(chrono::duration_cast<chrono::microseconds>(end - start).count() / 1000.0) << "[ms]" << endl;
#endif
    return 0;
}

Measured memory_bytes: 81344
package main

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

var sc = bufio.NewScanner(os.Stdin)

func main() {
	sc.Split(bufio.ScanWords)

	for i := 0; i < 5; i++ {
		x := nextInt()
		if x == 0 {
			fmt.Println(i + 1)
			return
		}
	}

}

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}


Measured memory_bytes: 1744
#include <iostream>
#include <algorithm>

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) for (int i = 0; i < (n); i++)
#define ALL(a) (a).begin(), (a).end()

using namespace std;

int main() {
    int A, B, C, D;
    cin >> A >> B >> C >> D;
    cout << min(A, B) + min(C, D) << endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main() {
    int N;
    scanf("%d", &N);

    int i;
    long long int ans = 0;
    for(i = 1; i <= N; i++){
        if((i % 3) == 0){

        } else if((i % 5) == 0) {
        
        } else {
            ans += i;
        }

    }

    printf("%lld", ans);
    
    return 0;
}

Measured memory_bytes: 1728
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <climits>

#define rep(i, m, n) for(int i=int(m);i<int(n);i++)
#define EACH(i, c) for (auto &(i): c)
#define all(c) begin(c),end(c)
#define EXIST(s, e) ((s).find(e)!=(s).end())
#define SORT(c) sort(begin(c),end(c))
#define pb emplace_back
#define MP make_pair
#define SZ(a) int((a).size())

//#define LOCAL 0
//#ifdef LOCAL
//#define DEBUG(s) cout << (s) << endl
//#define dump(x)  cerr << #x << " = " << (x) << endl
//#define BR cout << endl;
//#else
//#define DEBUG(s) do{}while(0)
//#define dump(x) do{}while(0)
//#define BR
//#endif


//改造
typedef long long int ll;
using namespace std;
#define INF (1 << 30) - 1
#define INFl (ll)5e15
#define DEBUG 0 //デバッグする時1にしてね
#define dump(x)  cerr << #x << " = " << (x) << endl
#define MOD 1000000007
//ここから編集する


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

    int N;
    cin >> N;
    vector<int> a(N), b(N);
    rep(i, 0, N) {
        cin >> a[i];
    }
    rep(i, 0, N) {
        cin >> b[i];
    }

    int ans = 0;
    for (int i = 0; i <= 28; i++) {
        int mod = (1 << (i + 1));
        vector<int> ma(N), mb(N);
        rep(j, 0, N) {
            ma[j] = a[j] % mod;
        }
        rep(j, 0, N) {
            mb[j] = b[j] % mod;
        }
        sort(all(ma));
        sort(all(mb));
        int cnt = 0;
        rep(j, 0, N) {
//            int x = ma[j];
//            cnt += upper_bound(all(mb), 1 << (i + 1) - ma[j]) - lower_bound(all(mb), 1 << i - ma[j]);
            cnt += lower_bound(all(mb), (1 << (i + 1)) - ma[j]) - lower_bound(all(mb), (1 << i) - ma[j]);
//            cout << upper_bound(all(mb), 1 << (i + 1) - ma[j]) - mb.begin() << endl;
//            cout << lower_bound(all(mb), 1 << i - ma[j]) - mb.begin() << endl;

            cnt += mb.end() - lower_bound(all(mb), (3 << i) - ma[j]);
            cnt %= 2;
        }
        if(cnt % 2) ans += (1 << i);
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3440