akhauriyash/Code-Regression huggingface dataset:
// #define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
#define Graph vector< vector<int> >
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1000000007;

struct DisjointSet{
    vector<int> rank, p, s;

    DisjointSet(){}
    DisjointSet(int size){
        rank.resize(size, 0);
        p.resize(size, 0);
        s.resize(size, 1);
        rep(i, size) makeSet(i);
    }

    void makeSet(int x){
        rank[x] = 0;
        p[x] = x;
    }

    bool same(int x, int y){
        return findSet(x) == findSet(y);
    }

    int findSet(int x){
        if(p[x] == x) return x;
        p[x] = findSet(p[x]);        
        return p[x];
    }

    void unite(int x, int y){
        int px = findSet(x), py = findSet(y);
        if(px != py) link(px, py);
    }

    void link(int x, int y){
        if(rank[x] > rank[y]){
            p[y] = x;
            s[x] += s[y];
        } else {
            p[x] = y;
            if(rank[x] == rank[y]) rank[y]++;
            s[y] += s[x];
        }
    }

    int size(int x){
        return s[findSet(x)];
    }
};

int main(){
    int N, M, K;
    cin >> N >> M >> K;
    DisjointSet ds(N);
    Graph F(N), B(N);

    rep(i, M){
        int a, b;
        cin >> a >> b;
        a--;
        b--;
        F[a].push_back(b);
        F[b].push_back(a);
        ds.unite(a, b);
    }

    rep(i, K){
        int c, d;
        cin >> c >> d;
        c--;
        d--;
        B[c].push_back(d);
        B[d].push_back(c);
    }

    rep(i, N){
        int ans = ds.size(i) - 1;
        for(int j : F[i]){
            if(ds.same(i, j)) ans--;
        }
        for(int j : B[i]){
            if(ds.same(i, j)) ans--;
        }
        cout << ans << ' ';
    }
    cout << endl;
}

Measured memory_bytes: 13048
#include <bits/stdc++.h>
#include <math.h>
#include <vector>
#include <queue>
#include <iomanip>
#include <string>
#include <algorithm>
using namespace std;
using Graph = vector<vector<int>>;
#define rep(i,n) for(int i=0;i<n;i++)
#define rep_1 (i,j,n) for(int i=j;i<n;i++)
typedef long long ll;
typedef long l;
const ll l_INF = 101010101000;
const int INF = 1010101010;
const int dx[4] = {-1,0,1,0};
const int dy[4] = {0,-1,0,1};
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vi>;
using pii = pair<int,int>;

int main(){
  int n;
  cin>>n;
  vl a(n);
  rep(i,n) cin>>a[i];
  vl s(n+1);
  ll count=0;
  rep(i,n) s[i+1]=s[i]+a[i];
  map<ll,ll> y;
  rep(i,n+1){
    ll x = s[i];
    y[x]++;
  }
  for(auto z : y){
    if(z.second>1) count+=(z.second*(z.second-1)/2);
    //cout << z.second<< endl;
  }
  cout<<count<<endl;
}


Measured memory_bytes: 18756
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define FAST ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);srand(time(NULL));
#define MOD 1000000007
#define INF LONG_LONG_MAX
#define MINF LONG_LONG_MIN


void init(){
}

ll po(ll x, ll y) { 
    ll res = 1;
    while (y > 0) { 
        if (y & 1) 
            res = (res*x)%MOD; 
        y = y>>1;  
        x = (x*x)%MOD;
    } 
    return res; 
}



void solve(){
    ll n;
    cin>>n;
    map<string, ll> mp1;
    ll ans = 0;
    for( ll i=0;i<n;i++ ){
        string s;
        cin>>s;
        if( mp1[s] == 0 ){
            ans++;
            mp1[s] = 1;
        }
    }
    cout<<ans<<endl;
    return;
}

int main(){
    FAST;
    init();
    ll t = 1;
    //cin>>t;
    while( t-- ) solve();
    return 0;
} 

Measured memory_bytes: 19208
#define _CRT_SECURE_NO_WARNINGS

#include <stdio.h>

using namespace std;

template<typename T>
class DListNode {
    public:
        T value;
        DListNode<T> *prev;
        DListNode<T> *next;
        DListNode(): prev(nullptr), next(nullptr) {};
};

template<typename T>
class DList {
    public:
        DListNode<T> *first;
        DListNode<T> *last;

        DList():first(nullptr), last(nullptr){};

        void insert(T value){
            DListNode<T> *n = new DListNode<T>();
            n->next = this->first;

            if(this->first){
                this->first->prev = n;
            }else{
                this->last = n;
            }

            this->first = n;
            n->value = value;
        }

        void del(T value){
            DListNode<T> *n = this->first;
            while (n) {
                if(n->value == value){
                    if(n->prev){
                        n->prev->next = n->next;
                    }else{
                        this->first = n->next;
                    }

                    if(n->next){
                        n->next->prev = n->prev;
                    }else{
                        this->last = n->prev;
                    }

                    delete n;
                    break;
                }
                n = n->next;
            }
        }

        void deleteFirst(){
            DListNode<T> *fst = first;
            if(fst->next){
                fst->next->prev = nullptr;
            }else{
                last = nullptr;
            }
            first = fst->next;
            delete fst;
        }

        void deleteLast(){
            DListNode<T> *lst = last;
            if(lst->prev){
                lst->prev->next = nullptr;
            }else{
                first = nullptr;
            }
            last = lst->prev;
            delete lst;
        }

};

int main(int argc, char const* argv[])
{
    int n, key;
    char cmd[16];
    DList<int> l;

    scanf("%d", &n);
    for (int i = 0; i < n ; i++) {
        scanf("%s", cmd);
        if (cmd[0] == 'i') {
            scanf("%d", &key);
            l.insert(key);
        } else if(cmd[6] == '\0') {
            scanf("%d", &key);
            l.del(key);
        } else if(cmd[6] == 'F'){
            l.deleteFirst();
        } else if(cmd[6] == 'L'){
            l.deleteLast();
        }
    }

    DListNode<int> *v = l.first;
    while (v) {
        printf("%d", v->value);
        v = v->next;
        if(v){
            putchar(' ');
        }
    }
    putchar('\n');
    
    return 0;
}

Measured memory_bytes: 34000
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;

namespace AtCoder.D
{
    public class Program
    {
        public static void Main() { var r = GetResult(); Debug.WriteLine(r); Console.Write(r); }

        private static object GetResult()
        {
            var N = ReadLong();
            var facts = GetPrimeFactors(N).ToList();
            var primeDic = new Dictionary<long, long>();
            foreach (var f in facts)
            {
                if (!primeDic.ContainsKey(f)) primeDic.Add(f, 0);
                primeDic[f]++;
            }

            var count = 0L;
            foreach (var prime in primeDic)
            {
                var val = prime.Value;
                for (long i = 1; ; i++)
                {
                    val -= i;
                    if (val < 0)
                    {
                        break;
                    }
                    count++;
                }
            }

            return count;
        }

        public static IEnumerable<long> GetPrimeFactors(long n)
        {
            for (long a = 2; a * a <= n; ++a)
            {
                if (n % a != 0) continue;

                // 割れる限り割り続ける
                while (n % a == 0)
                {
                    yield return a;
                    n /= a;
                }

                // TODO：重複を許さない場合はここで返す
                //yield return a;

            }

            // 最後に残った数について
            if (n != 1) yield return n;
        }

        #region Console.Read

        public static string ReadText() { return Console.ReadLine(); }
        public static List<string> ReadTexts() { return Console.ReadLine().Split(' ').ToList(); }
        public static long ReadLong() { return long.Parse(Console.ReadLine()); }
        public static (long, long) Read2Longs() { var ls = ReadLongs(); return (ls[0], ls[1]); }
        public static (long, long, long) Read3Longs() { var ls = ReadLongs(); return (ls[0], ls[1], ls[2]); }
        public static (long, long, long, long) Read4Longs() { var ls = ReadLongs(); return (ls[0], ls[1], ls[2], ls[3]); }
        public static (long, long, long, long, long) Read5Longs() { var ls = ReadLongs(); return (ls[0], ls[1], ls[2], ls[3], ls[4]); }
        public static List<long> ReadLongs() { return Console.ReadLine().Split(' ').Select(x => long.Parse(x)).ToList(); }

        #endregion
    }
}


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

# define Rep(i,a,b) for(int i=a;i<=b;i++)
# define _Rep(i,a,b) for(int i=a;i>=b;i--)
# define RepG(i,u) for(int i=head[u];~i;i=e[i].next)

typedef long long ll;

const int N=1e5+5;

template<typename T> void read(T &x){
   x=0;int f=1;
   char c=getchar();
   for(;!isdigit(c);c=getchar())if(c=='-')f=-1;
   for(;isdigit(c);c=getchar())x=(x<<1)+(x<<3)+c-'0';
    x*=f;
}

ll n;
int a[N],tot;

int main()
{
    read(n);
    while(n){
        if(n%26)a[++tot]=n%26,n/=26;
        else a[++tot]=26,n/=26,n--;
    }
    _Rep(i,tot,1)printf("%c",a[i]+'a'-1);
    puts("");
    return 0;
}

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

using namespace std;

int main() {

    int p[8];
    int c[8] = {4, 1, 2, 1, 2, 1, 4, 1};

    int temp[10];
    int ans[10];

    while(cin >> p[0] >> p[1] >> p[2] >> p[3] >> p[4] >> p[5] >> p[6] >> p[7]) {

        memset(ans, 0, sizeof(ans));
        ans[8] = -1;

        for(int i = 0; i < 8; ++i) {

            int digit = 10000000;
            memset(temp, 0, sizeof(temp));

            for(int j = 0; j < 8; ++j) {
                int pos = (i + j) % 8;
                if(p[j] >= c[pos]) {
                    temp[j] =  c[pos];
                } else {
                    temp[j] = p[j];
                }
                temp[8] += temp[j];
                temp[9] += c[pos] * digit;
                digit /= 10;

            }

            if(temp[8] > ans[8]) {
                for(int i = 0; i < 10; ++i) {
                    ans[i] = temp[i];
                }
            } else if(temp[8] == ans[8]) {
                if(temp[9] < ans[9]) {
                    for(int i = 0; i < 10; ++i) {
                        ans[i] = temp[i];
                    }
                }
            }

        }

        for(int i = 10000000; i >= 10; i /= 10) {
            cout << (ans[9] / i) << " ";
            ans[9] %= i;
        }
        cout << ans[9] << endl;

    }

}

Measured memory_bytes: 1156
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
#define gc getchar_unlocked()
#define pc(x) putchar_unlocked(x)
template<typename T> void scan(T &x){x = 0;bool _=0;T c=gc;_=c==45;c=_?gc:c;while(c<48||c>57)c=gc;for(;c<48||c>57;c=gc);for(;c>47&&c<58;c=gc)x=(x<<3)+(x<<1)+(c&15);x=_?-x:x;}
template<typename T> void printn(T n){bool _=0;_=n<0;n=_?-n:n;char snum[65];int i=0;do{snum[i++]=n%10+48;n/= 10;}while(n);--i;if (_)pc(45);while(i>=0)pc(snum[i--]);}
template<typename First, typename ... Ints> void scan(First &arg, Ints&... rest){scan(arg);scan(rest...);}
template<typename T> void print(T n){printn(n);pc(10);}
template<typename First, typename ... Ints> void print(First arg, Ints... rest){printn(arg);pc(32);print(rest...);}

using namespace std;
typedef pair<int, int> pii;
const int MM = 500;

int n, a[MM][MM], dis[MM][MM], ans;
deque<pii> q;
int mx[] = {1, -1, 0, 0};
int my[] = {0, 0, 1, -1};

int main(){
//    freopen("in", "r", stdin);
    
    memset(dis, 0x3f, sizeof dis);
    scan(n);
    for(int i = 0; i < n; i++){
        for(int j = 0; j < n; j++){
            a[i][j] = 1;
            if(!i or i == n-1 or !j or j == n-1){
                dis[i][j] = 0;
                q.emplace_back(i, j);
            }
        }
    }
    
    for(int z = 0,k; z < n*n; z++){
        while(q.size()){
            int x = q.front().first, y = q.front().second; q.pop_front();
            for(int t = 0; t < 4; t++){
                int nx = x+mx[t], ny = y+my[t];
                if(nx >= 0 and nx < n-1 and ny >= 0 and ny < n-1){
                    int op = a[x][y]; //cur cost
                    if(dis[x][y]+op < dis[nx][ny]){
                        dis[nx][ny] = dis[x][y]+op;
                        if(op)
                            q.emplace_back(nx, ny);
                        else
                            q.emplace_front(nx, ny);
                    }
                }
            }
        }
        
        scan(k);
        k--;
        int x = k/n, y = k%n;
        ans += dis[x][y];
        a[x][y] = 0;
        q.emplace_back(x, y);
    }
    
    print(ans);
    
    return 0;
}

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

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

  int r = (a + b) % 2;
  if (r == 0) {
    cout << (a + b) / 2 << endl;
  } else {
    cout << (a + b) / 2 + 1 << endl;
  }
}

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

int n;

int main(void){
    // Here your code !
    scanf("%d", &n);
    string str = to_string(n);
    int tmp = 0;
    for (int i = 0; i < str.size(); ++i) {
      tmp += (int)str[i] - 48;
    }
    if ((n % tmp) == 0) printf("Yes\n");
    else printf("No\n");
    return 0;
}


Measured memory_bytes: 256
// warm heart, wagging tail,and a smile just for you!
//                                                                     ███████████   
//                                                                   ███╬╬╬╬╬╬╬╬╬╬███
//                                                                ███╬╬╬╬╬████╬╬╬╬╬╬███
//                                            ███████████       ██╬╬╬╬╬████╬╬████╬╬╬╬╬██
//                                      █████████╬╬╬╬╬████████████╬╬╬╬╬██╬╬╬╬╬╬███╬╬╬╬╬██
//                               ████████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬█████████╬╬╬╬╬╬██╬╬╬╬╬╬╬██
//                             ████╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬█████████╬╬╬╬╬╬╬╬╬╬╬██
//                           ███╬╬╬█╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬███╬╬╬╬╬╬╬█████
//                         ███╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬████████╬╬╬╬╬██
//                       ███╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬███╬╬╬╬╬╬╬╬╬███
//                     ███╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬█████╬╬╬╬╬╬╬██
//                 ████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬████╬╬╬╬╬████
//     █████████████╬╬╬╬╬╬╬╬██╬╬╬╬╬████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬█████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬███╬╬╬╬██████
//   ████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬██████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██████╬╬╬╬╬╬╬███████████╬╬╬╬╬╬╬╬██╬╬╬██╬╬╬██
// ███╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬████╬╬╬╬╬╬╬╬╬╬╬█╬╬╬╬╬╬╬██╬╬╬╬╬╬╬╬██
// ██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬╬▓▓▓▓▓▓╬╬╬████╬╬████╬╬╬╬╬╬╬▓▓▓▓▓▓▓▓██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬╬╬╬╬███
// ██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██████▓▓▓▓▓▓▓╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬▓▓▓▓▓▓▓██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬╬█████
// ███╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬███╬╬╬╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬█████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬████████
//   ███╬╬╬╬╬╬╬╬╬╬╬╬╬█████╬╬╬╬╬╬╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬███╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██
//       ██████████████  ████╬╬╬╬╬╬███████████████████████████╬╬╬╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬████
//                         ███████                           █████  ███████████████████  
#include "bits/stdc++.h"
using namespace std;
#define MOD 1000000007
#define INF (1LL<<60)
#define fs first
#define sc second
#define pb push_back
#define int long long
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i = (b-1);i>=a;i--)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define ITR(itr,mp) for(auto itr = (mp).begin(); itr != (mp).end(); ++itr)
#define RITR(itr,mp) for(auto itr = (mp).rbegin(); itr != (mp).rend(); ++itr)
#define range(i,a,b) ((a)<=(i) && (i)<(b))
#define debug(x)  cout << #x << " = " << (x) << endl;
#define SP << " " << 
typedef pair<int,int> P;
typedef vector<vector<P> > Graph;

signed main(){
  ios::sync_with_stdio(false);
  cin.tie(0);  
  //問題文を読む時間をケチらない！！

  int a,b;
  cin >> a >> b;

  if(b % a) cout << b-a << endl;
  else cout << a+b << endl;

  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define REP(i, n) rep(i, 0, n)
#define repb(i, a, b) for(int i = a; i >= b; i--)
#define all(a) a.begin(), a.end()
#define int long long
using namespace std;
const int mod = 1000000007;
const int INF = 1e12;
template<class T>bool chmax(T &a, const T &b) { return (a < b) ? (a = b, 1) : 0;}
template<class T>bool chmin(T &a, const T &b) { return (b < a) ? (a = b, 1) : 0;}

using R = long double;
const R PI = acos(-1.0L);
using P = complex<R>;
const R inf = 1e13;
int x[110], y[110];
R ans[110];
inline R dist(int i, P q) {
   P p = P(x[i], y[i]);
   return norm(p - q);
}
signed main(){
    int n;
    cin >> n;
    rep(i, 0, n){
        cin >> x[i] >> y[i];
    }
    int limit = 200000;
    rep(i, 0, limit){
        R cur = 2.0 * PI / limit * i;
        P point = polar(inf, cur);
        R d = 1e130;
        int idx = -1;
        rep(j, 0, n) if(chmin(d, dist(j, point))) idx = j;
        ans[idx] += 1.0;
    }
    cout.precision(20);
	rep(i, 0, n) cout << fixed << 1.0 * ans[i] / limit << endl;
}

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

using namespace std;

typedef long long ll;

#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define FORd(i,a,b) for(int i=a;i>=b;i--)
#define fi first
#define se second
#define II pair<ll,ll>

const int maxn=2e5+10;
const ll maxN=1e18+10;

int main()
{
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  ll n;
  cin >> n;
  ll dem=1,lt=2;
  while (n!=1) {
  	n/=2;
  	dem+=lt;
  	lt*=2;
  }
  cout << dem;
}
    

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
void solve(int n){
  if(n%4==0){
    cout<<"Yes"<<endl;
    return;
  }
  if(n%7==0){
    cout<<"Yes"<<endl;
    return;
  }
  for(int i=7;i<n;i=i+7){
    if((n-i)%4==0){
      cout<<"Yes"<<endl;
      return;
    }
  }
  cout<<"No"<<endl;
  return;
}
int main(){
  int n;
  cin>>n;
  solve(n);
  return 0;
}

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

int main(){
    int a,b,x;
    cin >> a >> b >> x;
    double ans;
    if(a*a*b >= 2*x){
        ans = atan(float(a * b *b / (2.0 * x))) * 180.0 / M_PI;
    }
    else{
        ans = atan(float(2.0*(a*a*b-x)/(a*a*a)))* 180.0 / M_PI;
    }
    cout << setprecision(10)<< ans  << endl;
}

Measured memory_bytes: 256
#include <stdio.h>

int main()
{
	int m, nmin, nmax, j, diff, ans;
	int P[10001];
	while (scanf("%d%d%d", &m, &nmin, &nmax) && m) {
		diff = -1;
		for (int i = 0; i < m; i++)
			scanf("%d", P + i);
		for (int i = nmin - 1; i < nmax; i++) {
			// for (j = i + 1; P[i] == P[j] && j < m; j++) // 間違えてた
			for (j = i + 1; P[i] == P[j] && j < nmax; j++) ;
			if (diff <= P[i] - P[j]) {
				diff = P[i] - P[j];
				ans = i + 1;
			}
		}
		printf("%d\n", ans);
	}
	return 0;
}



Measured memory_bytes: 2044
N = int(input())
S = input()
i2s = {i:s for i, s in zip(range(26), "ABCDEFGHIJKLMNOPQRSTUVWXYZ")}
s2i = {s:i for i, s in zip(range(26), "ABCDEFGHIJKLMNOPQRSTUVWXYZ")}
ans = ""
for s in S:
    ans = ans + i2s[(s2i[s]+N)%26]
print(ans)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#include <map>
typedef long long ll;

using namespace std;

const ll inf=1000000007;

ll n, m, x[500005], y[500005], kx[500005], ky[500005], jx=0, jy=0, q;
map<ll,ll> ma;

int main()
{
    memset(x,0,sizeof(x));
    memset(y,0,sizeof(y));
    memset(kx,0,sizeof(kx));
    memset(ky,0,sizeof(ky));
    cin >> n >> m >> q;
    while(q--)
    {
        ll u, v;
        cin >> u >> v;
        x[u]++;
        y[v]++;
        ma[u*1000000+v]=1;
    }
    ll x2=0;
    for(int i=1;i<=300005;i++)
    {
        x2=max(x[i],x2);
    }
    for(int i=1;i<=300005;i++)
    {
        if(x[i]==x2)
        {
            kx[jx]=i;
            jx++;
        }
    }
    ll y2=0;
    for(int i=1;i<=300005;i++)
    {
        y2=max(y[i],y2);
    }
    for(int i=1;i<=300005;i++)
    {
        if(y[i]==y2)
        {
            ky[jy]=i;
            jy++;
        }
    }
    ll ans=0;
    for(int i=0;i<jx;i++)
    {
        for(int j=0;j<jy;j++)
        {
            if(ma[kx[i]*1000000+ky[j]]!=1)
            {
                ans=y2+x2;
                break;
            }
        }
        if(ans!=0)
        {
            break;
        }
    }
    ans=max(ans,x2+y2-1);
    cout<< ans << endl;
    return 0;
}


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

int main(){
  int X,Y;

  cin >> X >> Y;
  for(int i=0;i<=X;++i){
    if(2*i + 4*(X-i) == Y){
      cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 3624
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <cmath>
using namespace std;
const int N=310;
char s[N];
int f[N][N][N];
inline int solve(int l,int r,int k) {
    if(l>r) return 0;
    if(l==r) return 1;
    if(f[l][r][k]!=-1) return f[l][r][k];
    int &ans=f[l][r][k];
    ans=max(solve(l+1,r,k),solve(l,r-1,k));
    if(s[l]==s[r]) ans=max(ans,solve(l+1,r-1,k)+2);
    else if(k) ans=max(ans,solve(l+1,r-1,k-1)+2);
    return ans;
}
int main() {
    int k;
    memset(f,-1,sizeof(f));
    scanf("%s%d",s+1,&k);
    cout<<solve(1,strlen(s+1),k);
    return 0;
}

Measured memory_bytes: 116736
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
typedef pair<int,int> P;
#define F first
#define S second
int n,ans;
vector<P>g[100005];
int d1[100005],d2[100005];
void dfs(int v,int p){
    for(int i=0;i<g[v].size();i++){
        int u=g[v][i].F,c=g[v][i].S;
        if(u!=p){
            dfs(u,v);
            int d=d1[u]+c;
            if(d1[v]<d)swap(d1[v],d);
            d2[v]=max(d2[v],d);
        }
    }
}
void dfs2(int v,int p){
    ans=max(ans,d1[v]+d2[v]);
    for(int i=0;i<g[v].size();i++){
        int u=g[v][i].F,c=g[v][i].S;
        if(u!=p){
            int d=d1[v];
            if(d1[u]+c==d)d=d2[v];
            if(d1[u]<d)swap(d1[u],d);
            d2[u]=max(d2[u],d);
            dfs2(u,v);
        }
    }
}
int main(void){
    cin>>n;
    for(int i=0;i<n-1;i++){
        int a,b,w;
        cin>>a>>b>>w;
        g[a].push_back(P(b,w));
        g[b].push_back(P(a,w));
    }
    dfs(0,-1);
    dfs2(0,-1);
    cout<<ans<<endl;
}



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

N = int(input())
S = input().strip()
h = {}
for c in S:
    if c in h:
        h[c] += 1
    else:
        h[c] = 1

ans = 1
for v in h.values():
    ans *= v+1
ans -= 1

print(ans%(10**9+7))


Measured memory_bytes: 3188
#!/usr/bin/env python
# coding: utf-8

# In[31]:


N, M = map(int, input().split())
As = [int(input()) for i in range(M)]
"""
100 5
1
23
45
67
89
"""


# In[32]:


import numpy as np
import sys


# In[33]:


As = np.array(As)
oAs = As[1:]-As[:-1]
if 1 in oAs:
    print(0)
    sys.exit()


# In[34]:


stairs = [0]*(N+3)
stairs[0] = 1
#stairs[1] = 1

start_stage = 0
for i in range(M):
    collapsed_stage = As[i]
    finish_stage = collapsed_stage - 1
    #print(start_stage, finish_stage)
    continuous_stairs = finish_stage - start_stage
    if continuous_stairs < 2:
        stairs[finish_stage+2] = stairs[start_stage]
        start_stage = finish_stage+2
    else:
        stairs[start_stage+1] = stairs[start_stage]
        for i in range(continuous_stairs-1):
            stairs[start_stage+i+2] = stairs[start_stage+i] + stairs[start_stage+i+1]
        stairs[finish_stage+2] = stairs[finish_stage]
        start_stage = finish_stage+2

if N-start_stage < 2:
    stairs[N] = stairs[start_stage]
else:
    continuous_stairs = N - start_stage
    stairs[start_stage+1] = stairs[start_stage]
    for i in range(continuous_stairs-1):
        stairs[start_stage+i+2] = stairs[start_stage+i] + stairs[start_stage+i+1]
        #print(stairs)
        
#print(list(range(N+1)))
#print(stairs)
print(stairs[N]%1000000007)


# In[ ]:






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

int main() {
  int N;
  scanf("%d",&N);
  int a[N];
  int p=0;
  for (int i=0; i<N; i++) {
    scanf("%d",&a[i]);
    if (abs(a[p])<abs(a[i])) {
      p=i;
    }
  }
  printf("%d\n",2*N-1);
  for (int i=0; i<N; i++) {
    printf("%d %d\n",p+1,i+1);
  }
  if (a[p]<0) {
    for (int i=N; i>1; i--) {
      printf("%d %d\n",i,i-1);
    }
  } else {
    for (int j=1; j<N; j++) {
      printf("%d %d\n",j,j+1);
    }
  }
  return 0;
}


Measured memory_bytes: 256
double s[999][3],t[3],p,d,n1,n2;r[999];main(n,m,i,j){for(;scanf("%d",&n),n;printf("%d\n",m)){
for(i=0;i<n;i++)scanf("%lf%lf%lf",s[i],s[i]+1,s[i]+2);
for(memset(r,0,sizeof(r)),scanf("%d",&m),j=0;j<m;j++)
	for(scanf("%lf%lf%lf%lf",t,t+1,t+2,&p),n2=sqrt(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]),i=0;i<n;i++)
		if(n1=sqrt(s[i][0]*s[i][0]+s[i][1]*s[i][1]+s[i][2]*s[i][2]),d=t[0]*s[i][0]+t[1]*s[i][1]+t[2]*s[i][2],acos(d/n1/n2)<p)r[i]=1;
for(m=i=0;i<n;i++)m+=r[i];
}exit(0);}

Measured memory_bytes: 728
// fuck all u hoes get a grip
#include <iostream>
#include <bits/stdc++.h>

using namespace std;

void solve(){
	int n; cin>>n;
	int sq = sqrt(n);
	unordered_map<int, int> m;
	for(int i = 1; i <= sq; i++){
		for(int j = 1; j <= sq; j++){
			for(int k = 1; k <= sq; k++){
				m[(i*i + j*j + k*k + i*j + j*k + k*i)]++;
			}
		}
	}
	for(int i = 1; i <= n; i++){
		if(m.find(i) != m.end()){
			cout << m[i] << "\n";
		} else {
			cout << "0\n";
		}
	}
}
int main() {
	#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
	#endif
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int t=1;
	while(t--){
		solve();
		//cout << "\n";
	}
	return 0;
}


Measured memory_bytes: 4792
#include<bits/stdc++.h>
using namespace std;
int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	int n,k;
	cin >> n >> k;
	int ans = 0;
	while(n > 0) {
		ans++;
		n /= k;
	}
	cout << ans << endl;
	return 0;
}


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

int main() {
	int m1,d1,m2,d2;
	cin >> m1 >> d1 >> m2 >> d2;
	int k = 1;
	if(m1 == m2)
	{
		k = 0;
	}
    cout << k << endl;
	return 0;
}


Measured memory_bytes: 256
from sys import stdin
##  input functions for me
def ria(sep = ''):
    if sep == '' :
        return list(map(int, input().split())) 
    else: return list(map(int, input().split(sep)))
def rsa(sep = ''):
    if sep == '' :
        return input().split() 
    else: return input().split(sep)
def ri(): return int(input())
def rd(): return float(input())
def rs(): return input()
##

## main ##
N = ri()
S = [""] * N
for i in range(N):
    S[i] = rs()

di = dict()
for s in S:
    if not s in di: di[s] = 0
    di[s] += 1

ma = 0
for s in di:
    ma = max(ma, di[s])

l = []
for s in di:
    if di[s] == ma: l.append(s)

l.sort()
print("\n".join(l))




Measured memory_bytes: 35812
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
int main()
{
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
	ll i,j,n,m,k;
	cin>>n;
	int ar[n+1]={0};
	for(i=1;i<=n;i++)
	{
		for(j=i;j<=n;j+=i)
		ar[j]++;
	}
	ll ans=0;
	for(i=1;i<=n;i++)
	ans+=i*ar[i];
	cout<<ans;
}

Measured memory_bytes: 42688
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;

/*
<url:https://arc074.contest.atcoder.jp/tasks/arc074_b>
問題文============================================================
 N を 1 以上の整数とします。
 
 長さ 3N の数列 a=(a1,a2,…,a3N) があります。
 すぬけ君は、a からちょうど N 個の要素を取り除き、残った 2N 個の要素を元の順序で並べ、
 長さ 2N の数列 a' を作ろうとしています。
 このとき、a' のスコアを (a'の前半N要素の総和)−(a'の後半N要素の総和) と定義します。
 
 a' のスコアの最大値を求めてください。
=================================================================

解説=============================================================

================================================================
*/
ll solve(){
    ll N; cin >> N;
    vector<ll> a(3*N);
    for(auto &in:a) cin >> in;
    ll ret = -LINF;
    
    vector<ll> Front(3*N,0);
    priority_queue<ll,vector<ll>,greater<ll>> pq1;
    for(int i = 0; i < N;i++){
        if(i == 0){
            Front[i] = a[i]; pq1.push(a[i]);
        }else{
            Front[i] = Front[i-1] + a[i];
            pq1.push(a[i]);
        }
    }
    for(ll i = N; i < 2*N;i++){
        Front[i] = Front[i-1] + a[i];
        pq1.push(a[i]);
        Front[i] -= pq1.top(); pq1.pop();
    }
    
    vector<ll> Back(3*N,0);
    priority_queue<ll> pq2;
    for(ll i = 3*N-1; i >= 2*N;i--){
        if(i == 3*N-1){
            Back[i] = a[i]; pq2.push(a[i]);
        }else{
            Back[i] = Back[i+1] + a[i];
            pq2.push(a[i]);
        }
    }
    for(ll i = 2*N-1; i >= N;i--){
        Back[i] = Back[i+1] + a[i];
        pq2.push(a[i]);
        Back[i] -= pq2.top(); pq2.pop();
    }
    
    for(ll i = N-1; i < 2*N;i++){
        ret = max(ret,Front[i] - Back[i+1]);
    }
    return ret;
}
int main(void) {
	cin.tie(0); ios::sync_with_stdio(false);
    cout << solve() << endl;
	return 0;
}


Measured memory_bytes: 9588
#include<bits/stdc++.h>
using namespace std;
#define LL long long

LL gcd(LL a,LL b){return b==0?a:gcd(b,a%b);}
LL lcm(LL a,LL b){return a/gcd(a,b)*b;}
LL N,M,a[100010];
int main(){
    cin>>N>>M;
    LL g=1,ok=1;
    for(int i=1;i<=N;++i){
        cin>>a[i];
        a[i]/=2;
        if(i==1)g=a[i];
        g=lcm(g,a[i]);
        if(g>M)ok=0;
    }
    for(int i=1;i<=N;++i){
        if(g/a[i]%2==0){ok=0;break;}
    }
    if(!ok){
        cout<<0<<endl;
        return 0;
    }
    LL ans=0;
    LL b=M/g;
    ans=b/2;
    if(b&1)ans++;
    cout<<ans<<endl;
    return 0;
}
/*
8
1 2 3 4 5 6 7 8
8 7 6 5 4 3 2 1
*/


Measured memory_bytes: 1024
n,k=map(int,input().split())
a=list(map(int,input().split()))
pl=1
visit=[-1]*n
visit[0]=0
loop=0
q=True
v=True
cnt=0

while q:
    cnt+=1
    pl=a[pl-1]
    if visit[pl-1]!=-1:
        loop=visit[pl-1]
        break
    visit[pl-1]=cnt
    if cnt==k:
        print(pl)
        v=not v
        break
    if cnt==10**7:
        q=not q
if v:
    loop_len=cnt-loop
    q=True
    k=(k-loop)%loop_len+loop
    print(visit.index(k)+1)

Measured memory_bytes: 92264
import sys
inputs = sys.stdin.readlines()

n = int(inputs[0])
v_list = list(map(int, inputs[1].split()))
v = sorted(v_list)

for _ in range(len(v)-1):
    val = (v[1] - v[0]) / 2
    val = (v.pop(0) + v.pop(0)) / 2
    v.insert(0, val)
print(val)

Measured memory_bytes: 3064
import java.util.Arrays;
import java.util.Scanner;

public class Main {
    void run() {
        Scanner sc = new Scanner(System.in);
        for (;;) {
            int n = sc.nextInt(), k = sc.nextInt();
            if ((n|k) == 0) break;
            int[] ar = new int[n];
            for (int i = 0; i < n; i++) {
                ar[i] = sc.nextInt();
            }
            
            int sum = 0;
            for (int i = 0; i < k; i++) {
                sum += ar[i];
            }
            int ans = sum;
            for (int i = k; i < n; i++) {
                sum += ar[i] - ar[i - k];
                ans = Math.max(ans, sum);
            }
            
            System.out.println(ans);
        }
    }
        
    void debug(Object...os) {
        System.err.println(Arrays.deepToString(os));
    }
    
    public static void main(String[] args) {
        new Main().run();
    }
}

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

int main(){
    string s,t;
    cin>>s>>t;
    sort(s.begin(),s.end());
    sort(t.begin(),t.end());
    reverse (t.begin(),t.end());

    if(s<t) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
} 

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

int main(void){
    int h,w;
    cin >> h >> w;
    char c[h][w];
    for(int i = 0;i < h;i++){
        for(int j = 0;j < w;j++)cin >> c[i][j];
    }
    
    ll mod = 1e9+7,dp[h+1][w+1];
    for(int i = 0;i <= h;i++){
        for(int j = 0;j <= w;j++)dp[i][j] = 0;
    }
    
    dp[0][0] = 1;
    
    for(int i = 0;i < h;i++){
        for(int j = 0;j < w;j++){
            if(c[i][j] == '#')continue;
            
            if(i > 0)dp[i][j] += dp[i-1][j];
            if(j > 0)dp[i][j] += dp[i][j-1];
            
            dp[i][j] %= mod;
        }
    }
    
    cout << dp[h-1][w-1] << endl;
}

Measured memory_bytes: 12308
from math import factorial

s = int(input())
mod = pow(10, 9) + 7


def nCr(n, r):
    return int(factorial(n) // factorial(r) // factorial (n - r) % mod)

ans = 0
seq_len = s // 3

for i in range(1, seq_len + 1):
    ans += nCr(s - 3 * i + (i - 1), i - 1)

print(ans % mod)

Measured memory_bytes: 9164
n = int(input())
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
ans = 0
for i in range(n):
  if a[i] >= b[i]:
    ans += b[i]
  else:
    ans += a[i]
    b[i] -= a[i]
    s = min(a[i+1],b[i])
    ans += s
    a[i+1] -= s
print(ans)

Measured memory_bytes: 18624
#include<cstdio>
#include<algorithm>
#include<cstring>
#define ll long long
#define abs(a) (a>0?a:(-(a)))
#define max(a,b) ((a)>(b)?(a):(b))
#define min(a,b) ((a)<(b)?(a):(b))
using namespace std;
int a[100050];
int main(){
	int n,k,q;
	scanf("%d%d%d",&n,&k,&q);
	for (int i=1;i<=n;i++)
	a[i]=k-q;
	for (int i=1;i<=q;i++){
		int x;
		scanf("%d",&x);
		a[x]++;
	}
	for (int i=1;i<=n;i++)
	if (a[i]<=0) printf("No\n");else printf("Yes\n");
	return 0;
}


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

int main() {
	cin.tie(0)->sync_with_stdio(false);
	int n; cin >> n;
	vector<int> add(n), sub(n);
	for (int i = 0; i < n; i++) {
		int x, y; cin >> x >> y;
		add[i] = x + y;
		sub[i] = x - y;
	}
	sort(add.begin(), add.end());
	sort(sub.begin(), sub.end());
	cout << max(add[n-1] - add[0], sub[n-1] - sub[0]) << '\n';
	return 0;
}

Measured memory_bytes: 4760
#include <stdio.h>
#include <stdlib.h>


// I/O
int get_int() {
    int n = 0;
    int c = getchar_unlocked();
    if(c == 45) {
        c = getchar_unlocked();
        while(47 < c && c < 58) n = 10 * n + (c & 0xf), c = getchar_unlocked();
        return -n;
    } else if(c < 48 || 57 < c) return c;
    while(47 < c && c < 58) n = 10 * n + (c & 0xf), c = getchar_unlocked();
    return n;
}
int get_str(char *str) {
    int c;
    while((c = getchar_unlocked()) > 32) *str++ = (char)c;
    *str = 0;
    return c;
}
void put_int(int n) {
    if(!n) {
        putchar_unlocked('0');
        return;
    }
    if(n < 0) n = -n, putchar_unlocked('-');
    char buf[11];
    int i = 0;
    while(n) buf[i++] = (char)(n % 10 + '0'), n /= 10;
    while(i--)putchar_unlocked(buf[i]);
}
void put_str(char *str) { while(*str) putchar_unlocked(*str++); }
//


// Binary Search Tree
typedef struct Node {
    int key;
    struct Node *left, *right;
} Node;
typedef struct BST {
    Node *root;
    size_t size;
} BST;
void bst_init(BST *BST) {
    BST->root = NULL;
    BST->size = 0;
}
void bst_insert(BST *BST, int key) {
    Node *new_node = malloc(sizeof(Node));
    new_node->key = key;
    new_node->left = NULL;
    new_node->right = NULL;
    Node *tmp;
    Node *root = BST->root;
    while(root != NULL) {
        tmp = root;
        if(key < root->key) root = root->left;
        else root = root->right;
    }
    if(BST->size == 0) BST->root = new_node;
    else if(key < tmp->key) tmp->left = new_node;
    else tmp->right = new_node;
    BST->size++;
}
int bst_find(Node *root, int key) {
    if(root == NULL) return 0;
    else if(root->key == key) return 1;
    else if(root->key > key) return bst_find(root->left, key);
    else return bst_find(root->right, key);
}
void bst_inorder(Node *root) {
    if(root == NULL) return;
    bst_inorder(root->left);
    putchar_unlocked(' '), put_int(root->key);
    bst_inorder(root->right);
}
void bst_preorder(Node *root) {
    if(root == NULL) return;
    putchar_unlocked(' '), put_int(root->key);
    bst_preorder(root->left);
    bst_preorder(root->right);
}
//


int main(int argc, char **argv) {
    BST BST;
    bst_init(&BST);
    int m = get_int();
    int key;
    char c[8];
    for(int i = 0; i < m; ++i) {
        get_str(c);
        switch(*c) {
        case 'i':
            key = get_int();
            bst_insert(&BST, key);
            break;
        case 'f':
            key = get_int();
            put_str(bst_find(BST.root, key) ? "yes\n" : "no\n");
            break;
        default:
            bst_inorder(BST.root);
            putchar_unlocked('\n');
            bst_preorder(BST.root);
            putchar_unlocked('\n');
            break;
        }
    }
    return 0;
}



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

using namespace std;

int main()
{
    int n;
    cin>>n;
    vector<int> v(n);
    v.push_back(0);
    for(int i=0  ; i<n ; i++){
        cin>>v[i] ;
    }
    for(int i=0 ; i<n-1 ; i++)
    {
        if( v[i] > v[i+1]  )
            v[i]--;
        else if( v[i]== v[i+1] && v[i] > v[i-1] )
            v[i]--;

    }
    for(int i=0 ; i<n-1;  i++)
    {

        if( v[i] >  v[i+1] )
        {
            cout<<"No"<<endl;
            return 0;
        }
    }
    cout<<"Yes"<<endl;
    return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;
const int INF = 1000000000; // 10^9

signed main() {
    // ifstream in("data1.txt");
    // cin.rdbuf(in.rdbuf());
	int n, m;
    cin >> n >> m;
	vector<int> s(m),c(m);
	rep(i, m) {
		cin >> s[i] >> c[i];
	}
	rep(i, 1000) {
		string x = to_string(i);
		if (x.size() == n) {
			int cnt = 0;
			rep(j, m) {
                if(x[s[j]-1] == to_string(c[j])[0]) {
                    cnt++;
                }
            }
            if(cnt == m){
                cout << i << endl;
                return 0;
            }
		}
	}
	cout << -1 << endl;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
const int N=2e5+10;
#define fi first
#define se second
#define pb push_back
int n,a[N];
int t[N];
void add(int p,int d){
    for(;p<=1000;p+=p&-p)t[p]+=d;
}
int get(int p){
    int x=0;
    for(;p;p-=p&-p)x+=t[p];
    return x;
}
int vis[N];
int main() {
    ios::sync_with_stdio(false);
    cin>>n;
    for(int i=1;i<=n;i++)cin>>a[i],vis[a[i]]++;
    sort(a+1,a+1+n);
    for(int i=1000;i>=1;i--){
        vis[i]+=vis[i+1];
    }
    LL g=1ll*n*(n-1)*(n-2)/(1*2*3);
    for(int i=1;i+2<=n;i++){
        for(int j=i+1;j+1<=n;j++){
            g-=vis[a[i]+a[j]];
        }
    }
    cout<<g<<endl;
    return 0;
}

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

vector<int> comb(int N, int mod) {
  vector<int> comb(N+1, 1);
  rep(i, N) {
    comb[i+1] = (comb[i]*(N-1-i))%mod;
    int x = i+1;
    rep(j, 30) {
      if(j > 0) x *= x;
      x %= mod;
      if(j != 26 && j != 23) {
        comb[i+1] *= x;
        comb[i+1] %= mod;
      }
    }
  }
  return comb;
}

signed main() {
  int N, M, K; cin >> N >> M >> K;
  const int mod = 998244353;
  M %= mod;
  /*vector<int> com(K+1, 1);
  rep(i, K) {
    com[i+1] = (com[i]*(N-1-i))%mod;
    int x = i+1;
    rep(j, 30) {
      if(j > 0) x *= x;
      x %= mod;
      if(j != 26 && j != 23) {
        com[i+1] *= x;
        com[i+1] %= mod;
      }
    }
  }*/
  vector<int> com = comb(N, mod);
  //cout << com[0] << endl << com[1] << endl << com[2] << endl;

  vector<int> paint(N+1, M);
  rep(i, N-1) paint[i+2] = (paint[i+1]*(M-1))%mod;
  
 
  int ans = 0;
  rep(i, K+1) {
    ans += com[i]*paint[N-i];
    ans %= mod;
  }

  cout << ans << endl;
}

Measured memory_bytes: 6376
#pragma GCC optimize ("O3")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#include <bits/stdc++.h>
using namespace std;
using Int = long long;
typedef pair<int,int> P; typedef pair<Int,Int> Pl;
const int mod = 1e9+7;
const Int Inf = 1e17;
#define END {cout<<ans<<'\n'; return 0;}
#define ALL(v) (v).begin(),(v).end()
#define fi first
#define se second
#define mp make_pair
#define Pr(t) priority_queue<t>
#define gPr(t) priority_queue<t,vector<t>,greater<t>>
#define V(t) vector<t>
#define rep(i,n) for(int(i)=0; i<n; i++)
#define rer(i,l,r) for(int i=l; i<=r; i++)
#define gnr(i,l,r) for(int i=r; i>=l; i--)
#define eb emplace_back
#define pri1(a) cout<<(a)<<'\n'
#define pri2(a,n) {rep(pri2i,n-1)cout<<a[pri2i]<<' '; if(n>1)cout<<a[n-1]<<'\n';}
#define prip(p) cout<<p.fi<<' '<<p.se<<'\n'
template<class T> inline bool cmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool cmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

template< class T >
struct edge {
  int fr, to;
  T w;

  edge(int to, T w) : fr(-1), to(to), w(w) {}

  edge(int fr, int to, T w) : fr(fr), to(to), w(w) {}

  edge &operator=(const int &x) {
    to = x;
    return *this;
  }

  operator int() const { return to; }
};

template< typename T >
using Edges = vector< edge< T > >;
template< typename T >
using WeightedGraph = vector< Edges< T > >;
using UnWeightedGraph = vector< vector< int > >;
template< typename T >
using Matrix = vector< vector< T > >;

template< class T >
vector< T > dijkstra(WeightedGraph< T > &g, int s) {
  const auto INF = numeric_limits< T >::max();
  vector< T > dist(g.size(), INF);

  using Pi = pair< T, int >;
  priority_queue< Pi, vector< Pi >, greater< Pi > > que;
  dist[s] = 0;
  que.emplace(dist[s], s);
  while(!que.empty()) {
    T cost;
    int idx;
    tie(cost, idx) = que.top();
    que.pop();
    if(dist[idx] < cost) continue;
    for(auto &e : g[idx]) {
      auto next_cost = cost + e.w;
      if(dist[e.to] <= next_cost) continue;
      dist[e.to] = next_cost;
      que.emplace(dist[e.to], e.to);
    }
  }
  return dist;
}

int n,m,_,x,y,q;
string s,sb;
bool ok;
char cf,cb;

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

  int st,en; cin>>n>>m>>st>>en; WeightedGraph<Int>g(n),u(n); Int a,b;
  rep(i,m){
    cin>>x>>y>>a>>b; x--; y--;
    g[x].eb(y,a); g[y].eb(x,a);
    u[x].eb(y,b); u[y].eb(x,b);
  }
  st--; en--;
  auto v1=dijkstra(g,st),v2=dijkstra(u,en);
  Int ans[n+1]; fill(ans,ans+n+1,Inf);
  gnr(i,0,n-1)cmin(ans[i],min(ans[i+1],v1[i]+v2[i]));
  Int tem=1e15;
  rep(i,n)pri1(tem-ans[i]);
}

Measured memory_bytes: 19068
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}
 
#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};
 
    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
 
    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}
 
#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };
 
    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };
 
    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };
 
    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };
 
    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };
 
    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}
fn main() {
    input! {
        n: usize,
        a: [f64; n]
    }

    let mut ans = 0.0;
    
    for e in &a {
        ans = ans + 1.0 / *e;
    }
    ans = 1.0 / ans;

    println!("{}", ans);
}


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

const int mod = 998244353;
const int inv9 = 443664157;

long long pw[200010][20];

struct Segment_tree {
	int T[800010], lazy[800010];
	void init(int n) {
		memset(lazy, 0, sizeof(lazy));
		T[1] = pw[n][1], lazy[1] = 1;
	}
	void pushdown(int now, int l, int r) {
		if (!lazy[now]) return ;
		int x = lazy[now]; lazy[now] = 0;
		int mid = l + r >> 1;
		T[now << 1] = pw[mid - l + 1][x], T[now << 1 | 1] = pw[r - mid][x];
		lazy[now << 1] = lazy[now << 1 | 1] = x;
	}
	void pushup(int now, int l, int r) {
		int mid = l + r >> 1;
		T[now] = (1ll * T[now << 1] * pw[r - mid][0] + T[now << 1 | 1]) % mod;
	}
	void Update(int now, int l, int r, int L, int R, int x) {
		if (l == L && r == R) {
			T[now] = pw[r - l + 1][x], lazy[now] = x;
			return ;
		}
		pushdown(now, l, r);
		int mid = l + r >> 1;
		if (R <= mid) Update(now << 1, l, mid, L, R, x);
		else if (L > mid) Update(now << 1 | 1, mid + 1, r, L, R, x);
		else Update(now << 1, l, mid, L, mid, x), Update(now << 1 | 1, mid + 1, r, mid + 1, R, x);
		pushup(now, l, r);
	}
}seg;

int main () {
	pw[0][0] = 1;
	for (int i = 1; i <= 200000; i++) {
		pw[i][0] = pw[i - 1][0] * 10 % mod;
		pw[i][1] = (pw[i][0] - 1 + mod) % mod * inv9 % mod;
		for (int j = 2; j <= 9; j++) {
			pw[i][j] = pw[i][1] * j % mod;
		}
	}
	int n, q; scanf("%d%d", &n, &q);
	seg.init(n);
	while (q--) {
		int l, r, x; scanf("%d%d%d", &l, &r, &x);
		seg.Update(1, 1, n, l, r, x);
		printf("%d\n", seg.T[1]);
	}
	return 0;
}


Measured memory_bytes: 40204
#include <stdio.h>

int main(void) {
  int N = 0; // 木の本数
  int D = 0; // 配置された木から監視できる範囲
  int monitoring_range = 0; // 監視員が監視できる最大本数
  int watchmans = 0; // 監視員の最低必要人数

  // 木の本数を設定する
  scanf("%d", &N);

  // 監視範囲を設定する
  scanf("%d", &D);

  // 監視員の監視本数を求める
  monitoring_range = D * 2 + 1;

  // 監視範囲の合計から監視員の最低必要人数を求める
  watchmans = N / monitoring_range;
  if(N % monitoring_range) watchmans += 1;

  // 監視員の最低必要人数を出力する
  printf("%d\n", watchmans);

  return 0;
}


Measured memory_bytes: 128
#include<stdio.h>


int main(){

  int a,b;

  scanf("%d %d", &a,&b);
  if(a < b){
    printf("a < b\n");
  }else if(a > b){
    printf("a > b\n");
  }else if(a == b){
    printf("a == b\n");
  }
  

  return 0;
}

Measured memory_bytes: 580
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

class D {
    static void Main(string[] args) {
        var st = Console.ReadLine().Split().Select(int.Parse).ToArray();
        int N = st[0];
        int K = st[1];

        var p = Console.ReadLine().Split().Select(int.Parse).ToArray();

        float ans = 0;
        float kari;

        //累積和を使う！
        var E = new long[N + 2];

        E[0] = p.Take(K).Sum();

        for (int i = 1; i + K <= N; i++) {
            E[i] = E[i - 1] - p[i - 1] + p[i + K - 1];
        }


        for (int i = 0; i + K <= N; i++) {
            kari = 0;
            kari = E[i];

            kari += K;
            kari /= 2.0f;

            ans = Math.Max(ans, kari);
        }

        Console.WriteLine(ans);

    }
}

Measured memory_bytes: 30684