akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

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

    vector<int> a(n);
    long sum=0;
    
    for(int i=0; i<n; i++){
        if((i+1)%3!=0 && (i+1)%5!=0){
            sum+=i+1;
        }
    }

    cout<<sum<<endl;
}

Measured memory_bytes: 7052
#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif

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

#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif


using namespace std;
using ll = long long;

const ll MOD = 1000000007;
const ll INF = 1e18;
const double pi = acos(-1);
const int dx4[4] = {1, 0, -1, 0};
const int dy4[4] = {0, 1, 0, -1};
const int dx8[8] = {1,1,0,-1,-1,-1,0,1};
const int dy8[8] = {0,1,1,1,0,-1,-1,-1};


#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,b) rng(i,0,b)
#define gnr(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define per(i,b) gnr(i,0,b)
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()


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; }



void solve(){
    
    // remove the bottom 3 lines when you submit this code.
    std::ifstream in("sample.txt");
    std::cin.rdbuf(in.rdbuf());

    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int n; cin >> n;
    string s; cin >> s;
    int ans = 1;
    rep(i,n-1){
        if(s[i]!=s[i+1]) ans++;
    }
    
    cout << ans << endl;
}



signed main() {
    solve();
    return 0;
}



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

int main() {
      string s;
      cin >> s;
      int sum = 700;
      if(s[0] == 'o') sum = sum+100;
      if(s[1] == 'o') sum = sum+100;
      if(s[2] == 'o') sum = sum+100;
      
      cout << sum << endl;
}

Measured memory_bytes: 256
#pragma GCC optimize("O3")
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
using namespace std;

using ll = long long;
using P = pair<int, int>;
using T = tuple<int, int, int>;

template <class T> inline T chmax(T &a, const T b) {return a = (a < b) ? b : a;}
template <class T> inline T chmin(T &a, const T b) {return a = (a > b) ? b : a;}

constexpr int MOD = 1e9 + 7;
constexpr int inf = 1e9;
constexpr long long INF = 1e18;

#define all(a) (a).begin(), (a).end()

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

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

    int n; cin>>n;
    vector<vector<int>> a(n, vector<int>(n));
    for(int i=0; i<n; i++){
        for(int j=0; j<n; j++) cin>>a[i][j];
    }

    vector<vector<ll>> dp(n+1, vector<ll>((1<<n), 0));
    dp[0][0] = 1;

    for(int bit=0; bit<(1<<n); bit++){
        int i = __builtin_popcount(bit);
        for(int j=0; j<n; j++){
            if(!(bit & (1 << j)) && a[i][j]){
                dp[i+1][bit | (1 << j)] += dp[i][bit];
                dp[i+1][bit | (1 << j)] %= MOD;
            }
        }
    }

    cout << dp[n][(1<<n)-1] << endl;

    return 0;
}

Measured memory_bytes: 377216
#include<iostream>
#include<vector>
#include<utility>
#include<map>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
using namespace std;

struct data{
	int start,end;
	string stname,edname;
};

int func(string s){
	int fr=(s[0]-'0')*10+(s[1]-'0'),ba=(s[3]-'0')*10+(s[4]-'0');
	return fr*60+ba;
}

int main(){
	int n,t;
	cin>>n>>t;
	data dt[n];
	string alte,alts;
	rep(i,n){
		cin>>alts>>dt[i].stname>>alte>>dt[i].edname;
		dt[i].start=func(alts);
		dt[i].end=func(alte);
	}
	vector<string> ans;
	map<string,int> mp;
	loop(i,1,n){
		if(dt[i].start-dt[i-1].end>=t){
			ans.push_back(dt[i-1].edname);
			mp[dt[i-1].edname]=dt[i].start-dt[i-1].end;
		}
	}
	cout<<ans.size()<<endl;
	rep(i,ans.size()){
		cout<<ans[i]<<" "<<mp[ans[i]]<<endl;
	}
	return 0;
}

Measured memory_bytes: 1224
package main

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

var (
	rdr   = bufio.NewReaderSize(os.Stdin, 1000000)
	reply string
)

func main() {
	var n int
	fmt.Scan(&n)
	a := make([]int, n)
	odd := 0
	for i := 0; i < n; i++ {
		fmt.Scan(&a[i])
		if a[i]%2 > 0 {
			odd++
		}
	}
	if odd%2 > 0 {
		fmt.Println("NO")
	} else {
		fmt.Println("YES")
	}
}

func readLine() string {
	buf := make([]byte, 0, 1000000)
	for {
		l, p, e := rdr.ReadLine()
		if e != nil {
			panic(e)
		}
		buf = append(buf, l...)
		if !p {
			break
		}
	}
	return string(buf)
}

func nextSlice() []string {
	return strings.Split(readLine(), "")
}

func atoi(a []string) (b []int) {
	b = make([]int, len(a))
	for i := range a {
		b[i], _ = strconv.Atoi(a[i])
	}
	return
}

func atof(a []string) (b []float64) {
	b = make([]float64, len(a))
	for i := range a {
		b[i], _ = strconv.ParseFloat(a[i], 64)
	}
	return
}

func scanSlice2(n int) (a []int, b []int) {
	a = make([]int, n)
	b = make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Scan(&a[i], &b[i])
	}
	return
}

func scanFloatSlice2(n int) (a []float64, b []float64) {
	a = make([]float64, n)
	b = make([]float64, n)
	for i := 0; i < n; i++ {
		fmt.Scan(&a[i], &b[i])
	}
	return
}

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

func abs(a int) int {
	if a > 0 {
		return a
	}
	return -a
}

func gcd(a, b int) int {
	if b == 0 {
		return a
	}
	return gcd(b, a%b)
}

func min(a ...int) int {
	min := a[0]
	for i := 1; i < len(a); i++ {
		if min > a[i] {
			min = a[i]
		}
	}
	return min
}

func max(a ...int) int {
	max := a[0]
	for i := 1; i < len(a); i++ {
		if max < a[i] {
			max = a[i]
		}
	}
	return max
}

func sum(a []int) (ans int) {
	for i := range a {
		ans += a[i]
	}
	return
}

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

func yesOrNo(b bool) {
	if b {
		reply = "Yes"
		fmt.Println(reply)
		return
	}
	reply = "No"
	fmt.Println(reply)
}

func yesorNO(b bool) {
	if b {
		reply = "YES"
		fmt.Println(reply)
		return
	}
	reply = "NO"
	fmt.Println(reply)
}


Measured memory_bytes: 6144
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define REP(i,n) for (int64_t i=0; i<(n); ++i)
#define P pair<int,int>
using ll=int64_t;
using namespace std;
#define ketasuu(n) fixed<<setprecision(n)
#define btoe(p) p.begin(),p.end()
#define etob(p) p.rbegin(),p.rend()




int main(){
    int n,d,x; cin>>n>>d>>x;
    vector<int> p(n);
    rep(i,n) cin>>p[i];
    int ans=x;
    rep(i,n){
        int kari=(d-1)/p[i];
        ans+=(kari+1);
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 3608
//#include "pch.h"
#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <queue>
#include <bitset>
#include <limits.h>
#include <string>
#include <deque>
#include <cmath>
#include <bitset>

using namespace std;
typedef long long ll;
typedef pair<int, int> P;

#define rip(i, n, s) for (int i = (s);i < (int)( n ); i++)
#define mpa make_pair
#define all(a)

template<typename T>
void vdeb(vector<T> &da) {
	int size = da.size();
	for (int i = 0;i < size;i++) {
		if (i == size - 1) {
			cout << da[i] << endl;
		}
		else {
			cout << da[i] << ' ';
		}
	}
}
template<typename T>
void vvdeb(vector<T> &da) {
	int size = da.size();
	for (int i = 0;i < size;i++) {
		vdeb(da[i]);
	}
}

int n;

void bfs(int st, vector<vector<int>> &da, vector<int> &ans) {
	queue<P> q;
	ans[st] = 0;
	q.push(make_pair(st, -1));
	vector<bool> ju(n, false);
	ju[st] = true;
	while (!q.empty()) {
		P now = q.front();
		//cout << now.first << endl;
		q.pop();
		ans[now.first] = now.second + 1;
		ju[now.first] = true;
		for (auto i : da[now.first]) {
			if (!ju[i]) {
				q.push(make_pair(i, now.second + 1));
			}
		}
	}
	return;
}

int main() {
	int u, v;
	cin >> n >> u >> v;
	u--;v--;
	vector<vector<int>> da(n, vector<int>(0));
	int a, b;
	rip(i, n - 1, 0) {
		cin >> a >> b;
		a--;b--;
		da[a].push_back(b);
		da[b].push_back(a);
	}
	vector<int> U(n, 0), V(n, 0);
	bfs(u, da, U);bfs(v, da, V);
	int ans = 0;
	rip(i, n, 0) {
		if (U[i] <= V[i]) {
			ans = max(ans, V[i]);
		}
	}
	//vdeb(U);vdeb(V);
	//vvdeb(da);
	cout << ans-1 << endl;
}

Measured memory_bytes: 6784
#include <iostream>


struct Answer {
    int yen_10000;
    int yen_5000;
    int yen_1000;
    
    bool is_valid() { 
        return yen_10000 != -1;
    }
    
    void print() {
        std::printf(
            "%d %d %d\n",
            yen_10000, yen_5000, yen_1000
        );
    }
};

struct Cond {
    bool use_10000 = true;
    bool use_5000  = true;
    bool use_1000  = true;
};


// n枚で1000*y円作る組み合わせを返す
Answer solve(const int n, const int ky, Cond cond) {
    //
    if(n == 0 && ky == 0) {
        return {0, 0, 0};
    }
    if(ky == 0) {
        return {-1, -1, -1};
    }
    if(ky == n) {
        return {0, 0, n};
    }
    
    //
    if(cond.use_10000) {
        for(int num = ky / 10; num >= 0; --num) {
            auto ans = solve(
                n - num,
                ky - num*10,
                {false, cond.use_5000, cond.use_1000}
            );
            if(ans.is_valid()) {
                ans.yen_10000 += num;
                return ans;
            }
        }
    }
    if(cond.use_5000) {
        for(int num = ky / 5; num >= 0; --num) {
            auto ans = solve(
                n - num,
                ky - num*5,
                {cond.use_10000, false, cond.use_1000}
            );
            if(ans.is_valid()) {
                ans.yen_5000 += num;
                return ans;
            }
        }
    }
    
    return {-1, -1, -1};
}

int main(void) {
    int N, Y;
    std::cin >> N >> Y;

    solve(N, Y/1000, {}).print();
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
int main() {
    char s[12], t[12];
    scanf("%s %s", s, t);

    for (int i=0; i<strlen(s); i++) {
        if (s[i]!=t[i]) {
            printf("No\n");
            return 0;
        }
    }
    printf("Yes\n");
    
    return 0;
}

Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int mod = 1000000007;
const double PI = acos(-1);

bool Judge(int n, int m, const vector<int>& a)
{
	vector<vector<int>> dp(n, vector<int>(m + 1));
	dp[0][0] = true;
	for (int i = 0; i <= m; i++) {
		if (i == a[0]) dp[0][i] = true;
	}

	for (int i = 1; i < n; i++) {
		for (int j = 0; j <= m; j++) {
			if (dp[i - 1][j]) dp[i][j] = true;
			if (0 <= j - a[i] && dp[i - 1][j - a[i]]) dp[i][j] = true;
		}
	}

	return dp[n - 1][m];
}

int main()
{
	int n;
	cin >> n;
	vector<int> a(n);
	for (int i = 0; i < n; i++) cin >> a[i];
	int q;
	cin >> q;
	for (int i = 0; i < q; i++) {
		int m;
		cin >> m;
		if (Judge(n, m, a)) cout << "yes" << endl;
		else cout << "no" << endl;
	}
}


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

#define rep(i, n) for(int i = 0; i < (n); ++i)
#define repr(i, n) for(int i = (n-1); i >= 0; --i)

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

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

const int MAX = 200005;
const int INF = 1001001001;
const int MOD = 1000000007;

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

    int N = s.size();
    rep(i, N - 1) {
        if (s[i] == s[i+1]) {
            cout << i+1 << " " << i+2 << endl;
            return 0;
        }
    }

    rep(i, N - 2) {
        if (s[i] == s[i+2]) {
            cout << i+1 << " " << i+3 << endl;
            return 0;
        }
    }

    cout << "-1 -1" << endl;
}

Measured memory_bytes: 512
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <queue>
#define F first
#define S second

using namespace std;

typedef long long ll;

ll n;
ll x, y, z;
ll ans;
ll mx = -4e18;
pair<ll, ll> a[100005];
ll b[100005];
ll c[100005];
priority_queue<ll, vector<ll>, greater<ll> > pq;

bool cmp(pair<ll, ll> p, pair<ll, ll> q)
{
    return p.F - p.S > q.F - q.S;
}

int main()
{
    cin>>x>>y>>z;
    n = x + y + z;
    for(ll i = 0; i < n; i++)
    {
        ll t;
        cin>>t>>a[i].F>>a[i].S;
        a[i].F -= t;
        a[i].S -= t;
        ans += t;
    }
    sort(a, a + n, cmp);
    while(!pq.empty()) pq.pop();
    for(ll i = 0; i < y; i++) pq.push(a[i].F), b[y - 1] += a[i].F;
    for(ll i = y; i < n; i++)
    {
        b[i] = b[i - 1];
        pq.push(a[i].F), b[i] += a[i].F;
        b[i] -= pq.top(), pq.pop();
    }
    while(!pq.empty()) pq.pop();
    for(ll i = n - 1; i >= x + y; i--) pq.push(a[i].S), c[x + y] += a[i].S;
    for(ll i = x + y - 1; i >= 0; i--)
    {
        c[i] = c[i + 1];
        pq.push(a[i].S), c[i] += a[i].S;
        c[i] -= pq.top(), pq.pop();
    }
    for(ll i = y - 1; i < x + y; i++) mx = max(mx, b[i] + c[i + 1]);
    cout<<ans + mx<<endl;
    return 0;
}


Measured memory_bytes: 3456
import collections

def dfs(s_node):
    q = collections.deque()
    used = set()
    q.append(s_node)
    used.add(s_node)
    while len(q) > 0:
        prv_node = q.pop()
        for node, cost in g[prv_node]:
            if node in used:
                continue
            else:
                if cost % 2 == 0:
                    cols[node] = cols[prv_node]
                else:
                    cols[node] = -cols[prv_node]
                q.append(node)
                used.add(node)


N = int(input())
g = {i: [] for i in range(N)}
for _ in range(N-1):
    u, v, w = map(int, input().split())
    g[u - 1].append([v - 1, w])
    g[v - 1].append([u - 1, w])

cols = [-1 for _ in range(N)]
dfs(0)

[print(1) if cols[i] == 1 else print(0) for i in range(N)]


Measured memory_bytes: 101604
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <set>
#include <string>
#include <map>
#include <queue>
#include <vector>
#include <stack>


using namespace std;
typedef long long LL;
const int MaxN = 1e6 + 5;
const int Mod = 1e9 + 7;
const int INF = 0x3f3f3f3f;
const double esp = 1e-6;

double n,m,cnt,sum;
double a[MaxN];


int main(){
    cin >> n >> m;
    for(int i = 1; i <= n; i++){
        scanf("%lf",&a[i]);
        sum += a[i];
    }
    for(int i = 1; i <= n; i++){
        if(a[i] >= (sum/(4*m)))cnt++;
    }
    if(cnt >= m)printf("Yes\n");
    else printf("No\n");

    return 0 ;
}


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

int main(){
  string st;
  cin >> st;
  int n=0, w = 0,s=0,e=0;
  string out = "No";
  for(char c : st){
    if(c == 'N'){
      n++;
    }else if(c == 'W'){
      w++;
    }else if(c == 'S'){
      s++;
    }else{
      e++;
    }
    if(n*e*w*s > 0){
      out = "Yes";
      break;
    }
  }
   if(n == 0 & s == 0 & w*e > 0){
      out = "Yes";
    }
    if(w == 0 & e == 0 & n*s > 0){
      out = "Yes";
    }
  cout << out;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
using namespace std;
static const int MAX=200000;


int main() {
  int R[MAX], n;
  cin >>n;
  for(int i=0;i<n;i++)cin >>R[i];
  int maxv=-2000000009;
  int minv=R[0];

  for(int i=1;i<n;i++){
	  maxv=max(maxv,R[i]-minv);
	  minv=min(minv,R[i]);
  }
  cout << maxv <<endl;

	return 0;
}

Measured memory_bytes: 3860
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
typedef long long LL;
int N,K;

vector<int>v[201];

void dfs(int N,int now){
	int mid=(now+N)/2;
	if(now==mid)return;
	if(now==mid-1)return;
	for(int i=now+1;i<mid;i++){
		v[now].push_back(i);
	}
	/*for(int i=mid+1;i<N;i++){
		v[mid].push_back(i);
	}*/
	dfs(mid-1,now+1);
	dfs(N,mid);
}

void answer(int N,int now){
	cout<<now+1<<endl;
	string s;
	cin>>s;
	if(s=="Yes"){
	}
	if(s=="Near"){
		answer((now+N)/2-1,now+1);
	}
	if(s=="No"){
		if((now+N)/2==now){
			answer(N,(now+N)/2+1);
		}else{
			answer(N,(now+N)/2);
		}
	}
}

int main(){
	cin>>N>>K;
	dfs(N,0);
	int a=0;
	REP(i,N){
		a+=v[i].size();
	}
	cout<<a<<endl;
	REP(i,N){
		REP(j,v[i].size()){
			cout<<i+1<<" "<<v[i][j]+1<<endl;
		}
	}
	REP(i,K){
		answer(N,0);
	}
}


Measured memory_bytes: 3320
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
using ll = long long;
int main(void){
    int n,m;
    cin>>n>>m;
    vector <ll> A(n);
    vector <pair<ll,ll>> data(m); //変える数, 回数
    int sum=0;
    for(int i=0;i<n;i++){
    cin>>A[i];
    sum+=A[i];
    }
    for(int i=0;i<m;i++){
        ll a,b; cin>>a>>b;
        data[i]= make_pair(b,a);
    }
    sort(data.begin(),data.end());
    reverse(data.begin(),data.end());
    sort(A.begin(),A.end());
    int x =0 ;
    bool ok = true;
    for(int i=0;i<m;i++){
        for(int j=0;j<data[i].S;j++){
            if(A[x]<data[i].F) {A[x]= data[i].F; x++;}
            else ok = false;
            if(ok==false) break;
        }
        if(ok==false) break;
    }
    ll ans = 0;
    for(int i=0;i<n;i++){
        //cout<<A[i]<<endl;
        ans+= A[i];
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 2560
#include <bits/stdc++.h>
#define int long long
using namespace std;
const int N = 1e5 + 10;
int has[N], mp[N];
int32_t main(){
  ios_base::sync_with_stdio(false);
  cin.tie(0); cout.tie(0);
  int n, k, q;
  cin >> n >> k >> q;
  vector<string> ans(n);
  for(int i = 0; i < N; i++){
    mp[i] = k;
  }
  for(int i = 0; i < q; i++){
    int num;
    cin >> num;
    if(mp[num] <= 0) continue;
    mp[num] -= (i - has[num]);
    has[num] = i + 1;
  }
  for(int i = 1; i <= n; i++){
    if(mp[i] <= 0){
      ans[i - 1] = "No";
    }else{
      mp[i] -= (q - has[i]);
      if(mp[i] <= 0){
        ans[i - 1] = "No";
      }else{
        ans[i - 1] = "Yes";
      }
    }
  }
  for(auto v : ans){
    cout << v << endl;
  }
}






Measured memory_bytes: 7680
#include <bits/stdc++.h>
#define itn int
#define gI gi

using namespace std;

typedef long long ll;

inline int gi()
{
	int f = 1, x = 0; char c = getchar();
	while (c < '0' || c > '9') {if (c == '-') f = -1; c = getchar();}
	while (c >= '0' && c <= '9') x = x * 10 + (c ^ 48), c = getchar();
	return f * x;
}

inline ll gl()
{
	ll f = 1, x = 0; char c = getchar();
	while (c < '0' || c > '9') {if (c == '-') f = -1; c = getchar();}
	while (c >= '0' && c <= '9') x = x * 10 + (c ^ 48), c = getchar();
	return f * x;
}

const int maxn = 1000003;

int n, m, q, t, a[maxn];
string s;

int main()
{
	//freopen(".in", "r", stdin);
	//freopen(".out", "w", stdout);
	char c;
	cin >> c;
	printf("%c\n", c + 1);
	return 0;
}


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

int main() {
  int X;
  cin>>X;
  vector<int> A={1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51
};
  cout<<A.at(X-1)<< endl;
}

Measured memory_bytes: 256
import java.util.*;
//alg 2 submission
public class Main {
	public static void main(String[] args) {
		Scanner scin = new Scanner(System.in);
		
		int[] nums = new int[Integer.parseInt(scin.nextLine())];
		
		for(int i = 0; i < nums.length; i++) {
			nums[i] = Integer.parseInt(scin.nextLine());
		}
		
		//System.out.println(alg1(nums));
		System.out.println(alg2(nums));
	}
	
	static int alg1(int[] inputs) {
		int max = Integer.MIN_VALUE;
		for(int i = 0; i < inputs.length - 1; i++) {
			for(int j = i + 1; j < inputs.length; j++) {
				if(inputs[j] - inputs[i] > max) {
					max = inputs[j] - inputs[i];
				}
			}
		}
		
		if (inputs.length < 2){
			return 0;
		}
		
		return max;
	}
	
	static int alg2(int[] inputs) {
		if (inputs.length < 2) {
			return 0;
		}
		int minCurVal = inputs[0];
		int max = Integer.MIN_VALUE;
		for (int i = 1; i < inputs.length; i++) {
			if(inputs[i] - minCurVal > max) {
				max = inputs[i] - minCurVal;
			}
			
			if (inputs[i] < minCurVal) {
				minCurVal = inputs[i];
			}
			
		}
		return max;
	}
}



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

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

#define m0(x) memset(x, 0, sizeof(x))
#define all(x) x.begin(), x.end()
#define rep(i, n) for(int i = 0; i < (n); i++)
#define asort(x) sort(all(x));
#define dsort(x, t) sort(x.begin(), x.end(), greater<t>());
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end());
#define MINS(m, s) m.insert(make_pair(s, 1));
#define MFIN(m, s) m.find(s) != m.end()
#define INF (1 << 29)
const int mod = 1000000007;

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

    vector<ll> h(n);
    for(ll i = 0; i < n; i++) {
        cin >> h[i];
    }
    dsort(h, ll);

    ll ans = 0;
    for(ll i = k; i < n; i++) {
        ans += h[i];
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 4692
#include <bits/stdc++.h>
#include <iostream>
#include <string>
using namespace std;
#include <stdio.h>

int main(){
    int h, w;
    int i, j;
    while(1){
        scanf("%d %d ", &h, &w);
        if(h==0&&w==0)break;
        for(i=0;i<h;i++){
            for(j=0;j<w;j++){
                printf("#");
            }
            printf("\n");
        }
        printf("\n");
    }

    return 0;
}


Measured memory_bytes: 3140
/*

    author : s@if

*/

#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

#define 		NIL 			-1
#define		 	fi	 		    first
#define 		sec 			second
#define 		MAX 			INT_MAX
#define			INF 			1e9
#define 		ll 			    long long
#define 		PI 			    acos(-1.0)
#define			MOD 			1000000007
#define 		PLL 			pair<ll,ll>
#define 		PII			    pair<int,int>
#define 		ull 			unsigned long long
#define 		For(i,a,b) 		for(int i=a;i<=(int)b;i++)
typedef tree<int, null_type, less<int>, rb_tree_tag,
            tree_order_statistics_node_update> new_data_set;

//*find_by_order(k)  gives the kth element;
//order_of_key(item)   gives the index(number of element strictly less than item) of item;


inline int in() {int x; scanf("%d", &x); return x; }
bool Check(int N , int pos)	{	return (bool) (N & (1<<pos));}
int Set(int N, int pos) {	return N = N | (1<<pos);}

int fx[]={+0,+0,+1,-1,-1,+1,-1,+1};    // King's move
int fy[]={-1,+1,+0,+0,+1,+1,-1,-1};
int hx[]={-2,-2,-1,+1,+2,+2,-1,+1};    // Knight's move
int hy[]={+1,-1,+2,+2,-1,+1,-2,-2};
int dx[]={+1,-1,+0,+0};
int dy[]={+0,+0,+1,-1};

const int MAXN = (int)2e5+9;


int main()
{
/*	freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);  */

    int i,j,k,l,m,n,p,q,x,y,u,v,r,tc,t;

    double d; cin>>d; d/=3.0;

    cout<<fixed<<setprecision(12)<<d*d*d<<endl;

  //  main();

    return 0;
}

// read the question correctly (is y a vowel? what are the exact constraints?)
// look out for SPECIAL CASES (n=1?) and overflow (ll vs int?)


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pli pair<ll,int>
#define fi first
#define se second
#define inf (INT_MAX/2-1)
#define infl (1LL<<60)
#define vi vector<int>
#define pb push_back
#define sz(a) (int)(a).size()
#define all(a) begin(a),end(a)
#define y0 y5656
#define y1 y7878
#define aaa system("pause");
#define dbg(x) cerr<<(#x)<<": "<<(x)<<'\n',aaa
#define dbga(x,n) cerr<<(#x)<<"[]: ";for(int _=0;_<n;_++)cerr<<x[_]<<' ';cerr<<'\n',aaa
#define dbgs(x) cerr<<(#x)<<"[stl]: ";for(int _:x)cerr<<_<<' ';cerr<<'\n',aaa
#define dbgp(x) cerr<<(#x)<<": "<<x.fi<<' '<<x.se<<'\n',aaa
#define maxn 100000

using namespace std;

vi g[maxn+5];
int d[maxn+5];
bool viz[maxn+5];

int Dp (int nod) {
  if (viz[nod]) return d[nod];
  viz[nod] = 1;
  for (int nn: g[nod]) d[nod] = max(d[nod], 1+Dp(nn));
  return d[nod];
}

int main () {
  ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
  int n, m; cin >> n >> m;
  int i, a, b;
  for (i = 0; i < m; i++) {
    cin >> a >> b; a--; b--;
    g[a].pb(b);
  }
  int ans = 0;
  for (i = 0; i < n; i++) ans = max(ans, Dp(i));
  cout << ans;
  return 0;
}

Measured memory_bytes: 7552
#include "bits/stdc++.h"
#define PRECISION(x) cout << fixed << setprecision(x)
#define FAST_IO ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define ALLR(X) (X).rbegin(), (X).rend()
#define angle(a) (atan2((a).imag(), (a).real()))
#define vec(a, b) ((b) - (a))
#define length(a) (hypot((a).imag(), (a).real()))
#define dot(a, b) ((conj(a) * (b)).real())
#define cross(a, b) ((conj(a) * (b)).imag())
#define lengthSqr(p) dot(p, p)
#define rotateO(p, ang) ((p) * exp(point(0, ang)))
#define rotateA(p, ang, about) (rotateO(vec(about, p), ang) + about)
#define reflectO(v, m) (conj((v) / (m)) * (m))
#define MP make_pair
#define PB push_back
#define EB emplace_back
#define F first
#define S second
#define X() real()
#define Y() imag()
using namespace std;
 
template<class T> void max_self(T & a, const T & b) { if(a < b) a = b; }
template<class T> void min_self(T & a, const T & b) { if(a > b) a = b; }
typedef long long LL;
typedef complex<double> point;
const int INF = 1e9 + 7;
const double PI = acos(-1.0);
const double EPS = (1e-9);


int main(){
	FAST_IO
	string util;
	cin >> util;
	cout << util.substr(0, 5) << " " << util.substr(6, 7) << " " << util.substr(14);
	
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main() {
    int a,b,k;
    cin >> a >> b >> k;
    for (int i=a; i<=min(a+k-1,b); i++) cout << i << endl;
    for (int i=max(b-k+1,a+k); i<=b; i++) cout << i << endl;
}

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

typedef long long int ll;
typedef pair<ll, ll> p_ll;
typedef vector<pair<ll, ll>> vec_p; //vector<pair<ll, ll>> pairs(n) ,pairs.at(i) = make_pair(i*i, i)

#define REP(i, x) for (ll i = 0; i < (ll)(x); i++)
#define REPS(i, x) for (ll i = 1; i <= (ll)(x); i++)
#define RREP(i, x) for (ll i = ((ll)(x)-1); i >= 0; i--)
#define RREPS(i, x) for (ll i = ((ll)(x)); i > 0; i--)
#define all(x) (x).begin(), (x).end()

const ll MOD = pow(10, 9) + 7;
const ll LLINF = pow(2, 61) - 1;
const int INF = pow(2, 30) - 1;

ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }

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

    ll N;
    string S;
    cin >> N;
    vector<ll> vec(N);
    REP(i,N){
        cin >> vec.at(i);
    }

    ll ans = 0;
    ll count = 0;
    REP(i, N - 1)
    {
        ll tmp = vec.at(i + 1) - vec.at(i);
        
        if(tmp<=0){
            count++;
        }
        else{
            ans = max(ans, count);
            //cout << ans << endl;
            count = 0;
        }
    }
    ans = max(ans, count);

    cout << ans << endl;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
int dp[300009][4][3], mod = 1000000007;

int solution(string S){
  dp[0][0][0] = 1;
	for (int i = 0; i < S.size(); i++) {
		if (S[i] == '0' || S[i] == '?') {
			for (int j = 0; j < 4; j++) {
				for (int k = 0; k < 3; k++) {
					if (dp[i][j][k] == 0) continue;
					int s = k + 1; if (s == 3) s = 1;
					dp[i + 1][j][s] += dp[i][j][k];
					dp[i + 1][j][s] %= mod;
				}
			}
		}
		if (S[i] == '1' || S[i] == '?') {
			for (int j = 0; j < 4; j++) {
				for (int k = 0; k < 3; k++) {
					if (dp[i][j][k] == 0) continue;
					int s = k - 1, t = j; if (s == -1) { s = 0; t++; if (t >= 4) t = 3; }
					dp[i + 1][t][s] += dp[i][j][k];
					dp[i + 1][t][s] %= mod;
				}
			}
		}
	}
	int ans = 0;
	for (int i = 0; i < 4; i++) {
		for (int j = 0; j < 3; j++) {
			if (i - j >= 1) { ans += dp[S.size()][i][j]; ans %= mod; }
		}
	}
	return ans;
}

int main() {
	string S ;
  cin>>S;
  int res = solution(S);
  cout<<res<<endl;
	
	return 0;
}

Measured memory_bytes: 14980
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <string>
#include <functional>
#include <set>
#include <map>
#define DB cerr<<"D"<<endl
#define pb push_back
using namespace std; using ll=long long; using ld=long double; const int INF=1e9; const ll LINF=1e18; const double dINF = 1e18; const ld ldINF = 1e18; const double EPS = 1e-6;
template<typename T, typename U, typename O> void caut(T a, U b, O c){cout<<"("<<a<<","<<b<<","<<c<<") ";} template<typename T, typename U> void caut(T a, U b){cout<<"("<<a<<","<<b<<") ";} template<typename T> void caut(T a){cout<<"("<<a<<") ";}
using P=pair<int,int>;
const ll M = 1e9+7, mx = 301;
void add(ll& x, ll y) {x+=y; x%=M;}; void mul(ll& x, ll y) {x*=y; x%=M;}; void chmax(ll& x, ll y) {if (x<y) x=y;}; void chmin(ll& x, ll y) {if (x>y) x=y;};

int main() {
  char ch; cin>>ch;
  if (ch<='Z') cout<<"A"<<endl;
  else cout<<"a"<<endl;
}

Measured memory_bytes: 3628
def main():
  
  n,*d=map(int,open(0).read().split())
  d=sorted(list(d))
  l=len(d)
  s=n//2
  if d[s-1]==d[s]:
    print(0)
  else:
    print(d[s]-d[s-1])
      
if __name__=="__main__":
  main()

Measured memory_bytes: 13956
#include <iostream>
#include <vector>
#define REP(i, n) for (int i = 0; i < (n); i++)
using namespace std;

int n, m, q;
vector<int> a, b, c, d;
int ans;

void dfs(vector<int> A) {
    if (A.size() == n + 1) {
        int now = 0;
        REP(i, q) if (A[b[i]] - A[a[i]] == c[i]) now += d[i];
        ans = max(ans, now);
        return ;
    }

    A.push_back(A.back());
    while (A.back() <= m) {
        dfs(A);
        A.back()++;
    }
}

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

    cin >> n >> m >> q;

    a = b = c = d = vector<int>(q);
    REP(i, q) cin >> a[i] >> b[i] >> c[i] >> d[i];

    dfs(vector<int>(1, 1));

    cout << ans << '\n';
    return 0;
}


Measured memory_bytes: 3584
#include<bits/stdc++.h>
//g++ -std=c++11 

using namespace std;
typedef long long ll;

#define rep(i,n) for (long long i = 0; i < (n); ++i)
#define DIV 1000000007 //10^9+7

int main(){
	double W, H, x, y;
	cin >> W >> H >> x >> y;
	if(W/2 - 0.0001 < x && x < W/2 + 0.0001 && H/2 - 0.0001 < y && y < H/2 + 0.0001) {
		printf("%.10f", W * H /2);
		cout << " " << 1 << endl;
	} else {
		printf("%.10f", W * H /2);
		cout << " " << 0 << endl;
	}

}


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

def get_score(n):
    return L + n

score_total = 0
# select the apple to eat
for i in range(N):
    score_ = get_score(i)
    score_total += score_

if L >= 0:
    score_min = score_total - L
elif (L < 0) and (L + N <= 0):
    #print("2")
    score_min = score_total - get_score(N-1)
else:
    #print("3")
    score_min = score_total
print(score_min)



Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = int64_t;
using P = pair<ll, ll>;
template <class T>
using V = vector<T>;

int main() {
  int n;
  cin >> n;
  V<ll> a(n), b(n), c(n);
  rep(i, n) cin >> a[i];
  rep(i, n) cin >> b[i];
  rep(i, n) cin >> c[i];

  sort(a.begin(), a.end());
  sort(b.begin(), b.end());
  sort(c.begin(), c.end());

  V<ll> comb(n), scomb(n);
  rep(i, n) {
    auto itr = upper_bound(c.begin(), c.end(), b[i]);
    ll dist = distance(c.begin(), itr);
    comb[i] = n - dist;
  }
  scomb[n - 1] = comb[n - 1];
  for (int i = n - 2; i >= 0; i--) scomb[i] = scomb[i + 1] + comb[i];

  ll ans = 0;
  rep(i, n) {
    auto itr = upper_bound(b.begin(), b.end(), a[i]);
    int dist = distance(b.begin(), itr);
    ans += scomb[dist];
  }
  cout << ans << endl;
}


Measured memory_bytes: 7184
A,B,C= [int(i) for i in input().split()]
while(True):
	D = A%B
	if D == 0:
		if C == 1:
			print(B)
			exit()
		break
	A=B
	B=D
D = 1 + B//2
c =0
for i in range(B):
	if B%D == 0:
		c += 1
	if c == C-1:
		print(D)
		break
	D -= 1


Measured memory_bytes: 3060
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <math.h>
#include <algorithm>
#include <chrono>
#include <queue>
#include <functional>

#define out(t) cout << (t) << "\n"

using namespace std;

typedef unsigned long long ull;
typedef long long ll;
typedef unsigned int uint;

int popcount(uint x) {
    x -= x >> 1 & 0x55555555;
    x = (x & 0x33333333) + (x >> 2 & 0x33333333);
    x = x + (x >> 4) & 0x0F0F0F0F;
    return x * 0x01010101 >> 24;
}

int tzcnt(uint x) {
    return popcount(~x & x - 1);
}

struct Point {
    int x, y;

    Point(int p, int q) : x(p), y(q) {}
};

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

    vector<int> t;
    t.reserve(3);

    int k;
    cin >> k;

    t.push_back(k);

    cin >> k;

    t.push_back(k);

    cin >> k;

    t.push_back(k);

    std::sort(t.begin(), t.end());

    int p = (t[0] & 1) + (t[1] & 1) + (t[2] & 1);

    if (p == 0 || p == 3) {
        out((t[2] - t[1] + t[2] - t[0]) / 2);
    }
    else if (p == 1) {
        t[0] += t[0] & 1 ^ 1;
        t[1] += t[1] & 1 ^ 1;
        t[2] += t[2] & 1 ^ 1;

        out((t[2] - t[1] + t[2] - t[0]) / 2 + 1);
    }
    else {
        t[0] += t[0] & 1;
        t[1] += t[1] & 1;
        t[2] += t[2] & 1;

        out((t[2] - t[1] + t[2] - t[0]) / 2 + 1);
    }

    int aaa;
    cin >> aaa;
}

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

//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double dbl;
typedef pair<int, int> pii;

#define F(i, l, r) for(int i = (l); i < (r); i++)
#define DF(i, l, r) for(int i = (l); i >= (r); i--)
#define I(x, a) for(auto x : (a))
#define mp make_pair
#define X first
#define Y second
#define clean(x) memset((x), 0, sizeof(x))
#define ret return
#define cont continue
#define brk break
#define ins insert
#define all(x) (x).begin(),(x).end()
#define sync ios_base::sync_with_stdio(false);cin.tie(0)
#define pb push_back
#define y1 fjfg

const int maxn = 2e5 + 5;
const int BITS = 29;

inline int cutby(int x, int sz){
	return x&((1<<sz)-1);
}

int x[maxn];
int a[maxn];
int rb[maxn];
int b[maxn];
int pref[2][maxn];
int suff[2][maxn];
int n;

signed main(){
	sync;
	cin >> n;
	F(i, 0, n)cin >> a[i];
	F(i, 0, n)cin >> b[i];
	/*F(i, 0, n)cin >> rb[i];
	F(i, 0, n){
		b[i] = 0;
		F(j, 0, BITS)if(rb[i]&(1<<j))b[i] |= 1<<(BITS - 1 - j);
	}
	sort(b, b + n);
	F(i, 0, n){
		rb[i] = 0;
		F(j, 0, BITS)if(b[i]&(1<<j))rb[i] |= 1<<(BITS - 1 - j);
	}
	memcpy(b, rb, sizeof(b));*/
//	F(i, 0, n)cout << b[i] << endl;
	int ans = 0;
	F(j, 0, BITS){
		F(i, 0, n){
			pref[1][i] = i == 0 ? 0 : pref[1][i - 1];
			pref[0][i] = i == 0 ? 0 : pref[0][i - 1];
			if(b[i]&(1<<j))pref[1][i]++;
			else pref[0][i]++;
		}
		DF(i, n - 1, 0){
			suff[1][i] = i == (n-1) ? 0 : suff[1][i + 1];
			suff[0][i] = i == (n-1) ? 0 : suff[0][i + 1];
			if(b[i]&(1<<j))suff[1][i]++;
			else suff[0][i]++;
		}
		F(i, 0, n)rb[i] = cutby(b[i], j);
		sort(rb, rb + n);
		F(kk, 0, n){
			int allx = a[kk];
			int cut = (1<<j) - x[kk];
			x[kk] |= allx&(1<<j);
			auto pbg = lower_bound(rb, rb + n, cut);
			//cout << "KEK " << j << " " << a[kk] << " " << cut << endl;
			//if(pbg == rb + n)cout << j << " " << a[kk] << "  NO" << endl;
			//else cout << j << " " << a[kk] << " " << *pbg << endl;
			int bg = pbg - rb;
			int ones = 0;
			if(!(x[kk]&(1<<j))){
				if(bg)ones += pref[1][bg - 1];
				if(bg != n)ones += suff[0][bg];
			}
			else{
				if(bg)ones += pref[0][bg - 1];
				if(bg != n)ones += suff[1][bg];
			}
			//cout << j << " " << a[kk] << " " << ones << endl;
			if(ones&1)ans ^= 1<<j;
		}
	}
	cout << ans;
	ret 0;
}


Measured memory_bytes: 6528
#include <cstdio>
#include <cctype>

int main(){
    char c;
    while (scanf("%c", &c) != EOF){
        if (islower(c)){
            printf("%c", toupper(c));
        } else if (isupper(c)) {
            printf("%c", tolower(c));
        } else {
            printf("%c", c);
        }
    }
}



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

typedef long long int LL;
typedef long long int LLint;

//Faster Program
#define endl "\n"

//Faster Coding
#define ED return
#define GET(a) int a;cin >> a
#define DGET(a) double a;cin >> a
#define SGET(a) string a;cin >> a
#define CGET(a) char a;cin >> a
#define PRINT(a) cout << a << "\n"
#define ANS(a,b) int a;cin >> a;cout << b << "\n"
#define FOR(n) for(int i = 0;i < n;i++)
#define SORT(vec) sort(vec.begin(),vec.end())
#define REV(vec) reverse(vec.begin(),vec.end())

//As Function
#define UP(a,b) ((a+(b-1))/b)
#define ipow(x,y) LL(pow(x,y))

//Debug
#define TEST cout << "OK\n"

const double PI = M_PI;
const long long INF = int(999999999);
const long long MOD = int(1000000007);

//Settings
const bool DO_BENCHMARK = false;
const int DOUBLE_ACCURACY = 15;

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(DOUBLE_ACCURACY);
    void solve();
    if(DO_BENCHMARK){
        clock_t clock_start = clock();
        solve();
        clock_t clock_end = clock();
        const double time = static_cast<double>(clock_end-clock_start)/CLOCKS_PER_SEC*1000.0;
        cout << "\n" << time << "[ms]\n";
    }
    else solve();
}

void solve(){
    GET(N);
    vector<vector<int>> say (N,vector<int>(N,-1));
    for(int i = 0;i < N;i++){
        int vecsize;
        cin >> vecsize;
        for(int j = 0;j < vecsize;j++){
            int ppl, truth;
            cin >> ppl >> truth;
            say[i][ppl-1] = truth;
        }
    }

/*    for(int i = 0;i < N;i++){
        for(int j = 0;j < N;j++){
            cout << say[i][j] << " ";
        }
        cout << endl;
    }*/

    int ans = 0;
    for(int i = 0;i < ipow(2,N);i++){
        int dummyans = 0;
        vector<bool> dummy (N,-1);
        bool ok = true;
        for(int j = 0;j < N;j++){
            dummy[j] = (i%ipow(2,j+1))/ipow(2,j);
        }

/*        cout << "(" << i << ")" << endl;
        for(int a = 0;a < N;a++){
            cout << dummy[a];
        }
        cout << endl;*/

        for(int j = 0;j < N && ok;j++){
            if(dummy[j] == 1){
                dummyans++;
                for(int k = 0;k < N;k++){
                    if(say[j][k] == 0 && dummy[k] == 1){
                        ok = false;
//                        cout << j << "," << k << endl;
                        break;
                    }
                    if(say[j][k] == 1 && dummy[k] == 0){
                        ok = false;
//                        cout << j << "," << k << endl;
                        break;
                    }
                }
            }
        }
        if(ok){
            ans = max(ans,dummyans);
//            cout << "ANS " << dummyans << endl;
        }
    }
    cout << ans << endl;
}


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

using namespace std;


int main(){
    int N, X;
    cin >> N >> X;
    vector<int> L(N);
    for(int i=0;i<N;i++) cin >> L[i];
    int cnt=0,t=0;
    for(int i=0;i<100; i++){
        t += L[i];
        if(t>X) break;
        cnt++;
    }
    cout << cnt+1 << endl;
}


Measured memory_bytes: 256
def mp():return map(int,input().split())
def lmp():return list(map(int,input().split()))

n,m,x = mp()
cost = []
book = []
inf = int(1e18)
ans = inf
for i in range(n):
    c = lmp()
    cost.append(c[0])
    book.append(c[1:])
cond = [bin(i)[2:].zfill(n) for i in range(2**n)]
for i in range(len(cond)):
    cnt = 0
    al = [0]*(m)
    for j in range(n):
        if cond[i][j] == "1":
            cnt += cost[j]
            for k in range(m):
                al[k] += book[j][k]
    flag = True
    for j in range(m):
        if al[j] < x:
            flag = False
    if flag:
        ans = min(ans,cnt)
if ans == inf:
    print(-1)
else:
    print(ans)




Measured memory_bytes: 69588
N, x = map(int, input().split())
a = list(map(int, input().split()))
ans = 0
for i in range(N - 1):
    if a[i] + a[i + 1] > x:
        t = a[i] + a[i + 1] - x
        ans += t
        if a[i + 1] < t:
            a[i + 1] = 0
        else:
            a[i + 1] -= t

print(ans)


Measured memory_bytes: 14132
#include<stdio.h>
#include<stdlib.h>
#include<iostream>
#include<string>
#include<algorithm>
#include<vector> 
#include<limits>
#include<numeric>
#include<type_traits>
#include<math.h>
#include<fstream>
#include<set>
#include<queue>
using namespace std;
typedef long long ll;

const ll MOD = 1e9 + 7; 

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repi(i,a,b) for(int i = (int)(a); i < (int)(b); i++)
#define out(str) cout << str << endl
#define ALL(a) (a).begin(),(a).end()
#define INF_INT (1<<30)
#define INF_LL (1ll<<62)

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

int H,W,ans,tmpmaxi;
char m[25][25];
bool visited[25][25];
int nx[4]={1,0,-1,0},ny[4]={0,1,0,-1};

struct Node {
    int y;
    int x;
    int cost;
};

int main(){
    cin>>H>>W;
    rep(i,H+2){
        rep(j,W+2){
            if(i==0||i==H+1||j==0||j==W+1)m[i][j]='#';
            else{
                cin>>m[i][j];
            }
        }
    }
    rep(i,H){
        rep(j,W){
            if(m[i+1][j+1]=='#')continue;
            tmpmaxi=0;
            rep(k,25)rep(l,25){
                if(m[k][l]=='.')visited[k][l]=false;
                else visited[k][l]=true;
            }
            queue<Node> que;
            que.push({i+1,j+1,0});
            visited[i+1][j+1]=true;
            while(!que.empty()){
                Node n = que.front();
                que.pop();
                tmpmaxi=max(tmpmaxi,n.cost);
                rep(i,4){
                    if(!visited[n.y+ny[i]][n.x+nx[i]]){
                        visited[n.y+ny[i]][n.x+nx[i]]=true;
                        que.push({n.y+ny[i],n.x+nx[i],n.cost+1});
                    }
                }
            }
            ans=max(tmpmaxi,ans);
        }
    }
    out(ans);

    
    
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
//---------------------------
using namespace std;
//---------------------------
#define REP(i,n) for(int i = 0; i < (n); i++)
#define P(x) cout << (x) << "\n"

#define MOD 1000000007 // 1e9+7
#define PI 3.1415926525
#define ll long long int // 10^18
#define INF 1000000001 // 1e9+1

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

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

  // ifstream in("input.txt");
  // cin.rdbuf(in.rdbuf());

  int n;string s;cin>>n>>s;
  int maxn=0;
  REP(i,n){
    int cnt=0;
    string u1=s.substr(0, i+1);
    string u2=s.substr(i+1, n-i);
    for(char c='a';c<='z';c++){
      if(u1.find(c)!=-1 && u2.find(c)!=-1){
        cnt++;
      }
    }
    maxn=max(maxn, cnt);
  }
  P(maxn);
  return 0;
}


Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define coyes cout << "Yes" << endl;
#define cono cout << "No" << endl;
#define coYes cout << "YES" << endl;
#define coNo cout << "NO" << endl;
using namespace std;
using ll = long long int;
string large_al = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
string small_al = "abcdefghijklmnopqrstuvwxyz";
using Graph = vector<vector<int>>;

int main() {
  int a1, a2, a3;
  cin >> a1 >> a2 >> a3;
  if (a1 + a2 + a3 >= 22) {
    cout << "bust" << endl;
  }
  else {
    cout << "win" << endl;
  }
}



Measured memory_bytes: 256
#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <cfloat>
#include <stack>
#include <queue>
#include <vector>
#include <string>
#include <iostream>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;

int main(){

	int N,tmp,sum = 0;
	scanf("%d",&N);

	bool** check = new bool*[851];
	for(int i = 0; i <= 850; i++){
		check[i] = new bool[851];
		for(int k = 0; k <= 850; k++)check[i][k] = false;
	}

	check[0][0] = true;

	for(int loop = 0; loop < N; loop++){
		scanf("%d",&tmp);
		sum += tmp;

		for(int i = 850; i >= 0; i--){
			for(int k = 850; k >= 0; k--){
				if((i >= tmp && check[i-tmp][k] == true)|| (k >= tmp && check[i][k-tmp] == true)){
					check[i][k] = true;
				}
			}
		}
	}

	int ans = BIG_NUM;

	for(int i = 850; i >= 0; i--){
		for(int k = 850; k >= 0; k--){
			if(check[i][k]){
				ans = min(ans,max(i,max(k,sum-(i+k))));
			}
		}
	}

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

	return 0;
}

Measured memory_bytes: 3876
#include<cstdio>
#include<iostream>
#include<cstring>
#include<algorithm>
#define ll long long
using namespace std;
int main()
{
    int h, w;
    char m[105][105];
    cin>>h>>w;
    for(int i = 0; i < h; i++){
            getchar();
        for(int j = 0; j < w; j++){
            scanf("%c", &m[i][j]);
        }
    }

    for(int i = 0; i < h; i++){
        for(int j = 0; j < w; j++){
            printf("%c", m[i][j]);
        }
        cout<<endl;
        for(int j = 0; j < w; j++){
            printf("%c", m[i][j]);
        }
        cout<<endl;
    }



    return 0;
}


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

int main() {
  int N, Q;
  cin >> N >> Q;
  int ac[N + 2];

  char c1, c2;
  cin >> c1;
  ac[1] = 0;
  for (int i = 2; i <= N; i++) {
    cin >> c2;

    if (c1 == 'A' && c2 == 'C') {
      ac[i] = ac[i - 1] + 1;
    } else {
      ac[i] = ac[i - 1];
    }

    c1 = c2;
  }

  int l[Q], r[Q], ans;
  for (int i = 0; i < Q; i++) {
    cin >> l[i] >> r[i];
  }

  for (int i = 0; i < Q; i++) {
    ans = ac[r[i]] - ac[l[i]];
    cout << ans << endl;
  }

  return 0;
}


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

int main(){
  int N,i=0;
  cin >> N;
  while(true){
    if(i*i>N){
      break;
    }
    else{
      i++;
    }
  }
  cout << (i-1)*(i-1) << endl;
}   

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

int main() {
    int N; cin >> N;
    ll ans = 0;
    rep(i, N){
        int a; cin >> a;
        ans += a;
    }
    ans -= N;

    cout << ans << endl;

    return 0;
}

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

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

int main(){
    int N[4];
    rep(i,4) cin>>N[i];
    sort(N,N+4);
    if(N[0]==1&&N[1]==4&&N[2]==7&&N[3]==9) cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
}

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

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

  int64_t N;
  cin >> N;
  vector<int64_t> d(N);
  for (int64_t i = 0; i < N; i++) {
    cin >> d.at(i);
  }

  sort(d.begin(), d.end()); 

  int64_t c = N / 2; 
  cout << d.at(c) - d.at(c-1); 

  return 0;
}


Measured memory_bytes: 3980
#include <limits.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <algorithm>
#include <cfloat>
#include <complex>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>

using namespace std;

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

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

int main() {
  int N;

  cin >> N;

  int ans = (N % 2 == 0) ? N : 2 * N;

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 256