akhauriyash/Code-Regression huggingface dataset:
n,h,w = map(int,input().split())
a = []
b = []
count = 0
for i in range(n):
    a1,b1 = map(int,input().split())
    a.append(a1)
    b.append(b1)
for i in range(n):
    if a[i] >= h and b[i] >= w:
        count += 1
print(count)

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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, s, e) for (int i = (int)(s); i < (int)(e); i++)
#define _rep(i, n) for (int i = (int)(n - 1); i >= 0; i--)
#define _REP(i, e, s) for (int i = (int)(e - 1); i >= (int)(s); i--)

#define yes cout << "yes" << endl;
#define Yes cout << "Yes" << endl;
#define YES cout << "YES" << endl;

#define no cout << "no" << endl;
#define No cout << "No" << endl;
#define NO cout << "NO" << endl;

#define AC cout << "AC" << endl;
#define WA cout << "WA" << endl;

#define out(s) cout << s << endl;

#define ll long long
#define ull unsigned long long
#define vi vector<int>

const double PI = 3.14159265358979323846;

int main() {
    int A, B, C;
    cin >> A >> B >> C;
    if (C - A + B > 0) {
        out(C - A + B);
    } else {
        out(0);
    }
}

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

#define rep(i,n) for(int i=0;i<n;i++)
#define REP(n) rep(i,n)
#define all(n) n.begin(),n.end()

const int MAX = 7;

int main()
{
    int n;
    while(cin >> n && n)
    {
        int num[MAX] = {};
        int t = 0;

        REP(n)
        {
            cin >> t;
            if(t > 59){ num[6]++; continue;}
            num[t / 10]++;
        }

        REP(MAX) cout << num[i] << endl;
    }
    return 0;
}

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


int main(){
  long long h,n,i;
  cin >> h >> n;
  long long su=0;
  vector<long long> a(n);
  for(i=0;i<n;++i){
    cin >> a[i];
    su=su+a[i];
  }
  if(su>=h){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
  return 0;

}


Measured memory_bytes: 1024
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
 
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
 
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

n, k = MAP()
print(k * (k - 1) ** (n-1))


Measured memory_bytes: 5972
#include "bits/stdc++.h"
using namespace std;
long long w,h,x,y;
int main()
{
	cin>>w>>h>>x>>y;

	cout<<fixed<<setprecision(10)<<w*h/2.<<" ";

	if(w==2*x and h==2*y) cout<<1;
	else cout<<0;
	cout<<endl;
}

Measured memory_bytes: 256
n = int(input())
V = list(map(int, input().split()))
C = list(map(int, input().split()))
from itertools import product
max_total = 0
for lis in product((0, 1), repeat=n):
  total = 0
  for i, zero_one in enumerate(lis):
    total += (V[i]-C[i]) * zero_one
  max_total = max(max_total, total)
print(max_total)

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

using namespace std;

typedef long long ll;

const int MAX_N = 1e6 + 10;
const ll MOD = 998244353;

ll sq(ll x) { return x * x % MOD; }
ll qpow(ll a, ll b) { return b ? sq(qpow(a, b / 2)) * (b & 1 ? a : 1) % MOD : 1; }
ll inv(ll x) { return qpow(x, MOD - 2); }

int N, M;
ll fac[MAX_N], ifac[MAX_N], pow_n1[MAX_N], pow_m1[MAX_N];

ll comb(int n, int m) { return fac[n] * ifac[n - m] % MOD * ifac[m] % MOD; }

int main() {
    scanf("%d%d", &N, &M);
    fac[0] = 1;
    for (int i = 1; i <= N + M; i++) fac[i] = fac[i - 1] * i % MOD;
    ifac[N + M] = inv(fac[N + M]);
    for (int i = N + M; i; i--) ifac[i - 1] = ifac[i] * i % MOD;
    pow_n1[0] = pow_m1[0] = 1;
    for (int i = 1; i <= N + M; i++) {
        pow_n1[i] = pow_n1[i - 1] * (N + 1) % MOD;
        pow_m1[i] = pow_m1[i - 1] * (M + 1) % MOD;
    }
    ll ans = 0;
    for (int i = 0; i <= min(N, M); i++) {
        ll t = i & 1 ? MOD - 1 : 1;
        (t *= comb(N, i) * comb(M, i) % MOD) %= MOD;
        (t *= fac[i]) %= MOD;
        (t *= pow_n1[M - i] * pow_m1[N - i] % MOD) %= MOD;
        (ans += t) %= MOD;
    }
    printf("%lld\n", ans);
}


Measured memory_bytes: 31488
#include <stdio.h>

int main()
{
        long n;
        long max = -1000000, min = 1000000, sum = 0;

        scanf("%ld", &n);

        long number[n];
        for (int i = 0; i < n; i++) {
                scanf("%ld", &number[i]);
         
                if (max < number[i]) {
                        max = number[i];
                }

                if (number[i] < min) {
                        min = number[i];
                }

                sum = sum + number[i];

        }

        printf("%ld %ld %ld\n", min, max, sum);
        return 0;
}


Measured memory_bytes: 2832
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) (v).begin(), (v).end()
using namespace std;
typedef long long ll;

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

	bool flag = true;

	int len = (int)s.size();
	if (len != a + b + 1) flag = false;

	REP(i, a){
		if (!('0' <= s[i] && s[i] <= '9')) flag = false;
	}

	if (s[a] != '-') flag = false;

	FOR(i, a + 1, a + b + 1){
		if (!('0' <= s[i] && s[i] <= '9')) flag = false;
	}

	cout << (flag ? "Yes" : "No") << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define F first
#define S second
using namespace std;
using ll = long long;
typedef pair<int, int> P;
ll Mod = 1000000007;
int H,W;
int Ch,Cw;
int Dh,Dw;
int dx[4] = {1,-1,0,0};
int dy[4] = {0,0,-1,1};
char field[1100][1100];
ll dis[1100][1100];

void BFS() {
  priority_queue<pair<ll,P>, vector<pair<ll,P>>, greater<pair<ll,P>>> Q;
  Q.push(make_pair(0,make_pair(Ch,Cw)));
  while (!Q.empty()) {
    auto p = Q.top();
    Q.pop();
    if (dis[p.S.F][p.S.S] <= p.F) {
      continue;
    } else {
      dis[p.S.F][p.S.S] = p.F;
    }
    for (int i = 0; i < 4; i++) {
      int nx = dx[i] + p.S.F;
      int ny = dy[i] + p.S.S;
      if (0 <= nx && nx < H && 0 <= ny && ny < W) {
        if (dis[nx][ny] > p.F && field[nx][ny] != '#') {
          Q.push(make_pair(p.F,make_pair(nx,ny)));
        }
      }
    }
    for (int i = -2; i <= 2; i++) {
      for (int j = -2; j <= 2; j++) {
        if (i == 0 && j == 0) {
          continue;
        }
        int nx = p.S.F + i;
        int ny = p.S.S + j;
        if (0 <= nx && nx < H && 0 <= ny && ny < W) {
          if (dis[nx][ny] > p.F + 1 && field[nx][ny] != '#') {
            Q.push(make_pair(p.F + 1,make_pair(nx,ny)));
          }
        }
      }
    }
  }
}

int main() {
  cin >> H >> W;
  cin >> Ch >> Cw;
  cin >> Dh >> Dw;
  Ch--; Cw--; Dh--; Dw--;
  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) {
      cin >> field[i][j];
    }
  }
  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) {
      dis[i][j] = 9999999;
    }
  }

  BFS();

  if (dis[Dh][Dw] == 9999999) {
    cout << -1 << endl;
  } else {
    cout << dis[Dh][Dw] << endl;
  }
  return 0;
}

Measured memory_bytes: 14912
n=int(input())
a_list=list(map(int,input().split()))

max_value=0
for i in range(n-1):
    base_value=a_list[i]
    for j in range(i,n):
        max_value=max(max_value, abs(base_value-a_list[j]))

print(max_value)

Measured memory_bytes: 3060
#include <iostream>
#include <string>
#include <cmath>
#include <algorithm>
#include <vector>

using namespace std;

int main(){
    long x;
    cin >> x;
    long a = 0;
    long b = 0;
    for (long i=-120; i<=120; i++){
        for (long j=-120; j<=120; j++){
            if (pow(i, 5.0) - pow(j, 5.0) == x){
                a = i;
                b = j;
                break;
            }
        }
        
    }
    cout << a << " " << b << endl;
}

Measured memory_bytes: 4096
#include <bits/stdc++.h>
#define WHOLE(v) (v).begin(), (v).end()
#define REV_WHOLE(v) (v).rbegin(), (v).rend()
using i64 = int64_t;
using namespace std;
template<class F>auto recursive(F f){return[f](auto...a){return f(f,a...);};}
template<class I,class V=typename I::value_type>V sum_up(const I&l,const I&r){V v;for(I i=l;i!=r;i++)v=i==l?*i:v+*i;return v;}
template<class I,class T=iterator_traits<I>>I operator+(I it,int n){for(int i=0;i<n;i++)it++;return it;}
template<class I,class T=iterator_traits<I>>I operator-(I it,int n){for(int i=0;i<n;i++)it--;return it;}
template<class T>using rev_priority_queue=priority_queue<T,vector<T>,greater<T>>;
template<class T>using vector2d=vector<vector<T>>;
struct fixprec{int x;fixprec(int d):x(d){}};
ostream&operator<<(ostream&o,fixprec f){return o<<fixed<<setprecision(f.x);}
void R_YESNO(bool p) { cout << (p ? "YES" : "NO") << endl; }
void R_YesNo(bool p) { cout << (p ? "Yes" : "No") << endl; }

/*!* [prime] *!*/
/*+* 素数生成、素因数分解 *+*/

// 素数列を作る
// N: 上限, v: 出力先
struct PrimeSet {
    static vector<i64> p;
    static void Init(i64 N) {
        i64 c = 1;
        for (i64 c = 2; c <= N; c++) {
            bool flag = true;
            i64 d = (i64)sqrt(c);
            for (int i = 0; i < p.size(); i++) {
                if (c % p[i] == 0) {
                    flag = false;
                    break;
                }
                if (d < p[i]) break;
            }
            if (flag) p.push_back(c);
        }
    }
};
vector<i64> PrimeSet::p;
// 素因数分解を行う
// N: 対象, p: 素数セット(GetPrimesで取得), m: 因数分解形式のマップ
void Factorize(i64 N, map<i64, int> &m) {
    vector<i64> &p = PrimeSet::p;
    for (int i = 0; N != 1 && i < p.size(); i++) {
        while (N % p[i] == 0) {
            if (!m.count(p[i])) m[p[i]] = 0;
            N /= p[i];
            m[p[i]]++;
        }
    }
    if (N > 1) m[N] = 1;
}

int main() {
    i64 M = 1.1e6;
    PrimeSet::Init(M);
    i64 N;
    cin >> N;
    i64 ans = 0;

    map<i64, int> m;
    Factorize(N - 1, m);
    {
        i64 tmp = 1; // N - 1 の（１以外の）約数の数
        for(auto x : m) {
            tmp *= x.second + 1;
        }
        tmp--;
        ans += tmp;
    }
    m.clear();

    Factorize(N, m);
    vector<i64> v;
    for(auto x : m) v.push_back(x.first);

    recursive([&](auto f, int i, i64 x) {
        if(i == v.size()) {
            if(x == 1) return;
            i64 t = N;
            while(t % x == 0) t /= x;
            if(t % x == 1) ans++;
        } else {
            i64 r = 1;
            for(int j = 0; j <= m[v[i]]; j++) {
                f(f, i + 1, x * r);
                r *= v[i];
            }
        }
    })(0, 1);

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


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

using namespace std;
typedef long long int ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) for (int i = 0; i < (n); i++)
#define fst first
#define snd second
#define ALL(obj) (obj).begin(), (obj).end()
#define debug(x) cout << #x << ": " << x << endl
#define out(x) cout << x << endl
//#define int long long int
const int MOD = 1000000007;
const ll LINF = (ll)1e20;
const int INF = 1e9;
const double EPS = 0.000000001;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};


signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n, m;
  cin >> n >> m;
  VL x(n), y(m);
  REP(i, n) cin >> x[i];
  REP(i, m) cin >> y[i];
  ll xsum = 0; ll ysum = 0;
  REP(i, n) {xsum += (i * x[i] - (n - i - 1) * x[i]) % MOD; xsum = xsum % MOD;}
  REP(i, m) {ysum += (i * y[i] - (m - i - 1) * y[i]) % MOD; ysum = ysum % MOD;}
  ll ans = xsum * ysum % MOD;
  ans = ans % MOD;
  out(ans);
  return 0;
}


Measured memory_bytes: 1792
#include <iostream>

using namespace std;
int main() {
int n,a,b,min,max;
cin>>n>>a>>b;
min=a+b-n;
if(min<0)min=0;
if(a>=b){
    max=b;
}else{
    max=a;
}

    std::cout << max << " "<< min << std::endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
#include<stdio.h>
int main(){
	int i,p,h,w,j,o[100][100]={0};
	char a[100][100]={0};
	cin>>h>>w;
	for(i=0;i<h;i++){
		for(p=0;p<w;p++){
			cin>>a[i][p];
			if(a[i][p]=='.')
			o[i][p]=-1;
		}
	}
	for(i=0;i<h;i++){
		for(p=0;p<w;p++){
			if(o[i][p]==0){
				for(j=p+1;j<w;j++){
					if(o[i][j]==-1)
					o[i][j]=1;
					if(o[i][j-1]==1&&!o[i][j]==0)
					o[i][j]=2;
					if(o[i][j-1]>1&&!o[i][j]==0)
					o[i][j]=o[i][j-1]+1;
				}
			}
		}
	}
	for(i=0;i<h;i++){
		for(p=0;p<w;p++){
			cout<<o[i][p];
			if(i<h&&p<w-1)
			printf(" ");
		}
		
		printf("\n");
	}
	return 0;
}

Measured memory_bytes: 3140
#include <iostream>
#include <math.h>
#include <cstdio>
using namespace std; //pow(a,b)aのb乗を計算する
bool isprime(int n);

int main(){
	int n,x;
	int count = 0;
	cin >> n;

	for(int i = 0;i < n;i++){
		cin >> x;
		if(isprime(x)) count++;
	} 

	cout << count << endl;
	return 0 ;
}

bool isprime(int n){
	if(n == 2) return true;

	if(n < 2 || n%2 == 0) return false;

 	int i = 3;
 	while(i <= pow(n,0.5) ){
    	if(n % i == 0){
      		return false;
      	}
    	i = i + 2;
	}

 return true;
}


Measured memory_bytes: 3184
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (n); i++)
#define prtd(var, i) cout << fixed << setprecision(i) << var << endl;
#define ll long long
using namespace std;

int main(){
    int n, m, c, cnt = 0;
    cin >> n >> m >> c;
    vector<int> b(m);
    rep(i, m) cin >> b[i];
    rep(i, n){
        vector<int> a(m);
        ll ans = c;
        rep(j, m){
            int tt;
            cin >> tt;
            a[j] = tt;
            ans += a[j]*b[j];
        }
        if(ans > 0) cnt++;
    }
    cout << cnt << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>

using namespace std;

int main(){
	int n1,n2;
	char buf,*cf,*ct,*re;

	while(1){
		cin >> n1;
		if(n1 != 0){
			cf = new char[n1];
			ct = new char[n1];

			for(int i = 0; i < n1; i++){
				cin >> cf[i];
				cin >> ct[i];
			}

			cin >> n2;
			re = new char[n2];

			for(int i = 0; i < n2; i++){
				cin >> buf;

				for(int j = 0; j < n1; j++){
					if(buf == cf[j]){
						buf = ct[j];
						break;
					}
				}

				re[i] = buf;
			}

			for(int i = 0; i < n2; i++){
				cout << re[i];
			}
			cout << endl;
		}else{
			break;
		}
	}

	return 0;
}

Measured memory_bytes: 1000
#include <iostream>

using namespace std;

int main(){
    int n,a;
    int max = -10000000,min = 10000000;
    long sum=0;
    cin >> n;
    for(int i=0;i<n;++i){
        cin >> a;
        if(max<a){
            max = a;
        }
        if(min>a){
            min = a;
        }
        sum += a;
    }
    cout << min << " " << max << " " << sum << endl;
    return 0;
}


Measured memory_bytes: 3128
#include <iostream>
#include <vector>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define all(x) (x).begin(), (x).end()
#define dbg(x) cerr << #x << ": " << x << endl
int main() {
  int n, m;
  cin >> n >> m;
  vector<vector<int>> to(m, vector<int>(n));
  rep(i, m) {
    int k;
    cin >> k;
    rep(j, k) {
      int s;
      cin >> s;
      s--;
      to[i].push_back(s);
    }
  }
  vector<int> p(m);
  rep(i, m) cin >> p[i];
  int ans = 0;
  rep(bm, 1 << n) {
    bool ok = true;
    rep(i, m) {
      int cnt = 0;
      for(int j : to[i]) cnt += (bm >> j) & 1;
      if(cnt % 2 != p[i]) {
        ok = false;
        break;
      }
    }
    if(ok) ans++;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(){
  int y,x,d=1;
  
  scanf("%d%d",&x,&y);
  
  
  while(d!=0){
    d=x%y;
    x=y;
    y=d;
  }
    
  printf("%d\n",x);
  
  return 0;
}

Measured memory_bytes: 592
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < (int)n; i++)
int main()
{
  int n;
  cin >> n;
  vector<int > b(n - 1);
  vector<int > a(n);
  REP(i, n - 1) cin >> b[i];
  a[0] = b[0];
  a[n - 1] = b[n - 2];
  for(int i = 1; i < n - 1; i ++){
    a[i] = min(b[i - 1], b[i]);
  }
  int sum = 0;
  REP(i,n) sum+=a[i];
  cout << sum << endl;
}


Measured memory_bytes: 256
from bisect import bisect_left, bisect_right
from collections import Counter, defaultdict, deque, OrderedDict
from copy import deepcopy
from fractions import gcd
from functools import lru_cache, reduce
from math import ceil, floor
from sys import setrecursionlimit

import heapq
import itertools
import operator


# globals
inf = float('inf')
N = 0


def set_inputs():
    global N
    return


def main():
    setrecursionlimit(100000)
    set_inputs()
    # ----------MAIN----------
    a, b = get_li()
    print(max(a + a - 1, a + b, b + b - 1))
    return


def get_int():
    return int(input())


def get_float():
    return float(input())


def get_str():
    return input().strip()


def get_li():
    return [int(i) for i in input().split()]


def get_lf():
    return [float(f) for f in input().split()]


def get_lc():
    return list(input().strip())


def get_data(n, types, sep=None):
    if len(types) == 1:
        return [types[0](input()) for _ in range(n)]
    return list(zip(*(
        [t(x) for t, x in zip(types, input().split(sep=sep))]
        for _ in range(n)
    )))


if __name__ == '__main__':
    main()


Measured memory_bytes: 5780
#include<iostream>
#include<algorithm>
#include<string>
#include<sstream>
#include<numeric>
using namespace std;
long gcd(long a,long b){
  long ma = max(a,b);
  long mi = min(a,b);
  if(ma%mi==0) return mi;
  else return gcd(ma%mi,mi);
}
int main() {
  int n;
  cin >> n;
  long* a = new long[100000];
  for(int i=0;i<n;i++) cin >> a[i];
  sort(a,a+n);
  long gc = a[0];
  for(int i=0;i<n;i++) gc = gcd(gc,a[i]);
//  for(int i=0;i<n;i++) a[i]/=gc;
//
//  for(int i=n-1;i>0;i--){
//    a[i] = a[i] - a[i-1];
//  }
//  sort(a,a+n);
  cout << gc << endl;
  return 0;
}


Measured memory_bytes: 1024
# 幅優先探索（行きがけ）
import collections
import sys


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


def main():
    s = S()
    print(s[:3])


if __name__ == '__main__':
    main()


Measured memory_bytes: 9336
#include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000


int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    char A, B;
    cin >> A >> B;
    if(A < B) cout << "<" << endl;
    else if (A > B) cout << ">" << endl;
    else cout << "=" << endl;

    return 0;
}


Measured memory_bytes: 256
// Best dish by Chef at the Michelin's, Vatican
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef pair<int, int> pii;

const int maxN = 200000 + 5;
const int maxA = 1000000 + 5;
const LL P = 998244353;
int n;
LL a[maxN], c[maxA], f[maxA], q[maxA];

int main() {
#ifndef LOCAL
	ios::sync_with_stdio(false);
	cin.tie(0); cout.tie(0);
#endif
	cin >> n;
	for(int i = 1; i <= n; ++i) cin >> a[i];
	for(int i = 1; i <= n; ++i) c[a[i]]++;
	for(int i = 1; i < maxA; ++i) q[i] = 1;
	for(int i = 1; i < maxA; ++i)
		for(int j = i + i; j < maxA; j += i)
			(q[j] -= q[i] * (j / i)) %= P;
	for(int x = 1; x < maxA; ++x) for(int i = x; i < maxA; i += x)
		(f[x] += (LL)c[i] * q[x] % P * (i / x)) %= P;
	LL ans = 0;
	for(int x = 1; x < maxA; ++x) {
		(ans -= c[x] * x) %= P;
		for(int i = x; i < maxA; i += x) {
			(ans += (LL)c[i] * f[x] % P * i) %= P;
		}
	}
	LL res = (ans % P + P) % P;
	if(res & 1) res = (res + P) / 2; else res /= 2;
	cout << res << endl;
	return 0;
}



Measured memory_bytes: 25216
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fbo find_by_order
#define ook order_of_key

typedef long long ll;
typedef pair<ll,ll> ii;
typedef vector<ll> vi;
typedef long double ld; 
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;
typedef set<int>::iterator sit;
typedef map<int,int>::iterator mit;
typedef vector<int>::iterator vit;

ll a[200001];
int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0);
	int n; cin>>n;
	ll t; cin>>t;
	for(int i=0;i<n;i++) cin>>a[i];
	ll ans = 0;
	ll lastt = 0;
	ll finalt = 0;
	for(int i=0;i<n;i++)
	{
		if(i==0)
		{
			lastt=a[i];
			finalt=a[i]+t;
		}
		else
		{
			if(a[i]>finalt)
			{
				ans+=finalt-lastt;
				lastt=a[i];
				finalt=a[i]+t;
			}
			else
			{
				finalt=a[i]+t;
			}
		}
	}
	ans+=finalt-lastt;
	cout<<ans<<'\n';
		
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, start, n) for (ll i = (ll)(start); i < (ll)(n); ++i)
static const int INFTY = (1 << 30);
ll N, M;
void func()
{
    cin >> N;
    ll ans(0);
    // a[0] = 1;
    // a[1] = 1;
    // rep(i, 2, N + 1)
    // {
    //     a[i] = i * a[i - 2];
    //     if (i == 5 || i == 10)
    //         ++ans;
    // }
    if (N % 2)
        ans = 0;
    else
    {
        ll p = 10, q = 50, r = 250, s, count1 = 1, count2 = 1;
        while (p <= N)
        {
            ans += N / p;
            p *= 10;
        }
        while (q <= N)
        {
            ans += (N / q + 1) / 2;
            q *= 10;
        }
        while (r <= N)
        {
            s = r;
            while (s <= N)
            {
                ans += (N / s + 1) / 2;
                s *= 5;
            }
            r *= 10;
        }
    }

    cout << ans << endl;
}
int main()
{
    func();
}

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

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

#define sf scanf
#define pf printf
#define pb push_back
#define mp make_pair
#define PI ( acos(-1.0) )
#define mod 1000000007LL
#define maxn 100005
#define IN freopen("C.in","r",stdin)
#define OUT freopen("output.txt","w",stdout)
#define FOR(i,a,b) for(i=a ; i<=b ; i++)
#define DBG pf("Hi\n")
#define INF 1000000000000000000LL
#define i64 long long int
#define eps (1e-8)
#define xx first
#define yy second
#define ln 17
#define off 2
#define sq(x) ((x)*(x))

using namespace __gnu_pbds;
using namespace std ;

typedef tree< i64, null_type, less<i64>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
typedef pair<i64, i64> pii;

int main()
{
    i64 a , b , c , k ;

    cin>>a>>b>>c>>k ;

    i64 ans ;
    if( k%2==0 ) ans = a-b ;
    else ans = b-a ;

    printf("%lld\n",ans) ;

    return 0 ;
}


Measured memory_bytes: 256
#include <stdio.h>

int cnt[200010];

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

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

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

}

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

int main(){
  int N;
  cin >> N;
  int tmp = N;
  int counter = 1;
  
  map<int,int> m;
  m[N] = 1;
  while(true){
    counter++;
    
    if(tmp % 2 == 0){
      tmp = tmp / 2;
    } else { 
      tmp = tmp * 3 + 1;
    }
    if(m.count(tmp) == 0){
      m[tmp] = 1;
    } else { 
      break;
    }
  }
  cout << counter << endl;

}

Measured memory_bytes: 256
import fractions
a,b,c,d = map(int, input().split())
p = b//c + (-a//c) +1
q = b//d + (-a//d) +1
r = b*fractions.gcd(c,d)//(c*d) + (-a*fractions.gcd(c,d)//(c*d)) +1
print(b-a+1-p-q+r)

Measured memory_bytes: 5048
#include <stdio.h>

int main()
{
	int n;
	char st[100005];
	int sp = 0;
	int ch;
	int ans = 0;

	while ((ch = getchar()) != EOF && ch != '\n') {
		sp++;

		st[sp] = ch;

		if (sp > 1 && st[sp] != st[sp - 1]) { 
			ans += 2;
			sp -= 2;
		}
	}

	printf("%d\n", ans);

	return 0;
}


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

int main(){
    int h=70;
    int w=70;
    int a, b;
    cin>>a>>b;

    cout<<w<<" "<<h<<endl;

    int ra=a-1;
    int rb=b-1;
    for(int i=0; i<h/2; i++){
        for(int j=0; j<w; j++){
            if(i%2==0 && j%2==0 && ra>0){
                cout<<".";
                ra--;
            }
            else cout<<"#";
        }
        cout<<endl;
    }
    for(int i=0; i<h/2; i++){
        for(int j=0; j<w; j++){
            if(i%2==1 && j%2==0 && rb>0){
                cout<<"#";
                rb--;
            }
            else cout<<".";
        }
        cout<<endl;
    }

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <math.h>
#define REP(i, n) for(int i = 0; i < (n); i++)
#define ALL(v) (v).begin(), (v).end()
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1001001001;
const int mINF = -1001001001;


int main() {
int n;
int ans = 0;
cin >> n;
int a[n],b[n],c[n-1];
REP(i,n) cin >> a[i];
REP(i,n) {
  cin >> b[i]; 
  ans += b[i];
}
REP(i,n-1) cin >> c[i];
REP(i,n-1) {
  if(a[i]+1==a[i+1]) {
    ans += c[a[i]-1];
  }
}
cout << ans << endl;
return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i= (a); i<((int)b); ++i)
#define RFOR(i,a) for(int i=(a); i >= 0; --i)
#define FOE(i,a) for(auto i : a)
#define ALL(c) (c).begin(), (c).end()
#define RALL(c) (c).rbegin(), (c).rend()
#define DUMP(x)  cerr << #x << " = " << (x) << endl;
#define SUM(x) std::accumulate(ALL(x), 0LL)
#define MIN(v) *std::min_element(v.begin(), v.end())
#define MAX(v) *std::max_element(v.begin(), v.end())
#define EXIST(v,x) (std::find(v.begin(), v.end(), x) != v.end())
#define BIT(n) (1LL<<(n))
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end());

typedef long long LL;
template<typename T> using V = std::vector<T>;
template<typename T> using VV = std::vector<std::vector<T>>;
template<typename T> using VVV = std::vector<std::vector<std::vector<T>>>;
template<class T> inline T ceil(T a, T b) { return (a + b - 1) / b; }
template<class T> inline void print(T x) { std::cout << x << std::endl; }
template<class T> inline bool inside(T y, T x, T H, T W) {return 0 <= y and y < H and 0 <= x and x < W; }
inline double distance(double y1, double x1, double y2, double x2) { return sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2)); }

const int INF = 1L << 30;
const double EPS = 1e-9;
const std::string YES = "YES", Yes = "Yes", NO = "NO", No = "No";
const std::vector<int> dy = { 0, 1, 0, -1 }, dx = { 1, 0, -1, 0 };    // 4近傍（右, 下, 左, 上）

using namespace std;



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

    vector<LL> height(N);
    FOR(i, 0, N) {
        cin >> height[i];
    }

    // L
    vector<int> L(N);
    {
        int t = 0; // スタックのサイズ
        int st[N];
        for (int i = 0; i < N; ++i) {
            while (t > 0 and height[st[t - 1]] >= height[i]) {
                t--;
            }
            L[i] = (t == 0 ? 0 : (st[t - 1] + 1));
            st[t++] = i;
        }
    }

    // R
    vector<int> R(N);
    {
        int t = 0;
        int st[N];
        for (int i = N - 1; i >= 0; i--) {
            while (t > 0 and height[st[t - 1]] >= height[i]) {
                t--;
            }
            R[i] = (t == 0 ? N : st[t - 1]);
            st[t++] = i;
        }
    }

    long long ans = 0;
    for (int i = 0; i < N; i++) {
        ans = max(ans, (long long)height[i] * (R[i] - L[i]));
    }

    print(ans);
    return 0;
}


Measured memory_bytes: 4808
package main

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

var scan *bufio.Scanner
var writer io.Writer

func init() {
	scan = bufio.NewScanner(os.Stdin)
	writer = os.Stdout
	scan.Split(bufio.ScanWords)
}

func main() {
	solve()
}

func solve() {
	n := nextInt()
	res := math.Pow(float64(n), 3)
	fmt.Fprint(writer, res)
}

func nextWord() string {
	scan.Scan()
	str := scan.Text()
	return str
}

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


Measured memory_bytes: 640
from collections import deque
n, m = map(int, input().split())
edges = [[] for _ in range(n+1)]
for _ in range(m):
	a, b = map(int, input().split())
	edges[a].append(b)
	edges[b].append(a)
ans = deque([1, edges[1][0]])
used = [False] * (n+1)
used[1], used[edges[1][0]] = True, True
#print(ans)
while True:
	ok = True
	for e in edges[ans[0]]:
		if used[e] == False:
			ans.appendleft(e)
			used[e] = True
			ok = False
			break
	for e in edges[ans[-1]]:
		#print(e)
		if used[e] == False:
			ans.append(e)
			used[e] = True
			ok = False
			break

	if ok:
		break

print(len(ans))
print(*ans)

Measured memory_bytes: 25508
#include <iostream>
#include <math.h>
#include <vector>
#include <map>
#include <stack>
#include <queue>
#include <set>
#include <algorithm>
#include <iomanip>
#include <string.h>

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

typedef long long lint;

using namespace std;

int main(){
  int A[3];
  REP(i,3)cin>>A[i];
  sort(A,A+3);
  int ans=0;
  ans+=A[2]-A[1];
  A[0]+=ans;
  A[1]+=ans;
  int d=(A[2]-A[0]+1)/2;
  ans+=d;
  A[0]+=2*d;
  if(A[0]!=A[2])ans++;
  cout<<ans<<endl;
  return 0;
}


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

#define SPEED cin.tie(0);ios::sync_with_stdio(false);
template <class T> void chmax(T& a, const T b){a=max(a,b);}

int main() {
    SPEED
    int N; cin >> N;
    vector<int> V(N+1),W(N+1);
    for(int i = 1; i <= N; ++i) cin >> V[i] >> W[i];

    //O(Q)
    int nl = 1<<10,nr=1<<8,L_max=100001;
    vector<int> msb(nl,0);
    for(int i = 1; i < nl; ++i) msb[i]=31-__builtin_clz(i);
    vector<int> bit_w_dp(nl,0);
    vector<int> bit_v_dp(nl,0);
    vector<vector<int>> dp(nl,vector<int>(L_max,0));

    //前計算
    for(int n = 1; n < min(nl,N+1); ++n) {
        int k = 2*n;
        vector<int> l;
        while(k/=2) l.push_back(k);
        int sz=l.size();
        //bit全探索
        for(int i = 1; i < (1<<sz); ++i) {
            bit_w_dp[i]=bit_w_dp[i^(1<<msb[i])]+W[l[msb[i]]];
            bit_v_dp[i]=bit_v_dp[i^(1<<msb[i])]+V[l[msb[i]]];
            if(bit_w_dp[i]<=L_max) chmax(dp[n][bit_w_dp[i]],bit_v_dp[i]);
        }
        //累積max
        for(int i = 1; i < L_max; ++i) {
            chmax(dp[n][i],dp[n][i-1]);
        }
    }

    int Q; cin >> Q;
    string ans_str="";

    //クエリ
    while(Q--) {
        int p,L,l_idx=0;; cin >> p >> L;
        vector<int> r;
        p *= 2;
        while(p/=2) {
            if(p<nl) chmax(l_idx,p);
            else r.push_back(p);
        }
        int sz = r.size(),ans=dp[l_idx][L];
        //bit全探索
        for(int i = 1; i < (1<<sz); ++i) {
            bit_w_dp[i]=bit_w_dp[i^(1<<msb[i])]+W[r[msb[i]]];
            bit_v_dp[i]=bit_v_dp[i^(1<<msb[i])]+V[r[msb[i]]];
            if(bit_w_dp[i]<=L) chmax(ans,dp[l_idx][L - bit_w_dp[i]]+bit_v_dp[i]);
        }
        ans_str += to_string(ans)+"\n";
    }
    cout << ans_str;

    return 0;
}


Measured memory_bytes: 408252
#include <stdio.h>
    
    int main(void){
	 int a,b;
	scanf("%d %d",&a,&b); 
	if(a%3==0 ||b%3==0 ||(a+b)%3==0)
		printf("Possible\n");
	else printf("Impossible\n");
	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <limits>
#include <unordered_map>

using namespace std;
using str = string;

#define rep(a,l,r) for(int a=(l);a<(r);a++)
#define get cin>>
#define put cout<<

void run() {

	int a; get a;
	int b; get b;
	int c; get c;
	int d; get d;

	if (abs(a - c) <= d){
		put "Yes";
		return;
	}

	if (abs(a - b) <= d && abs(b - c) <= d){
		put "Yes";
	} else {
		put "No";
	}

	return;

}

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


Measured memory_bytes: 256
# AOJ 0044 Prime Number II
# Python3 2018.6.16 bal4u

MAX = 50025
SQRT = 223     # sqrt(MAX)

prime = [True for i in range(MAX)]
def sieve():
	for i in range(4, MAX, 2):
		prime[i] = False
	for i in range(3, SQRT, 2):
		if prime[i] is True:
			for j in range(i*i, MAX, i):
				prime[j] = False
sieve()

while True:
	try:
		n = int(input())
	except EOFError:
		break
		
	for i in range(n-1, 1, -1):
		if prime[i]:
			a = i
			break
	for i in range(n+1, MAX):
		if prime[i]:
			b = i
			break    
	print(a, b)


Measured memory_bytes: 5908
#include <iostream>
#include <string>
#include <math.h>
using namespace std;

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


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

namespace AtCoder_20190707_1
{    class Program
    {
        static int N = 0;
        static void Main(string[] args)
        {
            string[] s = Console.ReadLine().Split(' ');
            N = int.Parse(s[0]);
            int K = int.Parse(s[1]);

            long answer = 0;

            for (int i = K; i <= N + 1; i++)
            {
                answer += cal(i) ;
                answer %= 1000000007;
            }

            Console.WriteLine(answer);
        }

        static long cal(long count)
        {
            return (count * ((N - count + 1) + N) / 2) - (count * (0 + (count - 1)) / 2) + 1;
        }
    }
}

Measured memory_bytes: 27512
object Main extends App {
  import scala.io.StdIn.readLine

  val in = readLine().split(" ").map(_.toInt)
  val N = in(0);
  val i = in(1);

  val res =
    if (N == i) 1
    else if (i == 1) N
    else N - i + 1

  println(res)
}

Measured memory_bytes: 25524
#define D(x) cout << #x " = " << x << endl
#define DD(x, y) cout << "(" #x ", " #y ") = (" << x << ", " << y << ")" << endl
#define DDD(x, y, z) cout << "(" #x ", " #y ", " #z ") = (" << x << ", " << y << ", " << z << ")" << endl
#define DV(v) for (auto __macro_vi : v){ cout << __macro_vi << " ";} cout << endl;
#define DA(a, n) for (int __macro_i = 0; __macro_i < n; ++__macro_i) { cout << a[__macro_i] << " "; } cout << endl;
#define REP(i, n) for (int i = 0; i < n; ++i)
#define ALL(v) (v).begin(), (v).end()
#include<iostream>
#include<vector>
#include<cassert>
#include<cmath>
#include<string>
template<class T, class U> std::ostream& operator<<(std::ostream& os, const std::pair<T, U>& p){ os << "(" << p.first << ", " <<  p.second << ")"; return os; }

using namespace std;
vector<vector<int>> nex;
string s, t;

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> s >> t;
    int n = s.size();
    nex = vector<vector<int>>(n, vector<int>(26));
    auto ds = s + s;
    vector<int> last(26, -1);
    for (int i = n * 2 - 1; i >= n; --i) {
        int c = ds[i] - 'a';
        last[c] = i;
    }
    for (int i = n - 1; i >= 0; --i) {
        REP(k, 26) {
            nex[i][k] = last[k] == -1 ? -1 : last[k] - i;
        }
        int c = ds[i] - 'a';
        last[c] = i;
    }
    // DV("abcdefghijklmnopqrstuvwxyz");
    // REP(i, n) {
    //     REP(k, 26) {
    //         cout << (nex[i][k] == -1 ? "." : to_string(nex[i][k])) << " ";
    //     }
    //     cout << endl;
    // }

    int cur = 0;
    while(cur < n && s[cur] != t[0]) cur++;
    if (cur == n) {cout << -1 << endl; return 0;}
    long long ans = cur;
    // D(cur);
    int ni = 1;
    while(ni < t.size()) {
        int skip = nex[ans % n][t[ni] - 'a'];
        if (skip == -1) {cout << -1 << endl; return 0;}
        cur = (cur + skip) % n;
        // D(skip);
        ans += skip;
        ni++;
    }
    ans++;
    cout << ans << endl;
}


Measured memory_bytes: 14080
import sys
a=[[int(x) for x in input().split()] for i in range(3)]
n=int(input())
for i in range(n):
  bi = int(input())
  for j in range(3):
    if bi in a[j]:
      a[j][a[j].index(bi)] = 0
  # 判定
  for j in range(3):
    x = [a[k][j] for k in range(3)]
    if (not any(x)) or (not any(a[j])):
      print('Yes')
      sys.exit()
  if not any([a[0][0],a[1][1],a[2][2]]):
    print('Yes')
    sys.exit()
  if not any([a[2][0],a[1][1],a[0][2]]):
    print('Yes')
    sys.exit()
print('No')

Measured memory_bytes: 3064
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <limits.h>
#include <float.h>
#include <numeric>
#include <queue>
#include <typeinfo>
#include <memory>

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;

#define fs first
#define sc second


int main(){
    int N, K;
    ll v[100];
    cin >> N >> K;
    for(int i = 0; i < N; i++){
        cin >> v[i];
    }

    ll res = 0;
    for(int i = 0; i <= N; i++){
        for(int j = N; j >= i-1; j--){
            int k = K;
            ll su = 0;
            vector<ll> mi_vec;
            for(int t = 0; t < i; t++){
                su += v[t];
                if(v[t] < 0){
                    mi_vec.push_back(v[t]);
                }
                k--;
            }
            for(int t = N-1; t > j; t--){
                su += v[t];
                if(v[t] < 0){
                    mi_vec.push_back(v[t]);
                }
                k--;
            }
            if(k < 0){
                continue;
            }
            else{
                sort(mi_vec.begin(), mi_vec.end());
                for(auto x: mi_vec){
                    if(k > 0){
                        su -= x;
                        k--;
                    }
                    else{
                        break;
                    }
                }
            }
            res = max(res, su);
        }
    }

    cout << res << endl;


    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
using namespace std;
typedef long long  ll;
typedef unsigned long long ul;
typedef unsigned int ui;
const ll mod = 1000000007;
typedef double ld;
typedef complex<ld> Point;
const ll INF = mod * mod;
typedef pair<int, int> P;
#define rep(i,a,b) for(int i=a;i<b;i++)
#define per(i,a,b) for(int i=a;i>b;i--)
#define rep0(i,n) for(int i=0;i<n;i++)
#define per0(i,n) for(int i=n;i>=0;i--)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
const ld eps = 1e-6;
const ld pi = acos(-1.0);
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
 

bool is_Prime(int a){
    bool flag = true;
    rep(i, 2, int(sqrt(a))+1){
        if(a % i == 0){ flag = false; break;}
    }
    return flag;
}
void solve() {
    int x; cin >> x;
    //cout << is_Prime(x);
    while(!is_Prime(x)){
        x++;
    }
    cout << x;
}

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

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

using namespace std;

typedef pair<int, int> II;
typedef pair<long long, int> LLI;
typedef long long LL;
typedef unsigned long long ULL;
typedef vector<int> VI;
typedef vector<II> VII;

#define For(i,a,b) for(int i = a;i <= b; i++)
#define Rep(i,a,b) for(int i = a;i >= b; i--)
#define REP(i, n) for(int i = 0; i < n; i++)
#define FOR(i, f) for(auto i : f)
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define BUG(x) (cerr << #x << " = " << x << "\n")
#define ARRAY(f) {cerr << #f << " = "; FOR(i, f) cout << i << ' '; cout << "\n";}
#define sz(s) int(s.size())
#define reset(f, x) memset(f, x, sizeof(f))
#define all(x) x.begin(), x.end()
#define two(x) (1LL << x)
#define bit(x, i) ((x >> (i)) & 1LL)
#define onbit(x, i) (x | (1LL << (i)))
#define offbit(x, i) (x & ~(1 << (i)))

const int N = 1e5 + 10;
const int MOD = 1e9 + 7;

int n, a[N], inv[N], ps[N], fact;

int mul(int a, int b)
{
    return LL(a)*b % MOD;
}

int add(int a, int b)
{
    a += b;
    while (a >= MOD) a -= MOD;
    while (a < 0) a += MOD;
    return a;
}

int pw(int a, int n)
{
    int ans = 1;
    for (; n; n >>= 1)
    {
        if (n & 1) ans = mul(ans, a);
        a = mul(a, a);
    }
    return ans;
}

void init()
{
    fact = 1;
    For(i, 1, n)
    {
        inv[i] = pw(i, MOD-2);
        ps[i] = add(ps[i-1], inv[i]);
        fact = mul(fact, i);
    }
}

void solve()
{
    int res = 0;
    //cerr << n << "\n";
    For(i, 1, n)
    {
        int t = add(ps[i], ps[n-i+1]-ps[1]);
        //For(j, 1, n) t = add(t, inv[abs(i-j)+1]);
        //cerr << i << ' ' << t << "\n";
        res = add(res, mul(a[i], t));
    }
    res = mul(res, fact);
    cout << res << "\n";
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    srand(time(NULL));
    #ifndef ONLINE_JUDGE
       // freopen("in.txt","r",stdin);
        //freopen("","w",stdout);
    #endif
    cin >> n;
    //cerr << n << "\n";
    For(i, 1, n) cin >> a[i];
    init();
    solve();
}


Measured memory_bytes: 1408
#include <iostream>
#include <cmath>
#include <climits>
#include <algorithm>
#include <vector>
#include <unordered_map>
#include <unordered_set>
#include <stack>
#include <list>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <string.h>
#include <iomanip>
#include <ctype.h>

#define ll          long long int
#define ull         unsigned long long int
#define pb          push_back
#define pii         pair<int,int>
#define F           first
#define S           second
#define vi          vector<int>
#define vli          vector<ll>
#define vii         vector<pii>
#define mi          map<int,int>
#define mii         map<pii,int>
#define M_PI        3.14159265358979323846
#define mp          make_pair
#define sz(x)       (int)x.size()
//#define hell        1000000007
#define matrix      vector<vector<ll>>
#define forn(i,a,b)  for(int i=a;i<b;i++)
#define eps 0.000000001
#define all(a)      (a).begin(),(a).end()
const long long INF = (long long) 1e7+1;
const long long mod = (long long) 998244353;
const long long hell = (long long) 1000000007;

using namespace std;
#include <stdio.h>
ll m;
ll power(ll x,ll y)
{
  ll res=1;
  while(y>0)
  {
    if(y%2) res=(x*res);
    x=(x*x);
    y=y/2;
  }
  return res;
}

ll modinv(ll x){
  return power(x,hell-2);
}

void solve();


void fastIO() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
}

int main(){
   fastIO();
    solve();
}
//void sieve();
ll pw(ll k,ll x);
ll gcd(ll x,ll y);

/*
  For freq or prime factors

for(auto pri:prime){
  while(k%pri==0){
    pcnt[pri]++;
    k/=pri;
  }
}*/
vi gr[1000001];
int ans;

void dfs(int v,int cnt,int p){
    ans=max(ans,cnt);
    int x=gr[v].size();
    if(p==-1)
    x--;
    else
    x-=2;
    for(auto u:gr[v]){
        if(u!=p){
            dfs(u,cnt+x,v);
        }
    }
}

void solve(){
  int test;
  //cin>>test;
  test=1;
  while(test--){
       char c;
       cin>>c;
       char ans=c+1;
       cout<<ans;
  }    
}    

    


/*bool issafe(int x,int y){
  return (x>=0 && y>=0 && x<n && y<m);
}*/

///Before submit=>
///    *check for integer overflow,array bounds
///    *check for n=1

ll gcd(ll x,ll y){
  if(x==0)
  return y;
  else
  return gcd(y%x,x);
}


ll pw(ll k,ll x){
  if(x==0)
  return 1;
  if(x&1)
  return ((pw(k,x-1))*k);
  else
  return ((pw(k,x/2))*(pw(k,x/2)));
}


Measured memory_bytes: 23808
import sys
n,m = map(int,input().split())
x = sorted(list(map(int,input().split())))

if n >= len(x):
    print(0)
    sys.exit()
lis = []    
for i in range(m-1):
    lis.append(abs(x[i+1]-x[i]))
lis = sorted(lis,reverse = True)    
print(sum(lis) - sum(lis[:n-1]))

Measured memory_bytes: 13968
//#pragma comment(linker, "/stack:200000000")
//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#pragma GCC optimize("no-stack-protector")
//#pragma GCC push_options
//#pragma GCC optimize ("unroll-loops")
//#pragma GCC pop_options
//#pragma GCC target("popcnt")
//#pragma GCC target("sse4")
#include<bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define rng(a) a.begin(),a.end()
#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define rep(i, n) for (int i = 0; i < n; i++)
#define per(i, n) for (int i = n - 1; i > -1; i--)
#define rer(i, x, n) for (int i = x; i < n; i++)
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef long double ld;












    int n, x, y;
    vector<int> dist;
    vector<vector<int> > g;
void dfs(int v){
    queue<pair<int,int> > q;
    vector<bool> used(n);
    q.push({v, 0});
    while(q.size() != 0){
        int vv = q.front().fi;
        int lvl = q.front().se;
        used[v] = 1;
        q.pop();
        if (lvl) dist[lvl - 1]++;
        for (int i = 0; i < g[vv].size(); i++){
            int to = g[vv][i];
            if (used[to]) continue;
            q.push({to, lvl + 1});
            used[to] = 1;
        }
    }
}

signed main(){
    cin >> n >> x >> y;
    g.resize(n);
    dist.resize(n - 1);
    for (int i = 0; i < n - 1; i++){
        g[i].pb(i + 1);
        g[i + 1].pb(i);
    }
    x--, y--;
    g[x].pb(y);
    g[y].pb(x);
    for (int i = 0; i < n; i++){
        dfs(i);
    }

    for (int i = 0; i < n - 1; i++) cout << dist[i] / 2 << endl;


}


Measured memory_bytes: 384
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input!{
        n: usize,
    };
    let s = format!("{}", n).into_bytes();
    let h = match *s.last().unwrap() - 48 {
        2 | 4 | 5 | 7 | 9 => "hon",
        0 | 1 | 6 | 8 => "pon",
        3 => "bon",
        _ => unreachable!()
    };
    println!("{}", h);
}


Measured memory_bytes: 2152