akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <cmath>
#include <set>
using namespace std;
typedef long long int ll;

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

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

const int INF = 1001001001;
const ll LINF = 1001002003004005006ll;

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

  vector<set<int>> v(26);
  rep (i, n) {
    v[s[i] - 'a'].insert(i);
  }

  int q;
  cin >> q;
  rep (i, q) {
    int type;
    cin >> type;
    if (type == 1) {
      int x;
      char c;
      cin >> x;
      cin >> c;
      x--;
      v[s[x] - 'a'].erase(x);
      s[x] = c;
      v[c - 'a'].insert(x);
    } else if (type == 2) {
      int l, r;
      cin >> l >> r;
      l--;
      int ans = 0;
      rep (j, 26) {
        auto it = v[j].lower_bound(l);
        if (it != v[j].end() && *it < r) ans++;
      }
      cout << ans << endl;
    }
  }

  return 0;
}

Measured memory_bytes: 24196
#include <iostream>
#include <cstdlib>
using namespace std;
string a;
 
void f(int p) {
	if(p==a.size()) {cout<<"YES"; exit(0);}
	if(a.substr(p,5)=="dream") f(p+5);
	if(a.substr(p,5)=="erase") f(p+5);
	if(a.substr(p,6)=="eraser") f(p+6);
	if(a.substr(p,7)=="dreamer") f(p+7);
}
 
int main() {
	cin>>a;
	f(0);
	cout<<"NO";
	return 0;
}

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

#define rep(n) for(int i=0;i<n;i++)
#define repp(j, n) for(int j=0;j<n;j++)
#define reppp(i, m, n) for(int i=m;i<n;i++)
#define all(c) c.begin(), c.end()
#define rall(c) c.rbegin(), c.rend()
#define debug(x) cerr << #x << ": " << x << endl

using namespace std;

typedef long long ll;
typedef pair<ll, ll> Pll;
typedef pair<int, int> Pii;

const ll MOD = 1000000007;
const long double EPS = 10e-10;

int main(){
    std::ios::sync_with_stdio(0); cin.tie(0);
    string s,t;
    cin >> s >> t;
    bool ans = false;
    int n = int(s.length());
    for(int j=0;j<n;j++){
        bool tmp = true;
        rep(n){
            if(s[(j+i)%n] != t[i]){
                tmp = false;
                break;
            }
        }
        if(tmp){
            ans = true;
            break;
        }
    }
    cout << (ans?"Yes":"No") << endl;
}


Measured memory_bytes: 256
#include<stdio.h>
   int main()
   {
   char s[4];int k=0;
   scanf("%s",s);
   for(int i=0;i<4;i++){
   if(s[i]==s[i+1]) k++;
   }
     if(k>0) printf("Bad\n");
    else printf("Good\n");
 return 0;
 }
    

Measured memory_bytes: 128
import sys
readline = sys.stdin.readline
n = int(input())
min_r = int(input())
max_r = -1e10
for _ in range(n - 1):
    r = int(readline())
    max_r = max(max_r, r - min_r)
    min_r = min(min_r, r)
print(max_r)



Measured memory_bytes: 5632
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < n; ++i)
#define rrep(i, st, n) for (int i = st; i < n; ++i)
using pii = pair<int, int>;
#define chmax(a, b) a = max(a, b)
#define chmin(a, b) a = min(a, b)
#define inf (int)1e9+7
#define eb emplace_back

template<typename T> void out(vector<T> v) {rep(i, v.size()) cout << v[i] << " "; cout << endl;}
int main() {
    cin.tie(0); ios::sync_with_stdio(false);
    int n, k; string s; cin >> n >> k >> s;
    vector<int> Nums;
    int now = 1; //今見ているかず
    int cnt = 0; //nowがいくつ並んでいるか
    for (int i = 0; i < n; ++i) {
        if (s[i] == (char)('0' + now)) cnt++;
        else {
            Nums.eb(cnt);
            now = 1 - now; //0, 1 切り替え
            cnt = 1; //新しいのをカウントし始める
        }
    }
    if (cnt != 0) Nums.push_back(cnt);
    //1 - 0 - 1 - 0 - 1
    //0で終わってたら
    if(Nums.size() % 2 == 0) Nums.eb(0);
    int Add = 2 * k + 1;
    int ans = 0;
    int left = 0;
    int right = 0;
    int tmp = 0; //[left, right)のsum
    //1 - 0 - 1...の1から始めるので偶数番目だけ見る
    for (int i = 0; i < Nums.size(); i += 2) {
        int Nextleft = i;
        int Nextright = min(i + Add, (int)Nums.size());
        //左端を移動する
        while (Nextleft > left) {
            tmp -= Nums[left];
            left++;
        }
        while (Nextright > right) {
            tmp += Nums[right];
            right++;
        }
        chmax(ans, tmp);
    }
    cout << ans << endl;
}


Measured memory_bytes: 1020
using System;

namespace a
{
    class Program
    {
        static void Main(string[] args)
        {
            var _ = Console.ReadLine().Split();
            var n = int.Parse(_[0]);
            var a = int.Parse(_[1]);
            var b = int.Parse(_[2]);

            var p = Math.Min(n * a, b);
            Console.WriteLine(p);
        }
    }
}


Measured memory_bytes: 13140
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<string>
#include<algorithm>
#include<iostream>
#include<bitset>
#include<functional>
#include<numeric>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<cassert>
#include<cmath>
#include<iomanip>
#include<random>
#include<ctime>
#include<complex>
using namespace std;
typedef long long LL;
typedef double D;
#define all(v) (v).begin(), (v).end()
mt19937 gene(233);
typedef complex<double> Complex;
#define fi first
#define se second
#define ins insert
#define pb push_back
inline char GET_CHAR(){
	const int maxn = 131072;
	static char buf[maxn],*p1=buf,*p2=buf;
	return p1==p2&&(p2=(p1=buf)+fread(buf,1,maxn,stdin),p1==p2)?EOF:*p1++;
}
inline int getInt() {
	int res(0);
	char c = getchar();
	while(c < '0') c = getchar();
	while(c >= '0') {
		res = res * 10 + (c - '0');
		c = getchar();
	}
	return res;
}

inline LL fastpo(LL x, LL n, LL mod) {
	LL res(1);
	while(n) {
		if(n & 1) {
			res = res * (LL)x % mod;
		}
		x = x * (LL) x % mod;
		n /= 2;
	}
	return res;
}
LL gcd(LL a, LL b) { return b ? gcd(b, a % b) : a; }

inline string itoa(int x, int width = 0) {
  string res;
  if(x == 0) res.push_back('0');
  while(x) {
    res.push_back('0' + x % 10);
    x /= 10;
  }
  while((int)res.size() < width) res.push_back('0');
  reverse(res.begin(), res.end());
  return res;
}
const int _B = 131072;
char buf[_B];
int _bl = 0;
inline void flush() {
	fwrite(buf, 1, _bl, stdout);
	_bl = 0;
}
__inline void _putchar(char c) {
	if(_bl == _B) flush();
	buf[_bl++] = c;
}
inline void print(LL x, char c) {
	static char tmp[20];
	int l = 0;
	if(!x) tmp[l++] = '0';
	else {
		while(x) {
			tmp[l++] = x % 10 + '0';
			x /= 10;
		}
	}
	for(int i = l - 1; i >= 0; i--) _putchar(tmp[i]);
	_putchar(c);
}
struct P {
	D x, y;
};
const int N = 300033;
const int LOG = 20;
const int mod = 1e9 + 7;
const int inf = 1e9 + 7;
int n, m;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
int cnt[N];
int main() {
	int n;
	cin >> n;
	for(int x = 1; x <= 100; x++) for(int y = 1; y <= 100; y++) for(int z = 1; z <= 100; z++) {
		int a = x * x + y * y + z * z + x * y + y * z + z * x;
		if(a <= n) cnt[a]++;
	}
	for(int i = 1; i <= n; i++) cout << cnt[i] << endl;
}






Measured memory_bytes: 3636
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("Failed to read bytes") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let n:usize = read();
    let mut cnt = 0;
    for _ in 0..n {
        if read::<usize>() == read::<usize>() {
            cnt += 1;
        } else {
            cnt = 0;
        }
        if cnt >= 3 {
            println!("Yes");
            return
        }
    }
    println!("No");
}


Measured memory_bytes: 2160
//  cout << char(i+48) << endl;//なぜかaは47と得る時がある。+48で出力もaにできる。
//  cout << char(97) << endl;//アスキーコードでaを出力
// sort(b.begin(), b.end());//bという配列を小さい方からソート
// reverse(b.begin(), b.end());//bという配列をリターン
// 10桁でdouble出力するパターン１ 
// printf("%.10f\n", ma);
// 10桁でdouble出力するパターン２
//cout << fixed << setprecision(10);
//  cout << ma << endl;

/*01 02 03 12 13 23　と６回見ていくパターン 
for(int i=0;i<n-1;i++){
  for(int j=i+1;j<n;j++){
    }
  }
*///vector<vector<int>> data(3, vector<int>(4));//int型の2次元配列(3×4要素の)の宣言
//int64_t a;
//10のi乗pow(10, i);
/*string s; stringでの文字列を数字型に変える方法
  cin >> s;
  rep(i,s.size()-2) {
  int a= (s.at(i)-'0')*100 + (s.at(i+1)-'0')*10+ s.at(i+2) -'0';
    */
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main() {
  string A,B,C;
  cin >> A >> B >> C;
  int acnt = 0;
  int bcnt = 0;
  int ccnt = 0;
  A += 'k';
  B += 'k';
  C += 'k';
  char ch = A.at(0);
  for(;;){
    if(ch == 'k')break;
    if(ch == 'a'){
      acnt++;
      ch = A.at(acnt-1);
    }
    if(ch == 'b'){
      bcnt++;
      ch = B.at(bcnt-1);
    }
    
    if(ch == 'c'){
      ccnt++;
      ch = C.at(ccnt-1);
    }
  }
  if(acnt == A.size() ) cout<<"A"<<endl;
  else if(bcnt == B.size() ) cout<<"B"<<endl;
  else cout<<"C"<<endl;
}


Measured memory_bytes: 3616
package main

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

func main() {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)

	n := nextInt(sc)
	r := make([]int64, n)

	for i := int64(0); i < n; i++ {
		r[i] = nextInt(sc)
	}

	var max, min int64
	max = math.MinInt64
	min = r[0]

	for i := int64(1); i < n; i++ {
		t := r[i] - min
		if max < t {
			max = t
		}
		if min > r[i] {
			min = r[i]
		}
	}
	fmt.Println(max)
}

func nextString(sc *bufio.Scanner) string {
	sc.Scan()
	return sc.Text()
}

func nextInt(sc *bufio.Scanner) int64 {
	i, err := strconv.ParseInt(nextString(sc), 10, 64)
	if err != nil {
		panic(err)
	}
	return i
}



Measured memory_bytes: 5408
#include <bits/stdc++.h>
//#include <boost/multiprecision/cpp_int.hpp> namespace mp = boost::multiprecision; //mp::cpp_intで宣言
using namespace std;
typedef long long ll;
#define i_7 (ll)(1E9+7)
#define i_5 (ll)(1E9+5)
ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    else return c+i_7;
}
typedef pair<int,int> i_i;
typedef pair<ll,ll> l_l;
ll inf=(ll)1E12;//10^12
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
void Max(ll * pos,ll val){*pos=max(*pos,val);}//Max(&dp[i][j],dp[i-1][j]);
void Min(ll * pos,ll val){*pos=min(*pos,val);}
void Add(ll * pos,ll val){*pos=mod(*pos+val);}
const long double EPS=1E-8;
////////////////////////////////////////



int main(){
    
    ll n;cin>>n;
    ll a[n];rep(i,0,n-1)cin>>a[i];
    sort(a,a+n);
    ll sum=0;
    rep(i,0,n-2)sum+=a[i];
    sum+=a[n-1]/2;
    cout<<sum<<endl;
    
    return 0;
}


Measured memory_bytes: 256
n=int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
remain=A[0]
ans1=0
for i in range(n):
    if B[i]<remain:
        ans1+=B[i]
        remain=A[i+1]
    else:
        ans1+=remain
        yoryoku=B[i]-remain
        if yoryoku>A[i+1]:
            ans1+=A[i+1]
            remain=0
        else:
            ans1+=yoryoku
            remain=A[i+1]-yoryoku
print(ans1)

Measured memory_bytes: 18476
from queue import deque

while True:
    n, k = map(int, input().split())
    if not n:
        break
    q = deque(int(input()) for _ in range(k))
    ans = cur = sum(q)
    for _ in range(n - k):
        new = int(input())
        q.append(new)
        old = q.popleft()
        cur += new - old
        ans = ans if ans > cur else cur
    print(ans)

Measured memory_bytes: 10236
from collections import Counter
from operator import itemgetter
n,k = map(int,input().split())
dic = Counter(list(map(int,input().split())))
x = len(dic) - k
lis = sorted(dic.items(), key = itemgetter(1))
ans = 0
for i in range(x):
    ans += lis[i][1]
print(ans)

Measured memory_bytes: 37776
#include<bits/stdc++.h>
#define IL inline
#define RI register int
std::string a;
int ans;
main()
{
    std::cin>>a;
    for(RI i=1;i<a.length();i++)
    if(a[i]!=a[i-1])ans++;
    std::cout<<ans<<std::endl;
}

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

using ll = long long;
using Pi = pair<int, int>;
using Pl = pair<ll, ll>;
using vint = vector<int>;
using vvint = vector<vint>;
using vvvint = vector<vvint>;
using vdouble = vector<double>;
using vvdouble = vector<vdouble>;
using vvvdouble = vector<vvdouble>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vvvll = vector<vvll>;
using uint = unsigned int;
using ull = unsigned long long;

template<typename T> using uset = unordered_set<T>;
template<typename T1, typename T2> using umap = unordered_map<T1, T2>;

constexpr int INF = (1 << 30) - 1;
constexpr ll LLINF = 1LL << 60;
constexpr int dy[] = {1, 0, -1, 0, 1, -1, -1, 1};
constexpr int dx[] = {0, 1, 0, -1, 1, 1, -1, -1};
constexpr char el = '\n';
constexpr int mod = 1000000007;
constexpr int mod2 = 998244353;
template<typename T> T gcd(T a, T b) { return (b ? gcd(b, a % b) : a); }
template<typename T> T lcm(T a, T b) { return (a / gcd(a, b) * b); }
template<typename T1, typename T2>
inline bool chmin(T1 &a, T2 b) { return (a > b && (a = b, true)); }
template<typename T1, typename T2>
inline bool chmax(T1 &a, T2 b) { return (a < b && (a = b, true)); }
template<typename T>
bool isin(T y, T x, T h, T w) { return (0 <= y && 0 <= x && y < h && x < w); }
template<typename T>
bool isin1(T y, T x, T h, T w) { return (0 < y && 0 < x && y <= h && x <= w); }

template<typename T>
ostream& operator <<(ostream &os, vector<T> &v) {
	os << v[0];
	for (int i = 1; i < v.size(); i++) os << " " << v[i];
	return (os);
}

template<typename T>
istream& operator >>(istream &is, vector<T> &v) {
	for (auto &u : v) is >> u;
	return (is);
}

template<typename T1, typename T2>
istream& operator >>(istream &is, pair<T1, T2> &p) {
	return (is >> p.first >> p.second);
}


void Main() {
	int A, B; cin >>A  >> B;
	cout << A* B << endl;
}

int main() {
	cin.tie(0);
	ios::sync_with_stdio(0);
	cout << fixed << setprecision(20);
	Main();
	return (0);
}


Measured memory_bytes: 3636
// Ver19.03
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define INF 1 << 29
#define LLINF 4545454545454545454
#define MOD 1000000007
#define ll long long
#define ull unsigned long long
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) < (b) ? (a) : (b))
int upll(const void *a, const void *b) { return *(ll *)a < *(ll *)b ? -1 : *(ll *)a > *(ll *)b ? 1 : 0; }
int downll(const void *a, const void *b) { return *(ll *)a < *(ll *)b ? 1 : *(ll *)a > *(ll *)b ? -1 : 0; }
void sortup(ll *a, int n) { qsort(a, n, sizeof(ll), upll); }
void sortdown(ll *a, int n) { qsort(a, n, sizeof(ll), downll); }

int main()
{
  int a, i = 1, tmp = 0, ans = 1;
  scanf("%d", &a);
  for (; i <= a; i++)
  {
    int count = 0;
    int ii = i;
    while (ii % 2 == 0)
    {
      ii /= 2;
      count++;
    }
    if (tmp < count)
    {
      tmp = count;
      ans = i;
    }
  }
  printf("%d\n", ans);
  return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<algorithm>
#include<string>
#include<cstdlib>
#include<map>
#include<iomanip>
#include<sstream>
#include<vector>
#include<stack>
#include<math.h>
#include<queue>
#include<complex>
#include<random>
#include<ctime>
#include<set>

using namespace std;
#define SAY_YES cout<<"YES"<<endl;
#define SAY_Yes cout<<"Yes"<<endl;
#define SAY_NO cout<<"NO"<<endl;
#define SAY_No cout<<"No"<<endl;
#define IFYES(TRUE_OR_FALSE) if(TRUE_OR_FALSE){cout<<"YES"<<endl;}else{cout<<"NO"<<endl;} 
#define IFYes(TRUE_OR_FALSE) if(TRUE_OR_FALSE){cout<<"Yes"<<endl;}else{cout<<"No"<<endl;} 
#define IFyes(TRUE_OR_FALSE) if(TRUE_OR_FALSE){cout<<"yes"<<endl;}else{cout<<"no"<<endl;} 
#define DEBUG_OUTPUT_ARRAY(XXX,ONE) for(int i=0;i<(ONE);i++){cout<<"DEBUG: i = "<<i<<" -> "<<XXX[i]<<endl;}
#define DEBUG_OUTPUT_ARRAY2(XXX,ONE,TWO) for(int i=0;i<(ONE);i++){cout<<"<<< i = "<<i<<" >>>"<<endl;for(int j=0;j<(TWO);j++){cout<<"DEBUG: j = "<<j<<" -> "<<XXX[i][j]<<endl; } }
#define DEBUG_OUTPUT_ARRAY2_BOX(XXX,ONE,TWO) for(int i=0;i<(ONE);i++){cout<<i<<"  ";for(int j=0;j<(TWO);j++){cout<<XXX[i][j]<<" "; } cout<<endl;}

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


const long long int mod=1000000007;
const long long int INF=99999999999999999;

long long int n,q,S[150050],T[100050],res=0;
int main() {
	cout << fixed << setprecision(18);
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>S[i];
    }
    cin>>q;
    for(int i=0;i<q;i++){
        cin>>T[i];
        long long int ng=-1,ok=n,mid;
        while(ok-ng>1){
            mid=(ok+ng)/2;
            if(S[mid]<T[i]){ng=mid;}
            else{ok=mid;}
        }
        if(S[ok]==T[i]){res++;}
        //cout<<S[ok]<<endl;
    }
    cout<<res<<endl;
} 



Measured memory_bytes: 4276
n = input()
data = input()

w = []
r = []
for i in range(len(data)):
  if data[i] == "W":
    w.append(i)
  else:
    r.append(i)

ans = 0
if len(w) == 0:
  print(ans)
elif len(r) == 0:
  print(ans)
else:
  r = r[::-1]
  for i in range(min(len(w), len(r))):
    tmp_w = w[i]
    tmp_r = r[i]
    if tmp_w <= tmp_r:
      r.append(tmp_w)
      w.append(tmp_r)
      ans += 1
    else:
      break
  print(ans)

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

// #define int long long // intで書いたけど心配なときにlong longに変換する
struct Fast {Fast(){std::cin.tie(0);ios::sync_with_stdio(false);}} fast;

/* short */
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define Fi first
#define Se second
#define ALL(v) begin(v), end(v)
#define RALL(v) rbegin(v), rend(v)
#define X real()
#define Y imag()

/* REPmacro */
#define REPS(i, a, n) for (ll i = (a); i < (ll)(n); ++i)
#define REP(i, n) REPS(i, 0, n)
#define RREP(i, n) REPS(i, 1, n + 1)
#define DEPS(i, a, n) for (ll i = (a); i >= (ll)(n); --i)
#define DEP(i, n) DEPS(i, n, 0)
#define EACH(i, n) for (auto&& i : n)

/* debug */
#define debug(x) cerr << x << " " << "(L:" << __LINE__ << ")" << '\n';

/* alias */
using ll = long long;
using ull = unsigned long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using pii = pair<int, int>;
using D = double;
using P = complex<D>;
using vs = vector<string>;
template <typename T> using PQ = priority_queue<T>;
template <typename T> using minPQ = priority_queue<T, vector<T>, greater<T>>;

/* const */
const int INF = 1001001001;
const ll LINF = 1001001001001001001ll;
const int MOD = 1e9 + 7;
const D EPS = 1e-9;
const int dx[] = {0, 1, 0, -1, 1, -1, 1, -1}, dy[] = {1, 0, -1, 0, 1, -1, -1, 1};

/* func */
inline bool inside(int y, int x, int H, int W) {return y >= 0 && x >= 0 && y < H && x < W;}
inline int in() {int x; cin >> x; return x;}
inline ll IN() {ll x; cin >> x; return x;}
inline vs split(const string& t, char c) {vs v; stringstream s(t); string b; while(getline(s, b, c)) v.eb(b); return v;}
template <typename T> inline bool chmin(T& a, const T& b) {if (a > b) a = b; return a > b;}
template <typename T> inline bool chmax(T& a, const T& b) {if (a < b) a = b; return a < b;}
template <typename T, typename S> inline void print(const pair<T, S>& p) {cout << p.first << " " << p.second << endl;}
template <typename T> inline void print(const T& x) {cout << x << '\n';}
template <typename T, typename S> inline void print(const vector<pair<T, S>>& v) {for (auto&& p : v) print(p);}
template <typename T> inline void print(const vector<T>& v, string s = " ") {REP(i, v.size()) cout << v[i] << (i != (ll)v.size() - 1 ? s : "\n");}


signed main() {
    ll a, b, c; cin >> a >> b >> c;
    if(c-b-a > 0 && 4*a*b < (c-b-a)*(c-b-a)){
        print("Yes");
    } else {
        print("No");
    }
}

// https://github.com/kurokoji/.cpp-Template/wiki テンプレートについて
// http://www.creativ.xyz/dump-cpp-652 dump()について
// https://gist.github.com/rigibun/7905920 色々

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long int
#define endl "\n"
#define mod 1000000007
#define pb push_back
#define ff first
#define ss second
using namespace std;

void solve(){
	int n;
	cin>>n;
	if (n>=30)
	{
		cout<<"Yes";
	}
	else{
		cout<<"No";
	}
}
  
int main(){
	ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
	ll t=1;
	//cin>>t;
	while(t--){
		solve();
	}
	return 0;
}

Measured memory_bytes: 3648
#include <iostream> // cin, cout, cerr, clog
#include <algorithm> // minmax, sort, swap
#include <numeric> // iota, accumulate, inner_product
#include <cstdio> // printf, scanf
#include <climits> // INT_MIN, LLONG_MIN
#include <cmath> // long, trig, pow
#include <string> // string, stoi, to_string
#include <vector> // vector
#include <queue> // queue, priority_queue
#include <deque> // deque
#include <stack> // stack
#include <map> // key-value pairs sorted by keys
#include <set> // set
#include <unordered_map> // hashed by keys
#include <unordered_set> // hashed by keys
#include <iomanip> // cout<<setprecision(n)

#define rep(i,n) for(int i = 0; i < n; i++)
#define ENDL "\n"
#define print(i) std::cout << (i) << "\n"

#define int long long // at least int64 > 9*10^18
#define all(v) v.begin(), v.end()

signed main() {
	int n;
	std::cin >> n;
	std::vector<int> a(n);
	rep(i,n) std::cin >> a[i];
	std::vector<int> b(n);
	b[0] = 0;
	rep(i,n) b[0]+=a[i]*(i&1?-1:1);
	print(b[0]);
	for(int i=1;i<n;i++) {
		b[i] = (a[i-1]-b[i-1]/2)*2;
		print(b[i]);
	}
	return 0;
}


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

#define ll long long
#define vvi vector<vector<int>>
#define vec vector
#define pq priority_queue
#define all(v) (v).begin(), (v).end()
#define uniqueV(x) sort(x.begin(), x.end()); x.erase(unique(x.begin(), x.end()), x.end());
#define rep(i, n) for (int (i) = (0); (i) < (n); ++(i))
#define repp(i, m, n) for (int (i) = (m); (i) < (n); ++(i))
#define debug(x) cerr << #x << ": " << x << endl;
#define debug2(x, y) cerr<<"("<<#x<<", "<<#y<<") = "<<"("<<x<<", "<<y<<")"<<endl;
#define debug3(x, y, z) cerr<<"("<<#x<<", "<<#y<<", "<<#z<<") = "<<"("<<x<<", "<<y<<", "<<z<<")"<<endl;
#define debugB(value, size) cerr<<#value<<": "<<bitset<size>(value) << endl;
#define line() cerr << "---------------" << endl;

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

template<typename T>
void printA(vector<T> &printArray, char between = ' ') {
   int paSize = printArray.size();
   for (int i = 0; i < paSize; i++) { cerr << printArray[i] << between;}
   if (between != '\n') {cerr << endl;}
}

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

int main() {
   int a, b;
   cin >> a >> b;
   int cnt = 0;
   vec<int> v;
   int n = 1;
   while (1) {
      v.push_back(n*(n+1)/2);
      if (n*(n+1)/2 >= 499500) break;
      n++;
   }

   int diff = b - a;
   debug(diff)
   for (int i = 1; i < v.size(); i++) {
      int t = v[i] - v[i-1];
      // debug3(t, v[i-1], v[i])
         if (t == diff) {
            cout << v[i-1] - a << endl;
         }
      // debug2(v[i-1], v[i])
      // if (v[i-1] >= a && v[i] )
   }

   return 0;
}

Measured memory_bytes: 256
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <iostream>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <fstream>
#include <numeric>
#include <iomanip>
#include <bitset>
#include <list>
#include <stdexcept>
#include <functional>
#include <utility>
#include <ctime>
#include <random>
#include <cassert>
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
#define MEM(a,b) memset((a),(b),sizeof(a))
const LL INF = 1e9 + 7;
const int N = 2e2 + 10;

int main()
{
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	pair<int, int> ans = { int(INF),int(INF) };
	int n, t, a;
	cin >> n >> t >> a;
	t *= 1000, a *= 1000;
	for (int i = 1; i <= n; i++)
	{
		int x;
		cin >> x;
		ans = min(ans, { abs(t - x * 6 - a),i });
	}
	cout << ans.second << endl;
	return 0;
}


Measured memory_bytes: 256
def get_input():
    N = int(raw_input())
    A = int(raw_input())
    B = int(raw_input())
    C = int(raw_input())
    D = int(raw_input())
    E = int(raw_input())
    return N, A, B, C, D, E

def solve2():
    N, A, B, C, D, E = get_input()
    X = min(A, B, C, D, E)
    NdivX = (N  + X - 1) / X
    ret = 5 + NdivX - 1
    print ret

if __name__ == '__main__':
    solve2()


Measured memory_bytes: 28140
#include <bits/stdc++.h>
using namespace std;
#define fo(i,a,b) for(int i=(a);i<(b);i++)
#define MOD 1000000007
#define MT make_tuple
#define PB push_back
typedef long long ll;

int N, M, x, y, n, num[100100];
bool c[100100];

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

        c[1] = 1;
        fo(i, 1, N+1) num[i] = 1;

        fo(i, 0, M) {
                cin >> x >> y;
                c[y] |= c[x];
                num[x]--, num[y]++;
                if (num[x] == 0) c[x] = 0;
        }
        fo(i, 1, N+1) n += c[i];
        printf("%d\n", n);
        return 0;
}



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

ll solve() {
    string S;
    cin >> S;
    int a = string("FESTIVAL").size();
    cout << S.substr(0,S.size()-a) << "\n";
    return 0;
}

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

Measured memory_bytes: 256
a,b,c=input().split()
a=int(a)
b=int(b)
c=int(c)
d=0
if a>=b:
  for i in range(101):
    if a%(b-i)==0 and b%(b-i)==0:
      d=d+1
      if d==c:
        print(b-i)
        break
if a<b:
  for i in range(101):
    if a%(a-i)==0 and b%(a-i)==0:
      d=d+1
      if d==c:
        print(a-i)
        break

Measured memory_bytes: 9108
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define see(x) cout<< #x <<" = "<< x <<' ';
#define seen(x) cout<< #x <<" = "<< x <<'\n';
#define UWU cout<<'\n';
int main(){
//ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int n;cin>>n;
    n%=10;
    if(n == 3){
        cout<<"bon";
    }else if(n == 0 || n == 1 || n == 6 || n == 8){
        cout<<"pon";
    }else cout<<"hon";
}


Measured memory_bytes: 3600
import java.io.*;
import java.util.*;

public class Main {
	
	static long[] sumLengthOfDigitNumber = new long[19];
	static long[] digit10 = new long[19];
				
	public static void main(String[] args) throws IOException {
		FastScanner sc = new FastScanner(System.in);
		
		int s = sc.nextInt();
		HashSet<Integer> set = new HashSet<Integer>();
		set.add(s);
		int pre = s;
		for(int i = 2 ;; i++){
			int a = 0;
			if(pre % 2 == 0) a = pre / 2;
			else a = 3 * pre + 1;
			if(set.contains(a)){
				System.out.println(i);
				return;
			}
			set.add(a);
			pre = a;
		}
		
	}//end main
	
}//end Main

class FastScanner {
    private InputStream in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;
    public FastScanner(InputStream in) {
		this.in = in;
	}
    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        }else{
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }
    private int readByte() {
    	if (hasNextByte()) return buffer[ptr++];
    	else return -1;
    }
    private static boolean isPrintableChar(int c){
    	return 33 <= c && c <= 126;
    }
    public boolean hasNext() {
    	while(hasNextByte() && !isPrintableChar(buffer[ptr]))
    		ptr++; return hasNextByte();
    }
    public String next() {
        if (!hasNext()) throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while(isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }
    public long nextLong() {
        if (!hasNext()) throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while(true){
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            }else if(b == -1 || !isPrintableChar(b)){
                return minus ? -n : n;
            }else{
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }
    public int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
        return (int) nl;
    }
    public double nextDouble() {
    	return Double.parseDouble(next());
    }
}


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

#include <algorithm>
#include <array>
#include <chrono>
#include <cstdio>
#include <iostream>
#include <numeric>
#include <vector>

using namespace std;

#define ll long long
#define ld long double
#define P pair<ll, ll>
#define FOR(i, n, m) for (ll i = n; i < (ll)m; i++)
#define FORr(i, m, n) for (ll i = n; i >= (ll)m; i--)
#define FORm(i, m) for (auto i = m.begin(); i != m.end(); i++)
#define sortAl(v) sort(v.begin(), v.end())
#define sortAlr(v)          \
  sort(v.begin(), v.end()); \
  reverse(v.begin(), v.end())
#define cout(n) cout << fixed << setprecision(n)

int main() {
  ll N;

  cin >> N;
  vector<ll> A(N + 1);

  FOR(i, 1, N + 1) {
    cin >> A[i];
    A[i] -= i;
  }

  vector<ll> tmp(N + 1);
  tmp = A;

  sort(tmp.begin() + 1, tmp.end());

  ll b;
  b = tmp[(N + 1) / 2];
  if (!N % 2) {
    b = tmp[(N + 2) / 2];
  }
  ll sum = 0;
  FOR(i, 1, N + 1) { sum += abs(A[i] - b); }
  cout << sum << endl;
  return 0;
}


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

int main(){
	int N, M, i, j, k, l;
	scanf("%d%d", &N, &M);
	vector<string> A(N), B(M);
	for(i = 0; i < N; i++){
		cin >> A[i];
	}
	for(i = 0; i < M; i++){
		cin >> B[i];
	}
	for(i = 0; i + M <= N; i++){
		for(j = 0; j + M <= N; j++){
			int f = 1;
			for(k = 0; k < M; k++){
				for(l = 0; l < M; l++){
					if(A[i + k][j + l] != B[k][l]){
						f = 0;
					}
				}
			}
			if(f == 1){
				printf("Yes\n");
				return 0;
			}
		}
	}
	printf("No\n");
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
    
int main (){
     int A,B;
    
    cin >> A>>B;
    if (A==B){
        cout<< "Draw";
    }
    else{
         if (A==1) cout << "Alice";
         if (B==1) cout << "Bob";
         if (A!=1&&B!=1) {
             if (A>B) cout<< "Alice";
             if (B>A) cout<< "Bob";
        }
    
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(void){
    string s[3]={"Sunny","Cloudy","Rainy"};
    string t;cin>>t;
    for(int i=0;i<3;i++){
        if(s[i]==t)cout<<s[(i+1)%3]<<endl;
    }
}


Measured memory_bytes: 256
import java.util.*;

import static java.lang.System.*;

class Main {
    public static Scanner sc = new Scanner(in);
    public static Random rand=new Random();

    public void run() {
    	int n=sc.nextInt();
    	while(n--!=0){
    		int c=1;
    		String str=sc.next();
    		Set<String> st=new HashSet<String>();
    		for(int i=1;i<=str.length();i++){
    			String s1=str.substring(0,i);
    			String s2=str.substring(i,str.length());
    			String r1 = (new StringBuffer(s1)).reverse().toString();
				String r2 = (new StringBuffer(s2)).reverse().toString();

				st.add(s1+s2);
				st.add(s2+s1);
				st.add(s1+r2);
				st.add(r2+s1);
				st.add(s2+r1);
				st.add(r1+s2);
				st.add(r1+r2);
				st.add(r2+r1);
    		}
    		ln(st.size());
    	}
    }
    public static void main(String[] args) {
        new Main().run();
    }

    public int[] nextIntArray(int n){
        int[] res=new int[n];
        for(int i=0;i<n;i++){
            res[i]=sc.nextInt();
        }
        return res;
    }
    public static void pr(Object o) {
        out.print(o);
    }
    public static void ln(Object o) {
        out.println(o);
    }
    public static void ln() {
        out.println();
    }
}

Measured memory_bytes: 55044
#include <bits/stdc++.h>
#define REP(i, n) for (int i=0, i##_limit=(n); i<i##_limit; ++i)
#define FOR(i, a, b) for (int i=(a), i##_limit=(b); i<i##_limit; ++i)
#define pb push_back
#define mp make_pair
using namespace std;
using ll = long long;
using pi = pair<int, int>;

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

    int ret = 1;
    FOR(i, 1, N)
    {
        if (S[i-1] != S[i]) ++ret;
    }

    cout << ret << endl;
    return 0;
}

Measured memory_bytes: 512
/*
Keep clam  Believe youself
*/
#include<cstdio>
#include<iostream>
#include<cstring>
#include<string>
#include<algorithm>
#include<queue>
#include<map>
#include<vector>
#include<stack>
#include<set>
#include<cmath>
#define Xiaobo main
using namespace std;
const int maxn=2e5+7;
const int mod=1e9+7;
const double eps=1e-15;
const double pi=acos(-1);
const int INF=0x3f3f3f3f;
typedef long long ll;
ll read(){ll c = getchar(),Nig = 1,x = 0;while(!isdigit(c) && c!='-')c = getchar();if(c == '-')Nig = -1,c = getchar();while(isdigit(c))x = ((x<<1) + (x<<3)) + (c^'0'),c = getchar();return Nig*x;}
ll gcd(ll a,ll b){ return b==0?a:gcd(b,a%b);}
//别急 dp找状态 问题看看本身的规律 贪心找方法
ll qmi(ll a,ll b) {
	ll res=1;
	while(b) {
		if(b&1) {
			res=res*a%mod;
		}
		a=a*a%mod;
		b>>=1;
 	}
 	return res%mod;
}
ll C(ll a,ll b) {
	ll res=1;
	for(ll i=1,j=a;i<=b;i++,j--) {
		res=res*j%mod;
		res=res%mod*qmi(i,mod-2)%mod;
	}
	return res;
}
int Xiaobo()
{
	ll n,a,b;
	ll res;
	cin>>n>>a>>b;
	res=qmi(2,n);
	//cout<<res<<'\n';
	//cout<<C(n,a)<<' '<<C(n,b)<<'\n';
	res-=(C(n,a)%mod+C(n,b)%mod)%mod;
	cout<<(res-1+mod)%mod<<'\n';
	return 0;	
}

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

int main() {
  int n, k, r, s, p;
  cin >> n >> k >> r >> s >> p;
  string t;
  cin >> t;
  ll ans = 0;
  map<char, int> v;
  v['r'] = p;
  v['s'] = r;
  v['p'] = s;
  vector<bool> win(n, true);
  rep(i, k) ans += v[t[i]];

  for (int i = k; i < n; i++) {
    if (t[i] != t[i - k] || !win[i - k])
      ans += v[t[i]];
    else
      win[i] = false;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 512
#include <vector>
#include <math.h>
#include <iostream>
#include <string>
#include <algorithm>
#include <queue>
#include <iomanip>
#include <deque>
#include <map>

typedef long long ll;
#define rep(i, a, n) for(int i = a; i<n; i++)
#define ALL(a) begin(a), end(a)
#define mii map<int, int>
#define msi map<string, int>
#define vi vector<int>
#define vl vector<ll>
#define MOD 1000000007
#define INF 1e9
#define showVector(v) rep(i,0,v.size()){p(v[i]);p(" ")} pl("")
using namespace std;

// 素数判定 O(√n)
bool is_prime(int n){
    for(int i = 2; i * i <= n; i++){
        if(n % i == 0) return false;
    }
    return true;
}

// 各桁の和を計算する関数
int findSumOfDigits(int n) {
  int sum = 0;
  while (n > 0) { // n が 0 になるまで
    sum += n % 10;
    n /= 10;
  }
  return sum;
}

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

//想定解答との絶対誤差または相対誤差が 10−6以下の場合+1以上だしておく。適当に15とかでもおｋ．
//cout << fixed << setprecision(15);

int main() {
    int N, M;
    cin >> N >> M;
    vector<vector<int> > s(M);
    rep(i, 0, M) {
        int k;
        cin >> k;
        rep(j, 0, k) {
            int a;
            cin >> a;
            --a;
            s[i].push_back(a);
        }
    }
    vector<int> p(M);
    rep(i, 0, M) {
        cin >> p[i];
    }
    ll res = 0;
    //1<<nは2^n
    //2^nは全パターン数と一致
    //<<ビット(2進数)を左へシフトする
    //bit->0-7
    //2進数は先頭に0bをつけて表す
    rep(bit, 0, 1<<N) {
        bool ok = true;
        rep(i, 0, M) {
            int on = 0;
            for (auto v: s[i]) {
                // ここを理解する
                if (bit & (1<<v)) {
                    ++on;
                }
            }
            // 条件、onになっているスイッチの個数を2で割った余りが一致するか。しないならば、flagをtrueにして、カウントしない
            if (on % 2 != p[i]) {
                ok = false;
            }
        }
        if (ok) ++res;
    }

    cout << res << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
	int n;
	cin>>n;
	for(int i=0;i<n;i++){
		int q,w,e;
		cin>>q>>w>>e;
		int zong=w+e;
		if((q-zong)%2==1||zong>q){
			cout<<"No"<<endl;
			return 0;
		}
	}
	cout<<"Yes"<<endl;
	return 0;
}

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

using namespace std;

using ll = long long;

#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)

#define input(...) __VA_ARGS__; in(__VA_ARGS__)

template<class T>
void print(vector<T> a) {
  cout << "[ ";
  REP(i, a.size()) cout << a[i] << " ";
  cout << "]" << endl;
}

void print() {
  std::cout << std::endl;
}

template <class Head, class... Tail>
void print(Head&& head, Tail&&... tail) {
  std::cout << head << " ";
  print(std::forward<Tail>(tail)...);
}

void in() { }

template <class Head, class... Tail>
void in(Head&& head, Tail&&... tail) {
  cin >> head;
  in(std::forward<Tail>(tail)...);
}

bool check(vector<char> &proc, char target, ll len) {
  REP(i, len) {
    if (proc[i] != target) return false;
  }
  return true;
}

ll f(string s, char target) {
  vector<char> proc(s.begin(), s.end());

  REP(i, s.size()) {
    ll len = s.size() - i;
    if (check(proc, target, len)) {
      return i;
    }
    REP(j, len - 1) {
      if (proc[j + 1] == target) {
        proc[j] = target;
      }
    }
  }
  return -1;
}

int main() {
  string input(s);
  set<char> parts(s.begin(), s.end());

  ll minv = 1ll << 60;
  for (auto v: parts) {
    minv = min(minv, f(s, v));
  }
  cout << minv << endl;
}


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

using namespace std;

const int maxi = 1e6+10;
const long long inf = 1e9+10;
int n;
long long t;
pair<long long, long long> a[maxi];
long long dp[41][maxi];

bool cmp(pair<long long, long long> x, pair<long long, long long> y)
{
    if (x.first == 0 && y.first == 0) return x.second < y.second;
    if (x.first == 0) return 0;
    if (y.first == 0) return 1;
    return  y.second*x.first + x.first > x.second * y.first + y.first;
}
int main()
{
    cin>>n>>t;

    for (int i =1;i<=n;i++)
        scanf("%lld%lld",&a[i].first, &a[i].second);

    sort(a + 1, a+n+1, cmp);

    for (int i = 0 ; i<=40;i++)
        for (int j = 0; j<=n;j++)
         dp[i][j] = inf;

    dp[0][0] = 0;

   int poz = n + 1;

    for (int i = 1;i<=n;i++)
    {
        if (!a[i].first)
        {
            poz = i;
            break;
        }

        for (int j = 0 ; j <= 40; j++)
            if (!j) dp[0][i] = 0; else
        {
            dp[j][i] = min(dp[j][i-1], (dp[j-1][i-1]+1)*(a[i].first + 1) + a[i].second);
            dp[j][i] = min(dp[j][i], inf);
        }
    }

    int ans = 0;


    for (int k = 0; k<=40;k++)
    {
         if (dp[k][poz-1]>t) continue;

         long long val = dp[k][poz-1];

         int cnt = k ;

         for (int i = poz; i<=n;i++)
          if (val + a[i].second + 1<=t)
         {
             val+=a[i].second + 1;
             cnt++;
         }

        ans = max(cnt, ans);
    }


    printf("%d\n",ans);
}
//1 3
//0 3




Measured memory_bytes: 151296
#include<iostream>                                        
using namespace std;                                      
                                                          
int main(){                                               
  int r,c;                                                
  cin >> r >> c;                                          
  int board[r+1][c+1] ={};                                
  for(int i=0;i<r;i++){                                   
    for(int j=0;j<c;j++){                                 
      cin >> board[i][j];                                 
    }                                                     
  }                                                       
                                                          
   for(int i=0;i<r;i++){                                  
    for(int j=0;j<c;j++){                                 
      board[i][c] += board[i][j];                         
    }                                                     
  }                                                       
                                                          
   for(int i=0;i<c;i++){                                  
     for(int j=0;j<r;j++){                                
       board[r][i] += board[j][i];                        
     }                                                    
   }                                                      
                                                          
   for(int i=0;i<r;i++){                                  
     board[r][c] += board[i][c];                          
   }                                                      
                                                          
                                                          
  for(int i=0;i<r+1;i++){                                 
    for(int j=0;j<c+1;j++){                               
      if(j>0)                                             
        cout << " ";                                      
      cout << board[i][j];                                
    }                                                     
    cout << endl;                                         
  }

  return 0;
}

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

int main(){
  int N;
  cin >> N;
  vector<int> v(N);

  for(int i = 0; i < N; i++){
    cin >> v.at(i);
  }

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

  cout << v.at(N-1) - v.at(0) << endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
	int n; cin >> n;
	int d[105];
	for(int i=0;i<n;i++){
		cin >> d[i];
	}
	sort(d,d+n);
	int count = 0;
	for(int i=0;i<n-1;i++){
		if(d[i]==d[i+1]){
			count++;
		}
	}
	cout << n-count << endl;
	return 0;
}

Measured memory_bytes: 256
from collections import deque

n,d,a = map(int, input().split())
ls = [list(map(int, input().split())) for i in range(n)]
ls.sort(key=lambda x:x[0])

q=deque()
ans=0
tot=0
for i in range(n):
    x=ls[i][0]
    h=ls[i][1]
    while q and q[0][0]<x:
        tot-=q[0][1]
        q.popleft()
    h-=tot
    if h>0:
        num = (h+a-1)//a
        ans+=num
        tot+=num*a
        q.append([x+2*d,num*a])

print(ans)

Measured memory_bytes: 97496
import sys
N, A, B, C = map(int, input().split())
d=dict()
d["A"] = A
d["B"] = B
d["C"] = C
h = {"AB":"C","BC":"A","AC":"B"}
S = []
for _ in range(N):
    S.append(input().strip())
if A+B+C == 0:
    print("No")
elif A+B+C == 1:
    R = []
    for k in range(N):
        s = S[k]
        for i in range(2):
            if d[s[i]] == 1:
                R.append(s[1-i])
                d[s[i]] = 0
                d[s[1-i]] = 1
                break
        else:
            print("No")
            break
    else:
        print("Yes")
        for i in range(N):
            print(R[i])
else:
    R = []
    if d[S[0][0]] == 0 and d[S[0][1]] == 0:
        print("No")
        sys.exit()
    for i in range(N-1):
        s = S[i]
        if d[s[0]] == 1 and d[s[1]] == 1 and d[h[s]] == 0:
            if S[i+1] == s:
                d[s[0]] += 1
                d[s[1]] -= 1
                R.append(s[0])
            else:
                for j in range(2):
                    if s[j] in S[i+1]:
                        d[s[j]] += 1
                        d[s[1-j]] -= 1
                        R.append(s[j])
                        break
        elif d[s[0]] >= d[s[1]]:
            d[s[0]] -= 1
            d[s[1]] += 1
            R.append(s[1])
        else:
            d[s[0]] += 1
            d[s[1]] -= 1
            R.append(s[0])
    for i in range(2):
        if d[S[N-1][i]] > 0:
            R.append(S[N-1][1-i])
            break
    print("Yes")
    for i in range(N):
        print(R[i])


Measured memory_bytes: 90672
#include<bits/stdc++.h>
using namespace std;
namespace FAST_IO
{
	template<typename T> void read(T &a)
	{
		a=0;
		int f=1;
		char c=getchar();
		while(!isdigit(c))
		{
			if(c=='-')
			{
				f=-1;
			}
			c=getchar();
		}
		while(isdigit(c))
		{
			a=a*10+c-'0';
			c=getchar();
		}
		a=a*f;
	}
	template <typename T> void write(T a)
	{
		if(a<0)
		{
			a=-a;
			putchar('-');
		}
		if(a>9)
		{
			write(a/10);
		}
		putchar(a%10+'0');
	}
	template <typename T> void writeln(T a)
	{
		write(a);
		puts("");
	}
}

int a,b;
int main()
{
	cin>>a>>b;
	for(int i=1;i<=12;i++)
	{
		if(a==i)
		{
			if(b<i)
			{
				cout<<i-1<<endl;
			}
			else 
			{
				cout<<i<<endl;
			}
		}
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
#define INF (1LL << 31 - 1)
#define MOD int(1e9+7)
#define repi(i,j,n) for(int i = (j); i < (n); ++i)
#define rep(i,n) repi(i,0,n)
#define fi first
#define se second
 
inline void init() {
    cin.tie(0);
    ios::sync_with_stdio(false);
}
 
map<int, bool> mp, used;
int n, ans;
vector<int> a;
 
int main() {
    init();
    cin >> n;
    a.resize(n);
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
        if (!mp[a[i]]) mp[a[i]] = true;
        else mp[a[i]] = false;
    }
 
    for (int i = 0; i < n; ++i) {
        if (!used[a[i]]) {
            if (mp[a[i]]) ans++;
            used[a[i]] = true;
        }
    }
 
    cout << ans << endl;
 
    return 0;
}

Measured memory_bytes: 9984
#include <iostream>
#include <string>
#include <vector>
#include <climits>
#include <algorithm>
#include <set>
#include <unordered_map>
#include <queue>
#include <iomanip>
#include <map>
#include <utility>

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

using namespace std;
int mod = 1000000007;

int N;

int main() {
  cin >> N;
  int NN = 2*N;
  int NNN = 3*N;
  vector<int> a(NNN);
  rep(i, NNN) {
    cin >> a.at(i);
  }

  vector<ll> sum1(N+1);
  priority_queue<int, vector<int>, greater<>> que1;
  rep(i, N) {
    que1.push(a.at(i));
    sum1.at(0) += a.at(i);
  }

  for(int i=N; i<NN; i++) {
    int mi = que1.top();
    int d = 0;
    if (a.at(i) > mi) {
      que1.pop();
      que1.push(a.at(i));
      d = a.at(i) - mi;
    }
    sum1.at(i-N+1) = sum1.at(i-N) + d;
  }

  vector<ll> sum2(N+1);
  priority_queue<int> que2;
  for(int i=NN; i<NNN; i++) {
    que2.push(a.at(i));
    sum2.at(N) += a.at(i);
  }

  for(int i=NN-1; i>=N; i--) {
    int ma = que2.top();
    int d = 0;
    if (a.at(i) < ma) {
      que2.pop();
      que2.push(a.at(i));
      d = ma - a.at(i);
    }
    sum2.at(i-N) = sum2.at(i-N+1) - d;
  }

  ll ans = LONG_MIN;
  for(int i=0; i<=N; i++) {
    ans = max(ans, sum1.at(i) - sum2.at(i));
  }
  cout << ans << endl;
}


Measured memory_bytes: 4088
#include "bits/stdc++.h"
 
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
#define int ll
#define fi first
#define se second
#define SORT(a) sort(a.begin(),a.end())
#define rep(i,n) for(int i = 0;i < (n) ; i++) 
#define REP(i,n) for(int i = 0;i < (n) ; i++) 
#define MP(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define INF LLONG_MAX/2
#define all(x) (x).begin(),(x).end()
#define debug(x) cerr<<#x<<": "<<x<<endl
#define debug_vec(v) cerr<<#v<<":";rep(i,v.size())cerr<<" "<<v[i];cerr<<endl
//----------------------------------------------------------------

// int MOD = 998244353;
int MOD = 1000000007;


//----------------------------------------------------------------
signed main(){

	ll n,k;
	cin >> n >> k;
	vll h(n+k+1);
	rep(i,n)cin >> h[i];

	vll c(n+k+1,INF);
	c[0] = 0;
	rep(i,n){
		rep(j,k){
			c[i+j+1] = min(c[i+j+1],c[i]+abs(h[i]-h[i+j+1]));
		}
	}
	cout << c[n-1] << endl;

	return 0;
}

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

// g++ -std=c++14 code1.cpp
// rm -r -f test;oj dl https://code-festival-2018-quala.contest.atcoder.jp/tasks/code_festival_2018_quala_c
// rm -r -f test;oj dl https://dp.contest.atcoder.jp/tasks/dp_a
// rm -r -f test;oj dl http://arc092.contest.atcoder.jp/tasks/arc092_b

Measured memory_bytes: 1792