akhauriyash/Code-Regression huggingface dataset:
#include<cstdio>
#include<cstring>
#include<vector>
#include<queue>
#include<algorithm>
#include<cmath>
#include<climits>
#include<string>
#include<set>
#include<numeric>
#include<map>
#include<iostream>
#include<iomanip>
using namespace std;
#define rep(i,n) for(int i = 0;i<((int)(n));i++)
#define reg(i,a,b) for(int i = ((int)(a));i<=((int)(b));i++)
#define irep(i,n) for(int i = ((int)(n)-1);i>=0;i--)
#define ireg(i,a,b) for(int i = ((int)(b));i>=((int)(a));i--)
typedef long long ll;
typedef pair<ll, ll> mp;


/*
*/

ll a[10];

int main(void){
	rep(i,4){
		ll b;
		cin>>b;
		a[b]++;
	}
	if(a[1]==1 && a[9]==1 && a[7]==1 && a[4]==1){
		cout<<"YES"<<endl;
	}else{
		cout<<"NO"<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
#ifdef LOCAL
#include <cstdio>
#include <vector>
#include <algorithm>
#include <iostream>
#include <cstring>
#else
#include <bits/stdc++.h>
#endif
using namespace std ;

typedef long long ll ;
#define rep(i , n ) for ( int i =0; i < n ; i++)
#define _sort(arg) sort(begin(arg), end(arg))
#define MOD 1000000007
#define pb push_back
#define DEBUG(x) cout << #x << ": " << x << endl;

/*
__attribute__((constructor))
void initial()
{
	cin.tie(NULL);
	ios::sync_with_stdio(false);
}
*/

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

	int n;
	
	cin >> n;

	int a[n];

	int total = 0;

	rep(i, n)
	{
		cin >> a[i];
		total += a[i] - 1;
	}

	cout << total << endl;
	
	return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <queue>
#include <map>
#include <string>
using namespace std;
typedef long long LL;

string s[200005];
LL n,cnt = 0;
LL a[55];

void dfs(LL dep,LL tmp,LL lim){
	if(cnt > 100000) return;
	if(dep > lim){
		s[++ cnt] = "";
		for(LL i = 1;i <= lim;i ++) s[cnt] += (char)(a[i] + 48);
		return;
	}
	for(LL i = tmp - 1;i <= tmp + 1;i ++){
		if(i < 0 || i > 9) continue;
		a[dep] = i;
		dfs(dep + 1,i,lim);
		a[dep] = 0;
	}
}

int main(){
	ios::sync_with_stdio(false);
	for(LL i = 1;i <= 10;i ++){
		for(LL j = 1;j <= 9;j ++){
			a[1] = j;
			dfs(2,j,i);
		}
	}
	cin >> n;
	cout << s[n] << endl;
	return 0;
}
//

Measured memory_bytes: 7808
a,b=map(int,input().split())
s=list(input())
if s[a]!='-':
  print('No')
  exit()
s.pop(a)
num=list('0123456789')
for i in range(a+b):
  if s[i] in num:
    continue
  else:
    print('No')
    exit()
print('Yes')

Measured memory_bytes: 3060
package main

import (
	"fmt"
	"sort"
)

type number struct {
	n   int
	i   int
	ans int
}

type lessFunc func(r1, r2 *number) bool

type multiSorter struct {
	numbers []number
	less    []lessFunc
}

func (ms *multiSorter) Sort(numbers []number) {
	ms.numbers = numbers
	sort.Sort(ms)
}

func orderedBy(less ...lessFunc) *multiSorter {
	return &multiSorter{
		less: less,
	}
}

func (ms *multiSorter) Len() int      { return len(ms.numbers) }
func (ms *multiSorter) Swap(i, j int) { ms.numbers[i], ms.numbers[j] = ms.numbers[j], ms.numbers[i] }
func (ms *multiSorter) Less(i, j int) bool {
	p, q := &ms.numbers[i], &ms.numbers[j]
	var k int
	for k = 0; k < len(ms.less)-1; k++ {
		less := ms.less[k]
		switch {
		case less(p, q):
			return true
		case less(q, p):
			return false
		}
	}
	return ms.less[k](p, q)
}

func main() {
	ascending := func(r1, r2 *number) bool {
		return r1.n < r2.n
	}
	byIndex := func(r1, r2 *number) bool {
		return r1.i < r2.i
	}

	var N int
	fmt.Scan(&N)
	numbers := make([]number, N)
	for i := range numbers {
		fmt.Scan(&numbers[i].n)
		numbers[i].i = i
	}

	orderedBy(ascending).Sort(numbers)

	for i := range numbers {
		if i+1 <= N/2 {
			numbers[i].ans = numbers[N/2].n
		} else {
			numbers[i].ans = numbers[N/2-1].n
		}
	}

	orderedBy(byIndex).Sort(numbers)

	for _, number := range numbers {
		fmt.Println(number.ans)
	}
}


Measured memory_bytes: 12420
#include <iostream>
#include <ccomplex>
#include <vector>
#include <cassert>
#include <utility>
#include <algorithm>
#include <string>
#include <deque>
#include <queue>
#include <functional>
#include <cmath>
#include <iomanip>
#include <map>
#include <numeric>
#include <list>
#include <assert.h>
#include <math.h>
#include <valarray>
#include <stdio.h>
#include <algorithm>
#include <set>
#include <complex>
#include <list>
#include <time.h>
#include <stack>
#include <locale>
#include <clocale>
#include <ctype.h>
#include <wchar.h>
#include <random>
#include <vector>
#include <unordered_map>
#include <bitset>

using namespace std;
typedef long long int LL;
typedef long long int ll;
typedef pair<long long int, long long int> pii;
typedef pair<double, double> pdd;

#define SORT(c) sort((c).begin(),(c).end())
#define BACKSORT(c) sort((c).begin(),(c).end(),std::greater<LL>())
#define FOR(i,a,b) for(LL i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

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

  LL N, M;
  cin >> N >> M;

  vector<LL> X(M);

  REP(i,M){
    cin >> X[i];
  }

  SORT(X);

  vector<LL> Y(M - 1);

  REP(i,M-1){
    Y[i] = X[i + 1] - X[i];
  }

  SORT(Y);

  LL sum = 0;

  REP(i,M-1-(N-1)){
    sum += Y[i];
  }

  cout << sum << endl;
}


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

typedef long long int ll;
#define PI 3.14159265

int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ll n;
  cin>>n;
  int ans=n%10;
  if(ans==3){
    cout<<"bon"<<endl;
  }
  else if(ans==0||ans==1||ans==6||ans==8){
    cout<<"pon"<<endl;
  }
  else{
    cout<<"hon"<<endl;
  }
  return 0;
}


Measured memory_bytes: 3656
N = int(input())
S = input()
leader = [0] * (N)
sum_e = 0
sum_w = 0
for i in range(N):
  leader[i] += sum_e
  leader[N-i-1] += sum_w
  if S[i] == 'E':
    sum_e += 1
  if S[N-i-1] == 'W':
    sum_w += 1
print(N-max(leader)-1)

Measured memory_bytes: 15292
#include<stdio.h>
int main(){
	int H,W,h,w,cnt1=0,cnt2=0;
	scanf("%d%d",&H,&W);
	scanf("%d%d",&h,&w);
	for(int i=0; i<H; i++)
	for(int j=0; j<W; j++)
	if(i%h==0 && j%w==0)
		cnt1++;
	else
		cnt2++;
	if(cnt2 < (h*w-1LL) * cnt1){
		puts("Yes");

		long long int v = 1, u;
		while(true){
			long long int L = cnt2 * v / cnt1 + 1;
			long long int R = (h*w-1) * v - 1;
			if(L <= R){
				u = L;
				break;
			}
			v++;
		}

		for(int i=0; i<H; i++)
		for(int j=0; j<W; j++){
			if(i%h==0 && j%w==0)
				printf("%d",(int)u);
			else
				printf("%d",(int)(-v));
			if(j==W-1)printf("\n");else
				printf(" ");
		}
	}else
		puts("No");
	return 0;
}


Measured memory_bytes: 1280
#include <iostream>
#include <map>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <sstream>
#include <cmath>
#include <math.h>
#include <string>
using namespace std;
typedef long long ll;
   
int main() {
    ios::sync_with_stdio(false);
    cin.tie();
    string a , b;
    cin >> a >> b;
    sort( a.begin() , a.end() );
    sort( b.begin() , b.end() );
    reverse( b.begin() , b.end() );
    if( a < b ) cout << "Yes";
    else cout << "No";
}


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

int main(){
    ll n, m;
    cin >> n >> m;

    ll a[m];
    for(ll i = 0; i < m; i++){
        cin >> a[i];
        n -= a[i];
        if(n < 0){
            break;
        }
    }

    if(n < 0){
        cout << -1 << endl;
    }else{
        cout << n << endl;
    }
}

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

using namespace std;
using ll = long long;


int main() {
    int n, k;
    scanf("%d %d", &n, &k);
    if (k == 0) {
        for (int i = 0; i < (1 << n); i++)
            printf("%d %d ", i, i);
        return 0;
    }
    if(k >= (1<<n) || n <= 1) {
        puts("-1");
        return 0;
    }

    for (int i = 0; i < (1 << n); i++)
        if (i != k) printf("%d ", i);
    printf("%d ", k);
    for (int i = (1 << n) - 1; i >= 0; i--)
        if (i != k) printf("%d ", i);
    printf("%d ", k);

}


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

#include <iostream>
#include <fstream>

#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <bitset>
#include <random>
#include <chrono>
#include <complex>
#include <algorithm>
#include <utility>
#include <functional>
#include <cmath>
#include <cstring>
#include <cassert>
#include <cstdio>
#include <cstdlib>
#include <ctime>

using namespace std;

#define sqr(x) ((x)*(x))
#define mp make_pair
#define pb push_back
#define FOR(i,a,b) for (int i = (a); i <= (b); i++)
#define RE(i, n) FOR(i,1,n)
#define REP(i,n) FOR(i, 0, (int)(n)-1)
#define fst first
#define snd second

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;
typedef pair<ll, ll> pll;
typedef long double ld;

string to_string(string s) {
    return '"' + s + '"';
}

string to_string(const char* s) {
    return to_string((string) s);
}

string to_string(bool b) {
    return (b ? "true" : "false");
}

template <typename A, typename B>
string to_string(pair<A, B> p) {
    return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}

template <typename A>
string to_string(A v) {
    bool first = true;
    string res = "{";
    for (const auto &x : v) {
        if (!first) {
            res += ", ";
        }
        first = false;
        res += to_string(x);
    }
    res += "}";
    return res;
}



void debug_out() { cerr << endl; }

template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
    cerr << " " << to_string(H);
    debug_out(T...);
}

int XMOV[4] = {0, 0, 1, -1};
int YMOV[4] = {1, -1, 0, 0};

#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

using namespace std;

class CGoToSchool {
public:
	void solve(std::istream& in, std::ostream& out) {
		int n;
		in >> n;

		pii a[100005];
		REP(i,n)
			in >> a[i].fst, a[i].snd = i+1;

		sort(a, a+n);
		REP(i, n)
		    out << a[i].snd << " ";


	}
};

int main() {
	CGoToSchool solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}

Measured memory_bytes: 1536
import java.util.Scanner;
import java.util.ArrayList;

public class Main {
	Scanner sc = new Scanner(System.in);
	public void run(){
		String exp = sc.next();
		calc(exp);
	}
	public void calc(String exp){
		int ans1 = 0;
		int ans2 = Integer.parseInt(exp.substring(0,1));
		
		int temp = ans2;
		
		for(int i = 0; i < exp.length() / 2; i++){
			String e = exp.substring(2*i+1, 2*i+2);
			int k = Integer.parseInt(exp.substring(2*i+2, 2*i+3));
			
			if(e.equals("+")){
				ans2 += k;
				
				ans1 += temp;
				temp = k;
			}
			else{
				ans2 *= k;
				
				temp*= k;
			}
		}
		ans1 += temp;
		
		int bob_ans = sc.nextInt();
		String output = "";
		
		if(bob_ans == ans1){
			if(bob_ans == ans2) output = "U";
			else output = "M";
		}
		else if(bob_ans == ans2) output = "L";
		else output = "I";
		
		System.out.println(output);
		
	}
	
	public static void main(String[] args){
		new Main().run();
	}
	
}

Measured memory_bytes: 26220
#!/usr/bin/env python3
#ABC118 C

n = int(input())
a = list(map(int,input().split()))
a.sort()
c = a.count(0)
mi = 10**9
while 1:
    for i in range(c+1,n):
        a[i] = a[i] % a[c]
    a.sort()
    c = a.count(0)
    if a[-2] == 0:
        break
print(a[-1])


Measured memory_bytes: 62912
#include<bits/stdc++.h>
using namespace std;
long long a[100005]={0};
bool cmp(int a,int b)
{
	 return a>b;
}
int main()
{
	 long long n,k;
	 cin>>n>>k;
	 for(long long i=0;i<n;i++)
	 cin>>a[i];
	 sort(a,a+n,cmp);

	long long minx=0x3f3f3f3f;
	for(long long i=0;i<n-k+1;i++)
	{
		 //if(a[i]-a[i+k-1])
		 minx=min(a[i]-a[i+k-1],minx);
	}
	printf("%lld\n",minx); 
 } 

Measured memory_bytes: 1024
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <deque>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>

#define CK(N, A, B) (A <= N && N < B)
#define REP(i, a, b) for (int i = a; i < b; i++)
#define RREP(i, a, b) for (int i = (b - 1); a <= i; i--)
#define F first
#define S second
#define ll long long

const int INF = 1e9;
const long long LLINF = 1e18;

using namespace std;

int dy[] = {0,1,0,-1};
int dx[] = {1,0,-1,0};
int dy8[] = {0,1,1,1,0,-1,-1,-1};
int dx8[] = {1,1,0,-1,-1,-1,0,1};

/*==================================================*/
/*variable*/

/*==================================================*/
/*function*/


/*==================================================*/

int main() {
    bool iszero = false;
    int po = 0, ne = 0;

    int a, b;
    cin>>a>>b;
    REP(i,a,b+1){
        if(i < 0){
            ne++;
        }else if(i > 0){
            po++;
        }else{
            iszero = true;
        }
    }

    if(iszero){
        cout<<"Zero"<<endl;
    }else if(ne % 2 == 0){
        cout<<"Positive"<<endl;
    }else{
        cout<<"Negative"<<endl;
    }

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define REP(I, N) for (int I = 0; I < (N); ++I)
#define REPP(I, A, B) for (int I = (A); I < (B); ++I)
#define RI(X) scanf("%d", &(X))
#define RII(X, Y) scanf("%d%d", &(X), &(Y))
#define RIII(X, Y, Z) scanf("%d%d%d", &(X), &(Y), &(Z))
#define DRI(X) int (X); scanf("%d", &X)
#define DRII(X, Y) int X, Y; scanf("%d%d", &X, &Y)
#define DRIII(X, Y, Z) int X, Y, Z; scanf("%d%d%d", &X, &Y, &Z)
#define RS(X) scanf("%s", (X))
#define CASET int ___T, case_n = 1; scanf("%d ", &___T); while (___T-- > 0)
#define MP make_pair
#define PB push_back
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define LEN(X) strlen(X)
#define PII pair<int,int>
#define VI vector<int>
#define VPII vector<pair<int,int> >
#define PLL pair<long long,long long>
#define VPLL vector<pair<long long,long long> >
#define F first
#define S second
typedef long long LL;
using namespace std;
const int MOD = 1e9+7;
const int SIZE = 1e6+10;
char s[SIZE];
int main(){
    DRI(N);
    string up,dn;
    bool right=1;
    while(SZ(up)<N){
        if(!right){
            up="."+up;
            dn="."+dn;
        }
        if(right){
            up+=".";
            dn+=".";
            cout<<up<<endl<<dn<<endl;
            fflush(stdout);
            RS(s);
            if(s[0]!='F')continue;

            up[SZ(up)-1]='#';
            cout<<up<<endl<<dn<<endl;
            fflush(stdout);
            RS(s);
            if(s[0]!='F')continue;
            
            dn[SZ(dn)-1]='#';
            cout<<up<<endl<<dn<<endl;
            fflush(stdout);
            RS(s);
            if(s[0]!='F')continue;
            
            up[SZ(up)-1]='.';
            cout<<up<<endl<<dn<<endl;
            fflush(stdout);
            RS(s);
            if(s[0]!='F')continue;
            right=0;
            up="."+up.substr(0,SZ(up)-1);
            dn="."+dn.substr(0,SZ(dn)-1);
        }
        cout<<up<<endl<<dn<<endl;
        fflush(stdout);
        RS(s);
        if(s[0]!='F')continue;
        
        up[0]='#';
        cout<<up<<endl<<dn<<endl;
        fflush(stdout);
        RS(s);
        if(s[0]!='F')continue;

        dn[0]='#';
        cout<<up<<endl<<dn<<endl;
        fflush(stdout);
        RS(s);
        if(s[0]!='F')continue;

        up[0]='.';
        cout<<up<<endl<<dn<<endl;
        fflush(stdout);
        RS(s);
    }
    return 0;
}


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

int main() {
  int a, b;
  cin >> a >> b;
  
  if (a % 2 == 0 || b % 2 == 0){
    cout << "Even" << endl;
  }
  
  else {
    cout << "Odd" << endl;
  }
}


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

using namespace std;

#define rep(i,n) for(int i=0;i<(n);++i)
#define reps(i,n) for(int i=1;j<=(n);++i)
#define all(x) (x).begin(),(x).end()
//#define int long long
using pii = pair<int,int>;
constexpr int INF  = 0x3f3f3f3f;
constexpr long long LINF = 0x3f3f3f3f3f3f3f3fLL;
signed main(){
    int n;
    string s;
    cin >> s >> n;
    int sn = s.size();
    for(int i=0;i<sn;i+=n){
        cout << s[i];
    }   
    cout << '\n';
    return 0;
}


Measured memory_bytes: 256
c = input()
al = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']
t = 0
for i in range(26):
    if c == al[i]:
        t = i
print(al[t+1])


Measured memory_bytes: 3060
#include<iostream>
#include<string>
#include<stdio.h>
#include<cctype>
#include<algorithm>
#include<climits>
#include<cmath>
#include<map>
#include<vector>
#define INF INT_MAX
using namespace std;

int N;
int a[30],b[30],c[30];
int ans;

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

	return 0;
}

Measured memory_bytes: 256
#define NDEBUG

#include <unordered_map>
#include <functional>
#include <algorithm>
#include <iostream>
#include <cassert>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <utility>
#include <string>
#include <vector>
#include <cmath>
#include <stack>
#include <queue>
#include <tuple>
#include <set>
#include <map>

// [0, max)
#define FOR0(var, max) for (sl (var) = 0; (var) < (max); ++(var))
// [min, max)
#define FORi(var, min, max) for (sl (var) = (min); (var) < (max); ++(var))
// [min, max)
#define FORi_INV(var, min, max) for (sl (var) = (max) - 1; (var) + 1 > (min); --(var))
#define FORITER(var, iter) for (auto (iter) = (var).begin(); (iter) != (var).end(); (iter)++)
#define FORITER_INV(var, iter) for (auto (iter) = (var).rbegin(); (iter) != (var).rend(); (iter)++)

// a < b < c
#define LTLT(a, b, c) (((a) < (b)) && ((b) < (c)))
// a <= b < c
#define LELT(a, b, c) (((a) <= (b)) && ((b) < (c)))
// a < b <= c
#define LTLE(a, b, c) (((a) < (b)) && ((b) <= (c)))
// a <= b <= c
#define LELE(a, b, c) (((a) <= (b)) && ((b) <= (c)))

#ifndef NDEBUG
#  define MASSERT(cond) m_assert(cond, __LINE__, #cond);
#else
#  define MASSERT(...)
#endif

using namespace std;

using uc = unsigned char;
using ui = unsigned int;
using ul = unsigned long long int;

using sc = signed char;
using si = signed int;
using sl = signed long long int;

using ld = long double;

void m_assert(const bool& cond, const sl& line, const char *condstr) {
  if (!cond) {
    cerr << "Assertion Failed: " << condstr << " at line " << line << endl;
    exit(1);
  }
}

static sl N, K;
static vector<sl> Pi;

void solve(void) {
  vector<sl> Qi(N + 1);
  Qi[0] = 0;
  FORi(i, 1, N + 1) {
    sl pi = Pi[i - 1];
    Qi[i] = Qi[i - 1] + pi + 1;
  }
  sl res = 0;
  FOR0(i, N - K + 1) {
    res = max(res, Qi[i + K] - Qi[i]);
  }
  if (res % 2 == 0) {
    cout << (res / 2) << endl;
  } else {
    cout << (res / 2) << ".5" << endl;
  }
}

int main(void) {
  cin >> N >> K;
  Pi.resize(N);
  FOR0(i, N) {
    cin >> Pi[i];
  }
  solve();
  return 0;
}

Measured memory_bytes: 3328
use std::io::prelude::*;

fn input<T>() -> T
where
    T: std::str::FromStr,
{
    let stdin = std::io::stdin();
    let token = stdin
        .lock()
        .bytes()
        .map(|c| c.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect::<String>();
    token.parse().ok().unwrap()
}

fn main() {
    let a = input::<i64>();
    let b = input::<i64>();
    let c = input::<i64>();

    let ans = std::cmp::min(b / a, c);
    println!("{}", ans);
}


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

using namespace std;
using ll = long long;
using vl = vector<ll>;
using vvl = vector<vl>;
using vb = vector<bool>;
using vs = vector<string>;
using pll = pair<ll, ll>;
const ll oo = 0x3f3f3f3f3f3f3f3fLL;
const double eps = 1e-9;
#define sz(c) ll((c).size())
#define all(c) begin(c),end(c)
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define eb emplace_back
#define xx first
#define yy second
#define FOR(i, a, b) for(ll i=(a); i<(b); i++)
#define FORD(i, a, b) for(ll i=ll(b)-1;i>=(a);i--)
#define TR(X) ({if(1) cerr << "TR: " << (#X) << " = " << (X) << endl; })

#define MOD 1000000007

int main() {
    cin.sync_with_stdio(0);
    cin.tie(0);

    ll n; cin >> n;
    vl arr(n); FOR(i, 0, n) cin >> arr[i];

    vl suffix(n, 0);
    suffix[n - 1] = arr[n - 1];
    FORD(i, 0, n - 1) {
        suffix[i] = suffix[i + 1] + arr[i];
        suffix[i] %= MOD;
    }

    ll output = 0;
    FOR(i, 0, n - 1) {
        output += arr[i] * suffix[i + 1];
        output %= MOD;
    }

    cout << output << endl;
}

Measured memory_bytes: 6276
#include<bits/stdc++.h>
#define fo(i, x, y) for(int i = x, B = y; i <= B; i ++)
#define ff(i, x, y) for(int i = x, B = y; i <  B; i ++)
#define fd(i, x, y) for(int i = x, B = y; i >= B; i --)
#define ll long long
#define pp printf
#define hh pp("\n")
using namespace std;

const int N = 1e5 + 5;

int n;
vector<int> e[N]; int e0[N];

const int M = 1e6 + 5;
int fi[M], nt[M], to[M], r[M], tot = 1;

void link(int x, int y, int z) {
	nt[++ tot] = fi[x], to[tot] = y, r[tot] = z, fi[x] = tot;
	nt[++ tot] = fi[y], to[tot] = x, r[tot] = 0, fi[y] = tot;
}

int d[M], cur[M], S, T;
int q[M], q0;

int bfs() {
	fo(i, 1, T) d[i] = 0, cur[i] = fi[i];
	q[q0 = 1] = S; d[S] = 1;
	for(int i = 1; i <= q0; i ++) {
		int x = q[i];
		for(int j = fi[x]; j; j = nt[j]) if(r[j])
			if(!d[to[j]]) d[to[j]] = d[x] + 1, q[++ q0] = to[j];
	} 
	return d[T] > 0;
}
int dg(int x, int flow) {
	if(x == T) return flow;
	int use = 0;
	for(int i = cur[x]; i; i = nt[i], cur[x] = i)
		if(d[x] + 1 == d[to[i]] && r[i]) {
			int t = dg(to[i], min(flow - use, r[i]));
			r[i] -= t, r[i ^ 1] += t, use += t;
			if(use == flow) return use;
		}
	return use;
}

int cho[N];

int ans[N][2], cnt, bz[N];

struct edge {
	int fi[M], nt[M], to[M], r[M], tot;
	void link(int x, int y, int z) {
		nt[++ tot] = fi[x], to[tot] = y, r[tot] = z, fi[x] = tot;
		nt[++ tot] = fi[y], to[tot] = x, r[tot] = z, fi[y] = tot;
	}
	void dg(int x) {
		bz[x] = 1; cnt ++;
		for(int i = fi[x]; i; i = nt[i])
			if(!bz[to[i]] && !ans[r[i]][0]) {
				ans[r[i]][0] = x, ans[r[i]][1] = to[i];
				dg(to[i]);
			}
	}
} g;

int main() {
	scanf("%d", &n);
	S = 2 * n + 1, T = S + 1;
	fo(i, 1, n - 1) {
		scanf("%d", &e0[i]);
		e[i].resize(e0[i]);
		ff(j, 0, e0[i]) {
			scanf("%d", &e[i][j]);
			if(e[i][j] != 1) link(e[i][j], i + n, 1);
		}
	}
	fo(i, 2, n) link(S, i, 1);
	fo(i, 1, n - 1) link(i + n, T, 1);
	int sum = 0;
	while(bfs()) sum += dg(S, 1 << 30);
	if(sum != n - 1) {
		pp("-1\n"); return 0;
	}
	for(int i = 2; i <= tot; i += 2)
		if(to[i] != S && to[i ^ 1] != S && to[i] != T && to[i ^ 1] != T && r[i] == 0)
			cho[to[i] - n] = to[i ^ 1];
	fo(i, 1, n - 1) {
		ff(j, 0, e0[i]) if(e[i][j] != cho[i])
			g.link(cho[i], e[i][j], i);
	}
	g.dg(1);
	if(cnt == n) {
		fo(i, 1, n - 1) pp("%d %d\n", ans[i][0], ans[i][1]);
	} else pp("-1\n");
}


Measured memory_bytes: 48384
function Main(input) {
  if (input.indexOf('RRR') != -1) {
    console.log(3);
  } else if (input.indexOf('RR') != -1) {
    console.log(2);
  } else if (input.indexOf('R') != -1) {
    console.log(1);
  } else {
    console.log(0);
  }
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 29688
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define INF (1LL<<50)
#define MOD 1000000007

int main(){
    int N;
    cin >> N;
    vector<ll> A(N);
    rep(i,N) cin >> A[i];
    deque<ll> q;
    rep(i,N){
        if(i%2==0){
            q.push_back(A[i]);
        }else{
            q.push_front(A[i]);
        }
    }
    if(N%2==0){
        rep(i,N) cout << q[i] << " ";
    }else{
        for(int i= N-1;i>=0;i--) cout << q[i] << " ";
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 5376
#include <cmath>
#include <cstdio>
#include <cstring>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <vector>
#include <string>
#include <numeric>
#include <sstream>
#include <iostream>
#include <algorithm>
using namespace std;
typedef long long ll;

int main()
{
	ios::sync_with_stdio(false);

	int n;
	cin >> n; n *= 3;
	vector<int> a(n);
	for(int i=0; i<n; ++i)
		cin >> a[i];
	sort(a.rbegin(), a.rend());
	
	ll ans = 0;
	for(int i=0; i<n/3; ++i)
		ans += a[2*i+1];
	
	cout << ans << "\n";

	return 0;
}


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

int main()
{
	long long int n, k, q;
	long long int sanka[100001] = {};
	cin >> n >> k >> q;
	long long int a;
	for (long long int i = 0; i < q; ++i)
	{
		cin >> a;
		++sanka[a];
	}
	for (long long int i = 1; i <= n; ++i)
	{
		cout << (sanka[i] - q + k > 0 ? "Yes" : "No") << endl;
	}
	return 0;
}

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

using namespace std;

typedef pair<int, int> p;
typedef long long ll;
const int inf = 1000000007;

int main() {
  string s;
  cin >> s;
  if (s[s.size() - 1] == 's') {
    cout << s << "es" << endl;
    return 0;
  } else {
    cout << s << "s" << endl;
  }
  return 0;
}

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

#define REP(i, n) for(int i = 0;i < n;i++)
#define ll long long

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll h, w;
	cin >> h >> w;
	REP(i, w+2){ cout << "#"; } cout << "\n";
	REP(i, h){
		cout << "#";
		string s;
		cin >> s;
		cout << s << "#" << endl;
	}
	REP(i, w+2){ cout << "#"; } cout << "\n";
}


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



int main() {
int S;
  cin>>S;
    int AA=S/100;//上２桁
  int BB=S%100;//下２桁
  int counter=0;
  if(1<=AA&&AA<=12){counter+=10;}
  if(1<=BB&&BB<=12){counter+=1;}
    
  if(counter==10){cout<<"MMYY"<<endl;}
    else if(counter==1){cout<<"YYMM"<<endl;}
    else if(counter==11){cout<<"AMBIGUOUS"<<endl;}
else{cout<<"NA"<<endl;}
}


Measured memory_bytes: 768
n = int(input())
a = list(map(int, input().split()))
D = {}
for t in a:
    if t in D:
        D[t]+=1
    else:
        D[t]=1

ans = 0
for k,v in D.items():
    if k==v:
        continue
    elif k>v:
        ans += v
    else:
        ans += v-k

print(ans)


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

struct Sieve {
    int n;
    vector<int> f,primes;
    Sieve(int n = 1):n(n),f(n+1){
        f[0] = f[1] = -1;
        for(ll i = 2;i <= n;i++){
            if(f[i]) continue;
            primes.push_back(i);
            f[i] = i;
            for(ll j = i*i;j <= n;j += i) {
               if(!f[j]) f[j] = i;
            }
        }
    }

    bool isPrime(int x) {return f[x] == x;}
    vector<ll> factorList(ll x){
        vector<ll> res;
        for(int p : primes){
            while(x%p == 0){
                res.push_back(p);
                x /= p;
            }
        }
        if(x != 1) res.push_back(x);
        return res;
    }
    vector<pair<ll,int>> factor(ll x){
        vector<ll> fl = factorList(x);
        if(fl.size() == 0) return{};
        vector<pair<ll,int>> res(1,pair<ll,int>(fl[0],0));
        for(ll p : fl){
            if(res.back().first == p){
                res.back().second++;
            }else{
                res.emplace_back(p,1);
            }
        }
        return res;
    }
};



//     auto find_m = [&](int k){
//         for(int m = 1;m <= k;m++){
//             if(m*(m+1)/2 <= k && k < (m+1)*(m+2)/2 ) return m;
//         }
//         return -1;
//     };

//     ll n;
//     cin >> n;
//     vector<int> s(n);
//     set<ll> p;
//     while(true){
//         int rootn = sqrt(n) + 0.8;
//         bool flag = true;
//         for(int i = 2;i <= rootn;i++){
//             if(n%i == 0) {
//                 s[i] += 1;
//                 p.insert(i);
//                 n /= i;
//                 flag = false;
//                 break;
//             }
//         }
        
//         if(flag){
//             if(n > 1){
//                 s[n]++;
//                 p.insert(n);
//             }
//             break;
//         }
//     }

//     int ans = 0;
// for(auto itr = p.begin(); itr != p.end(); ++ itr){
//     ans += find_m(s[*itr]);
// }
// cout << ans << endl;

int main() {
  ll n;
  cin >> n;
  Sieve s(1000005);
  auto fs = s.factor(n);
  int ans = 0;
  for (auto p : fs) {
    int x = p.second;
    int b = 1;
    while (b <= x) {
      x -= b;
      b++;
      ++ans;
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 7724
#include <iostream>
#include <vector>
#include <map>
using namespace std;
 
int main(){
  int N; cin >> N;
  vector<long long> a(N);
  vector<long long> sum(N+1, 0);
  for(int i=0; i<N; i++){
    cin >> a[i];
    sum[i+1] = sum[i] + a[i];
  }
  
  map<long long, long long> nums;
  for(int i=0; i<N+1; i++) nums[sum[i]]++;
  
  long long res=0;
  for(auto v : nums){
    long long num = v.second;
    res += num*(num-1)/2;
  }
  cout << res << endl;
}

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

using namespace std;

typedef double db;
typedef long long ll;
typedef long double ld;
typedef unsigned int ui;
typedef unsigned long long ull;

typedef pair < db, db > pdd;
typedef pair < db, ld > pdl;
typedef pair < ld, db > pld;
typedef pair < ld, ld > ldp;

typedef pair < ll, ll > pll;
typedef pair < int, ll > pil;
typedef pair < ll, int > pli;
typedef pair < int, int > pii;

#define F first
#define S second

#define en end()
#define bg begin()

#define rev reverse
#define mp make_pair
#define pb push_back

#define y1 y1234567890
#define um unordered_map

#define all(x) x.bg, x.en
#define sz(x) (int)x.size()
#define len(x) (int)strlen(x)

#define sqr(x) ((x + 0ll) * (x))
#define sqrd(x) ((x + 0.0) * (x))

#define forn(i, n) for (int i = 1; i <= n; i++)

const int inf = (int)1e9;
const ll mod = (ll)1e9 + 7;

const db eps = (db)1e-9;
const db pi = acos(-1.0);

const int dx[] = {0, 0, 1, 0, -1};
const int dy[] = {0, 1, 0, -1, 0};

const int N = 600500;

char a[1010][1010];
int n, x, y, m;
bool was[1010][1010];     

int main() {
	//freopen(".in", "r", stdin);
	//freopen(".out", "w", stdout);
	//freopen(".err", "w", stderr);

	//srand(time(NULL));

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

	//cout << setprecision(10) << fixed;
	cin >> n >> m;
	for (int i = 1; i <= n; i++)
	for (int j = 1; j <= m; j++)
		cin >> a[i][j];
	
	x = 1; y = 1;
	was[1][1] = true;
	while (true)
	{
	
		if (a[x][y + 1] == '#')
		{
			was[x][y + 1] = true;
			y++;
		}
		else if (a[x + 1][y] == '#')
		{
			was[x + 1][y] = true;
			x++;
		}
		else
			break;  

	}
                     /*
	for (int i = 1; i <= n; i++) {
	for (int j = 1; j <= m; j++)
		cout << was[i][j] << ' ';
    	cout << endl;
    }                 */
	for (int i = 1; i <= n; i++)
	for (int j = 1; j <= m; j++)
	    if (a[i][j] == '#' && !was[i][j])
	    {
	    	cout << "Impossible\n";
	    	return 0;	    
	    }

	cout << "Possible\n";		
	
	return 0;
}


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

int main(){
  int N,M;
  cin>>N>>M;
  vector<int> L(M),R(M);
  int lmax=-1,rmin=N+10;
  for(int i=0;i<M;i++){
    cin>>L[i]>>R[i];
    lmax=max(lmax,L[i]);
    rmin=min(rmin,R[i]);
  }
  cout<<max(rmin-lmax+1,0)<<endl;
  return 0;
}



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

#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl "\n"

using namespace std;
using ll = long long;

const ll MOD = 1000000007LL; // = 10^9 + 7
const double PI = 3.14159265358979;

void solve()
{
	int x, a;
	cin >> x >> a;
	cout << ((x < a) ? 0 : 10);
}

int main()
{
	fastio;
	solve();

	return 0;
}

Measured memory_bytes: 3588
n = gets.to_i
ps = gets.split.map(&:to_i)

ans = 0
(0..n-1).each do |i|
  p = ps[i]
  if p == i+1
    t = ps[i+1]
    ps[i+1] = p
    ps[i] = t
    ans += 1
  end
end

if ps[n-1] == n
  ans += 1
end
puts ans

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

int main()
{
	int n,k;
	cin>>n>>k;
	vector<double> a(n);
	long d;
	for(int i=0;i<n;i++)
	{
		cin>>d;
		a[i] = log10(d);
	}
	//k--;
	double mul = 0 , mul2=0;
	for(int i=0;i<k;i++)
	{
		mul += a[i];
		//cout<<"aa"<<a[i]<<endl;
	}
	//cout<<mul<<endl;
	for(int i=k;i<n;i++)
	{
		mul2 = mul + a[i] - a[i-k];
		if(mul2>mul)
			cout<<"Yes"<<endl;
		else
			cout<<"No"<<endl;
		mul = mul2;
		//cout<<mul<<endl;
	}
	
}

Measured memory_bytes: 4932
# include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define pii pair<int,int>
typedef long long ll;
int n,arr[25],bil,sum,c[25];
int x;
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    cin>>n;
    for(int i=1;i<=n;i++){
        cin>>arr[i];
    }
    for(int i=1;i<=n;i++){
        cin>>x;
        sum+=x;
    }
    for(int i=1;i<n;i++){
        cin>>c[i];
    }
    for(int i=1;i<n;i++){
        if(arr[i+1]==arr[i]+1) sum+=c[arr[i]];
    
        
    }
    cout<<sum<<endl;
    
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	public static void main(String args[]) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String line = br.readLine();
		int[] numArray = parseInt(getSplitLine(line));

		int x;
		int y;
		if (numArray[0] > numArray[1]) {
			x = numArray[0];
			y = numArray[1];
		} else {
			x = numArray[1];
			y = numArray[0];
		}

		int tmp;
		while ((tmp = x % y) != 0) {
			x = y;
			y = tmp;
		}

		System.out.println(y);
	}

	private static String[] getSplitLine(String line) {
		return line.split("\\s");
	}

	private static int[] parseInt(String[] line) {
		int[] numArray = new int[line.length];
		for (int i = 0; i < line.length; i++) {
			numArray[i] = Integer.parseInt(line[i]);
		}
		return numArray;
	}
}

Measured memory_bytes: 17060
#include <cstdio>
#include <cctype>
#include <cstring>
#include <algorithm>
int read(){
	register int x = 0;
	register char f = 1, ch = getchar();
	for (; !isdigit(ch); ch = getchar()) if (ch == '-') f ^= 1;
	for (; isdigit(ch); ch = getchar()) x = (x << 1) + (x << 3) + (ch ^ '0');
	return f ? x : -x;
}
char s[105];
int n;
int main(){
	scanf("%s", s + 1), n = strlen(s + 1);
	for (register int i = 1; i <= n; ++i)
		if (i & 1) if (s[i] == 'L') return puts("No"), 0; else continue;
		else if (s[i] == 'R') return puts("No"), 0; else continue;
	puts("Yes");
}

Measured memory_bytes: 128
//Patwari26
#include<bits/stdc++.h>
using namespace std;
#define int         long long
#define ll          long long
#define pb          push_back
#define endl        '\n'
#define mii         map<ll,ll>
#define pii         pair<ll,ll>
#define vi          vector<ll>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (ll)x.size()
#define hell        1000000007
#define INF         (1ll<<60)
#define rep(i,a,b)  for(ll i=a;i<=b;i++)
#define rrep(i,a,b)  for(ll i=a;i>=b;i--)
#define ios ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define time        cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
ll gcd(ll a, ll b) { return b == 0 ? a : gcd(b, a % b); }
ll lcm(ll a, ll b) { return a * (b / gcd(a, b)); }
const int N=100005;
const int M=100006;
int f[M],inv[M];
int expo(int base,int exponent,int mod){
    int ans=1;
    while(exponent!=0){
        if(exponent&1) ans=(1LL*ans*base)%mod;
        base=(1LL*base*base)%mod;
        exponent>>=1;
    }
    return ans%mod;
}
void compute(){
    f[0]=1;
    rep(i,1,M-1){
        f[i]=(1LL*i*f[i-1])%hell;
    }
    inv[M-1]=expo(f[M-1],hell-2,hell);
    for(int i=M-2;i>=0;i--){
        inv[i]=(1LL*(i+1)*inv[i+1])%hell;
    }
}
int C(int n,int r){
    return (1LL*((1LL*f[n]*inv[r])%hell)*inv[n-r])%hell;
}
void solve(){
    compute();
    ll n,k;
    cin>>n>>k;
    vi v(n);
    rep(i,0,n-1) cin>>v[i];
    ll maxx=0;
    ll minn=0;
    sort(all(v),greater<ll>());
    rep(i,0,n-1){
        ll rem=n-i-1;
        if(rem>=(k-1)) maxx=(maxx+(v[i]*C(rem,k-1))%hell)%hell;
        if(i>=(k-1)) minn=(minn+(v[i]*C(i,k-1))%hell)%hell;
    }
    // cout<<maxx<<" "<<minn<<endl;
    cout<<(maxx-minn+hell)%hell;
}
signed main()
{
    ios
    int TESTS=1;
    //cin>>TESTS;
    while(TESTS--){
        solve();
    }
    time
    return 0;
}

Measured memory_bytes: 2560
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<utility>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<functional>
#include<math.h>
using namespace std;
#define N (1000000000+7)
#define M (998244353)
#define INF 1e16
typedef long long ll;
typedef pair<ll,ll > P;
typedef pair<P,ll>Q;

int main(void){
    string s;
    cin>>s;
    int n = s.length();
    for(int i=n;i>=2;i-=2){
        if(i==n)continue;
        int half = i/2;
        string t = s.substr(0,half);
        string u = s.substr(half,half); 
        //cout<<t<<" "<<u<<endl;
        if(t==u){
            cout<<i<<endl;
            return 0;
        }
    }
    return 0;
}

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

int main() {
  string a,b;
  cin >> a >> b;
  
  if(a.at(0) == b.at(2) && a.at(1) == b.at(1) && a.at(2) == b.at(0)){
    cout << "YES" << endl;
  }
  
  else{
    cout << "NO" << endl;
  }
}


Measured memory_bytes: 256
package main
import (
  "bufio"
  "os"
  "strconv"
  "strings"
  "fmt"
  // "math"
  // "sort"
)

// 行単位で読み込む場合
var sc = bufio.NewScanner(os.Stdin)

func main() {
  read := nextLine()
  list := strings.Split(read, " ")
  A, _ := strconv.Atoi(list[0])
  B, _ := strconv.Atoi(list[1])
  C, _ := strconv.Atoi(list[2])
  D, _ := strconv.Atoi(list[3])
  
  numAmount := B - A + 1

  ADivC := A / C
  BDivC := B / C
  containStartC := ADivC * C >= A
  containEndC := BDivC * C <= B
  var canCDiv int
  if containStartC && containEndC {
    canCDiv = BDivC - ADivC + 1
  } else if !containStartC && !containEndC {
    canCDiv = 0
  } else {
    canCDiv = BDivC - ADivC
  }
  if canCDiv < 0 {
    canCDiv = 0
  }

  ADivD := A / D
  BDivD := B / D
  containStartD := ADivD * D >= A
  containEndD := BDivD * D <= B
  var canDDiv int
  if containStartD && containEndD {
    canDDiv = BDivD - ADivD + 1
  } else if !containStartD && !containEndD {
    canDDiv = 0
  } else {
    canDDiv = BDivD - ADivD
  }
  if canDDiv < 0 {
    canDDiv = 0
  }

  gcdCD := gcd(C, D)
  lcmCD := C * D / gcdCD
  ADivCD := A / lcmCD
  BDivCD := B / lcmCD
  containStartCD := ADivCD * lcmCD >= A
  containEndCD := BDivCD * lcmCD <= B
  var canCDDiv int
  if containStartCD && containEndCD {
    canCDDiv = BDivCD - ADivCD + 1
  } else if !containStartCD && !containEndCD {
    canCDDiv = 0
  } else {
    canCDDiv = BDivCD - ADivCD
  }
  if canCDDiv < 0 {
    canCDDiv = 0
  }

  fmt.Println(numAmount - canCDiv - canDDiv + canCDDiv)
}

// 行を読む
func nextLine() string {
  sc.Scan()
  return sc.Text()
}

// 最大公約数を求める
func gcd(a int, b int) int {
  if b == 0 {
    return a
  }
  return gcd(b, a % b)
}

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

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

ll GCD(ll a, ll b) {
    if (b == 0) return a;
    else return GCD(b, a % b);
}
ll LCM(ll a, ll b) { return a * b / GCD(a, b); }


int main(){
    char C;
    cin >> C;
    C++;
    cout << C << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define ALL(v) v.begin(),v.end()
using ll = long long;
using pii = pair<int,int>;
using vi = vector<int>;
using vs = vector<string>;
using vb = vector<bool>;
using vll = vector<long long>;
using vpii = vector<pair<int,int>>;
using vivi = vector<vector<int>>;
using vbvb = vector<vector<bool>>;
const int dx[4] = {1,0,-1,0};
const int dy[4] = {0,1,0,-1};
const int mod = 1000000007;
const int inf = 1001001001;



int main(void) {
  int k,n;
  cin >> k >> n;
  vi a(n);
  rep(i,n)cin >> a[i];
  int mi = -1;
  rep(i,n-1)mi = max(a[i+1]-a[i],mi);
  mi = max(mi,k-a[n-1]+a[0]);
  cout << k-mi << endl;
}






Measured memory_bytes: 1024
#include<bits/stdc++.h>
 
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
 
#define ll          long long
#define pb          push_back
#define vi          vector<ll int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define rs(v,n)     v.resize(n)
#define hell        1000000007
#define peak        9123372036854775807
#define pii         acos(-1)
#define clr(a,x)    memset(a,x,sizeof(a))
#define ios         ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
template<typename T>
using ordered_set = tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;
template<class x,class y> x sum(x a,y b){return a+b;}
template<class x,class y> x mul(x a,y b){return a*b;}
template<class x,class y> x sub(x a,y b){return a-b;}
template<class x,class y> x divi(x a,y b){return a/b;}
 
template<class x,class y>
istream &operator>>(istream &in,pair<x,y> &p) 
{ 
    in>>p.F>>p.S;
    return in;
}
template<class x>
istream &operator>>(istream &in,vector<x> &v) 
{
    for(auto& i:v)
        in>>i;
    return in;
}
template<class x,class y>
ostream &operator<<(ostream &out,pair<x,y> &p) 
{ 
    out<<"("<<p.F<<","<<p.S<<") ";
    return out; 
}
template<class x>
ostream &operator<<(ostream &out,vector<x> &v) 
{ 
    out<<v.size()<<endl;
    for(auto i:v)
        out<<i<<" ";
    out<<endl;
    return out; 
}
#define N  1000005
 
int main()
{
    ios;
    ll tt=1;
    // cin>>tt;
    while(tt--)
    {
        ll i,j,k,l,m,n;
        cin>>n>>m;
        if(m>=n)
            cout<<"unsafe";
        else cout<<"safe";
    }
    return 0;
}

Measured memory_bytes: 3640
#include <iostream>
#include <map>

using namespace std;
typedef long long ll;
map<ll,ll> mp;
int main(){
    long long i,x; cin >> x;
    for(i=-1000;i<=1000;i++){
        mp[i*i*i*i*i] = i;
    }
    for(auto y:mp){
        ll val = y.first;
        if(mp.find(val + x)!=mp.end()){
            cout << mp[val + x] << " " << mp[val] << endl;
            return 0;
        }
    }
}

Measured memory_bytes: 3748
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <functional>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<vector<pair<ll, ll>>> vvpll;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define exrep(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) cout << x << endl
#define exout(x) printf("%.10f\n", x)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define re0 return 0
const ll mod = 1000000007;
const ll INF = 1e16;
const ll MAX_N = 300010;  // デフォルトでnの最大値は300000

// aのn乗を求める。計算量はO(logn)
ll modpow(ll a, ll n) {
    if(n == 0) {
        return 1;
    }
    if(n%2 == 1) {
        return (a * modpow(a, n-1))%mod;
    }
    return (modpow(a, n/2) * modpow(a, n/2))%mod;
}

ll inv(ll a) {
    return modpow(a, mod-2);
}

ll fact[MAX_N];
ll invfact[MAX_N];

// main関数でinit()を呼び出してからComb()を使用する
void init() {
    fact[0] = 1;
    invfact[0] = 1;
    for(ll i = 1; i < MAX_N; i++) {
        fact[i] = (i*fact[i-1])%mod;
        invfact[i] = inv(fact[i]);
    }
}
 
ll Comb(ll n, ll r) {
    if(r < 0 || n < 0 || n < r) {
        return 0;
    }
    ll res = fact[n];
    res = (res * invfact[r])%mod;
    res = (res * invfact[n-r])%mod;
    return res;
}

ll f(ll x, ll y) {
    ll A = (x-1)*x*(x+1)/6;
    ll B = y*y;
    A %= mod;  
    B %= mod;
    return A*B%mod;
}

//--- main関数でinit()を呼び出すのを忘れるな ---//
int main() {
    ll n, m, k;
    cin >> n >> m >> k;
    init();
    out( Comb(n*m-2, k-2) * (f(n, m) + f(m, n)) % mod );
    re0;
}

Measured memory_bytes: 4992
#include<stdio.h>

unsigned long int calc(unsigned long int n)
{
	if(n<=1)
		return 1;
	else
		return n*calc(n-1);
}

int main()
{
	unsigned long int n;
	scanf("%d",&n);
	printf("%lu\n",calc(n));
	return 0;
}

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

int main() {
  string s;
  cin >> s;
  int a = 0;
  for (int i = 0; i < 4; i++) {
    if (s.at(i) == '+') {
      a++;
    } else {
      a--;
    }
  }
  cout << a;
  return 0;
}


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

# define REP(i,n) for (int i=0;i<(n);++i)
# define rep(i,a,b) for(int i=a;i<(b);++i)
# define p(s) std::cout << s ;
# define pl(s)  std::cout << s << endl;
# define printIf(j,s1,s2) cout << (j ? s1 : s2) << endl;
# define YES(j) cout << (j ? "YES" : "NO") << endl;
# define Yes(j) std::cout << (j ? "Yes" : "No") << endl;
# define yes(j) std::cout << (j ? "yes" : "no") << endl;
# define all(v) v.begin(),v.end()
# define showVector(v) REP(i,v.size()){p(v[i]);p(" ")} pl("")
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;}
typedef long long int ll;
typedef pair<ll,ll> P_ii;
typedef pair<double,double> P_dd;

const int MOD = 1000000007;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;

void addM(long long &a, long long b) {
    a += b;
    if (a >= MOD) a -= MOD;
}

void mulM(long long &a, long long b) {
    a = ((a%MOD)*(b%MOD))%MOD ;
}

// a^b mod M
long myPow(long a,long b,int M) {
    long ret = 1;
    long tmp = a;
    while(b>0) {
        if((b&1)==1) ret = (ret * tmp) % M;
        tmp = (tmp * tmp) % M;
        b = b>>1;
    }
    return ret;
}

 // nCk mod M
int nCk(int n,int k,int M) {
    long ret = 1;
    int mi = min(k, n-k);
    for(int i=1;i<=mi;i++) {
        ret = (ret * myPow(i,M-2,M)) % M;
    }
    for(int i=n-mi+1;i<=n;i++) {
        ret = (ret * i) % M;
    }
    return (int)ret;
};

vector<pair<long long, long long> > prime_factorize(long long n) {
    vector<pair<long long, long long> > res;
    for (long long p = 2; p * p <= n; ++p) {
        if (n % p != 0) continue;
        int num = 0;
        while (n % p == 0) { ++num; n /= p; }
        res.push_back(make_pair(p, num));
    }
    if (n != 1) res.push_back(make_pair(n, 1));
    return res;
}


int main() {
    int N;
    string s;

    cin >> N >> s;

    vector<int> v(2 * N, 0);
    for (int i = 2 * N - 1; i > 0; i--) {
        v[i - 1] = v[i] + 1;
    }

    int num_b = 0;
    REP(i, 2 * N) {
        if (s[i] == 'B') v[i] += 1;
        v[i] %= 2;
        if (v[i]) num_b++;
    }

    ll ans = 0;
    if (num_b == N) {
        ans = 1;

        int num_w = 0;
        REP(i, N * 2) {
            if (v[i] == 0) num_w++;
            else (ans *= num_w--) %= MOD;
        }
    }

    ll np = 1;
    REP(i, N) mulM(np, i + 1);

    cout << (ans * np) % MOD << endl;

    return 0;
}

Measured memory_bytes: 1412