akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
	string s;
	cin >> s;
	char prev = 'x';
	int cnt = 0, mx = 0;
	for(int i=0; i<s.size(); i++){
		if(s[i] == prev && s[i] == 'R'){
			cnt++;
		}
		else if(s[i] == 'R'){
			cnt = 1;
		}
		else{
			cnt = 0;
		}
		prev = s[i];
		mx = max(cnt,mx);
	}
	cout << mx << endl;
	return 0;
}

Measured memory_bytes: 3636
def solve():
    A, B, C, X, Y = map(int, input().split())

    x1 = min(X, Y)
    price = min((A+B) * x1, 2 * C * x1)
    x2 = max(X, Y) - x1
    a = A if X > Y else B
    price += min(a * x2, 2 * C * x2)
    print(price)
solve()

Measured memory_bytes: 3060
using System;

class Program
    {
        static void Main(string[] args)
        {
            string[] line = Console.ReadLine().Split();

            int N = int.Parse(line[0]);
            int A = int.Parse(line[1]);
            int B = int.Parse(line[2]);


            //int trainFee = N * A;
            //int taxiFee = B;

            if (N*A >= B)
            {
                Console.WriteLine(B);
            }
            else
            {
                Console.WriteLine(N*A);
            }
        }
    }

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

int main(){
	int Q,c,a,n,ans;
	cin >> Q;
	while(Q-- != 0){
		cin >> c >> a >> n;
		ans = 0;
		while(c>0 && a>0 && n>0){
			ans++;
			c--;
			a--;
			n--;
		}
		while(c>1 && a>0){
			ans++;
			c-=2;
			a--;
		}
		while(c>2){
			ans++;
			c-=3;
		}
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 1160
#include <iostream>

using namespace std;

int main()
{
    int a , b , c;
    cin >> a >> b >> c;
    if (a == b && c != a && c != b){
        cout << "Yes";
    }else if (b == c && a != b && a != c){
        cout << "Yes";
    }else if (a == c && b != a && b != c){
        cout << "Yes";
    }else{
        cout << "No";
    }
}


Measured memory_bytes: 3656
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author HossamDoma
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskA solver = new TaskA();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskA {
        public void solve(int testNumber, InputReader in, PrintWriter out) {

            int x = in.nextInt();
            int a = in.nextInt();
            int b = in.nextInt();

            if (Math.abs(x - a) < Math.abs(b - x))
                out.println('A');
            else
                out.println('B');
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
}



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

typedef pair<int,int> pii;
typedef vector<int> vec;
typedef unordered_map<int,int> hash;
#define long long long
#define pb push_back
#define all(a) (a).begin(), (a).end()
#define sz(x) (int)x.size()
#define F first
#define S second
#define pb push_back
#define mp make_pair
#define fill(a,v) memset(a,v,sizeof(a))
#define FOR(i, a, b) for(int i = a; i < b; i++)
#define INF 0x3f3f3f3f//infinity for integers
#define JJ ios_base::sync_with_stdio(0); cin.tie(0)//input fast
#define MOD 1000000007


int main()
{
	JJ;
	int n; cin>>n;
	int arr[n];
	FOR(i,0,n){
		cin>>arr[i];
	}
	int max_so_far=0;
	long res=0;
	FOR(i,0,n){
		if(arr[i]>max_so_far){
			max_so_far=arr[i];
		}
		else{
			res+=(max_so_far-arr[i]);
		}
	}
	cout<<res<<endl;


	return 0;
}


Measured memory_bytes: 4416
N = int(input())
M_List = list(map(int,input().split()))
N_List = list(map(int,input().split()))
ans = 0
for i in range(N):
    if N_List[i] >= M_List[i]:
        ans += M_List[i]
        ans += (M_List[i+1],N_List[i]-M_List[i])[N_List[i]-M_List[i]<=M_List[i+1]]
        M_List[i+1] = max(0,M_List[i+1]-(N_List[i]-M_List[i]))
    else:
        ans += N_List[i]
print(ans)

Measured memory_bytes: 24200
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
#define repr(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define invrepr(i,a,b) for(int i=b-1;i>=a;i--)
#define invrep(i,n) invrepr(i,0,n)
#define repitr(itr,a) for(auto itr=a.begin();itr!=a.end();++itr)
#define P pair<int,int>
const ll MOD=1e9+7;
const int INF=2e9;
const double PI=acos(-1);
const int MAX=200010;


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

    int n;
    cin >> n;
    vector<pair<int,pair<int,int>>> p(n);
    rep(i,n) cin >> p[i].second.first >> p[i].second.second >> p[i].first;
    sort(p.begin(),p.end(),greater<>());
    rep(i,101) {
        rep(j,101) {
            bool flag=1;
            int tmph=abs(p[0].second.first-i)+abs(p[0].second.second-j)+p[0].first;
            rep(k,n) {
                int h=tmph-abs(p[k].second.first-i)-abs(p[k].second.second-j);
                if (max(h,0)!=p[k].first) flag=0;
            }
            if (flag) {
                cout << i << ' ' << j << ' ' << tmph << endl;
                return 0;
            }
        }
    }

    return 0;
}


Measured memory_bytes: 3660
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
typedef pair<int, int> P;
int n, m;
int dp[80][200][20], kosu[1600];
P stone[1600][20];
int main()
{
	while(cin >> n >> m && n)
	{
		for(int i = 0; i < n; i++)
		{
			scanf("%d", kosu + i);
			for(int j = 0; j < kosu[i]; j++)
			{
				scanf("%d%d", &stone[i][j].F, &stone[i][j].S);
			}
		}
		for(int i = 0; i <= m; i++)
			for(int j = 0; j < n; j++)
				for(int k = 0; k < kosu[j]; k++)
					dp[i][j][k] = 1 << 30;
				for(int i = 0; i < kosu[0]; i++)
					dp[0][0][i] <<= 2;
				for(int i = 0; i < kosu[1]; i++)
					dp[1][1][i] <<= 2;
				for(int i = 0; i < n - 1; i++)
				{
					for(int j = 0; j < kosu[i]; j++)
					{
						for(int k = 0; k < kosu[i + 1]; k++)
						{
							for(int l = 0; l <= m; l++)
							{
								if(dp[l][i][j] < 1 << 30)
									dp[l][i + 1][k] = min((stone[i + 1][k].S + stone[i][j].S) * abs(stone[i + 1][k].F - stone[i][j].F) + dp[l][i][j], dp[l][i + 1][k]);
							}
						}
						if(i + 2 < n)
						{
							for(int k = 0; k < kosu[i + 2]; k++)
							{
								for(int l = 0; l < m; l++)
								{

									if(dp[l][i][j] < 1 << 30)
									{
										dp[l + 1][i + 2][k] = min((stone[i + 2][k].S + stone[i][j].S) * abs(stone[i + 2][k].F - stone[i][j].F) + dp[l][i][j], dp[l + 1][i + 2][k]);
									}
								}
							}
						}
					}
				}
				int ans = INT_MAX;
				for(int i = 0; i <= m; i++)
					for(int j = 0; j < kosu[n - 1]; j++)
						ans = min(ans, dp[i][n - 1][j]);
					for(int i = 0; i < m; i++)
						for(int j = 0; j < kosu[n - 2]; j++)
							ans = min(ans, dp[i][n - 2][j]);
						cout << ans << endl;
					}
				}

Measured memory_bytes: 4504
#include <iostream>
#include <vector>
#include <array>
#include <set>
#include <cmath>
#include <string>
#include <queue>
#include <list>
#include <stack>
#include <unordered_map>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cassert>
#include <cctype>  // std::islower(), std::isupper(), std::tolower, std::toupper
#include <iomanip> // std::std::setprecision(X)
#include <limits>  //std::numeric_limits<int>::max(), min()

typedef long long ll;

int main (void) {
  std::string S; std::cin >> S;
  
  int ans = 700 + 100 * std::count(S.begin(), S.end(), 'o');
  std::cout << ans << std::endl;
  return 0;
}


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

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

#define PB push_back
#define MP make_pair
#define IN insert
#define F first
#define S second

#define repa(i,fr,to,inc) for(int i = fr ; i <= to ; i += inc)
#define repb(i,fr,to,dec) for(int i = fr ; i >= to ; i -= dec)

clock_t present = clock();
void complexiti(){present = clock() - present;cerr << "TIME : " << float(present)/CLOCKS_PER_SEC << '\n';}
ll nax = 1000000LL * 1000000LL * 1000000LL;


void solver(){
	//~ type your code here
	string s,t;
	cin >> s >> t;
	int cnt = 0 ;
	repa(i,0,2,1){
		if(s[i] == t[i])cnt++;
	}
	cout << cnt << endl;
	return;
}

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int queries = 1;
	//~ cin >> queries;
	for(int i = 0 ; i < queries ; ++i){
		solver();
	}
	complexiti();
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <cstring>
#include <map>
#include <queue>
#include <cmath>
#include <complex> // complex<double> a(1.2 , 2.3);// real(): 1.2, imag()2.3
using namespace std;

#define MOD 1000000007
#define ll long long
#define ld long double
#define FOR(i,a,b) for(ll i=(ll)a;i<(ll)b;i++)
#define rep(i,n) FOR(i,0,n)
#define pb push_back
#define mp make_pair
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rmsame(a) sort(all(a)),a.erase(unique(all(a)), a.end())
#define rmvector(a,b) rep(i,a.size())rep(j,b.size())if(a[i]==b[j]){a.erase(a.begin()+i);i--;break;}
template<typename X> bool exist(vector<X> vec, X item){return find(all(vec), item)!=vec.end();}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  string s;
  cin >> s;
  ll ans=0;
  rep(i,s.size()) ans+=(s[i]-'0');

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


Measured memory_bytes: 256
#include <bits/stdc++.h>
using Int = long long;  // clang-format off
#define REP_(i, a_, b_, a, b, ...) for (Int i = (a), lim##i = (b); i < lim##i; i++)
#define REP(i, ...) REP_(i, __VA_ARGS__, __VA_ARGS__, 0, __VA_ARGS__)
#define ALL(v) std::begin(v), std::end(v)
struct SetupIO { SetupIO() { std::cin.tie(nullptr), std::ios::sync_with_stdio(false), std::cout << std::fixed << std::setprecision(13); } } setup_io;
#ifndef dump
#define dump(...)
#endif  // clang-format on

/**
 *    author:  knshnb
 *    created: Sat Jul 25 21:25:03 JST 2020
 **/

signed main() {
    Int x;
    std::cin >> x;
    std::cout << 10 - x / 200 << std::endl;
}


Measured memory_bytes: 3644
get_number(Number) :-
    get_string(String),
    number_string(Number, String).

get_number(A, B) :-
    get_number(A),
    get_number(B).

get_number(A, B, C) :-
    get_number(A, B),
    get_number(C).

get_string(String) :-
    current_input(Input),
    read_string(Input, ' \n\r\t', '', _, String).

get_chars(Xs) :-
    get_string(S),
    string_chars(S, Xs).

get_numbers(0, []).
get_numbers(N, [X|Xs]) :- 
    get_number(X), 
    N2 is N - 1, 
    get_numbers(N2, Xs).

put_numbers([]).
put_numbers([X|Xs]) :-
    writeln(X),
    put_numbers(Xs).

/* memo
    code(int)
    string_code(1, S, C), (C: code)
    char_code(X, Y) (X: char, Y: code)
    string_chars(S, S2) (S: string, S2: [char])
    to_lower(C, C2) (C: char? C2: code?)
    length(S, L),
    sub_string

    f(0, [], []).
    f(Z, [X|Xs], [Y|Ys]) :- X = Y, f(Z1, Xs, Ys), Z is Z1 + 1.
    f(Z, [_|Xs], [_|Ys]) :- f(Z, Xs, Ys).

    match: =, \=

    numeric: <,=<, >, >= (eval)
    lexicographically: @<. @=<, @>, @>=
    value?: =:=, =\= (eval)
    identical: ==, \==

    between(L,U,X): L <= X <= U
    nth0(I, Xs, Y), nth1(I, Xs, Y): (Xs,Y) -> I, (I, Xs) -> Y 

    sort(Key, Order, List, Sorted): Keyは通常0?, Orderは=なしが重複削除，=は重複保持
    \+ P(X) : not P(X)

    sum_list(Xs, Sum)

    orは!忘れに注意(末尾再帰なら直前)
*/

repX(0, _, []) :- !.
repX(N, X, [Y|Ys]) :- N2 is N - 1, Y is X, repX(N2, X, Ys).

f([]).
f([X|Xs]) :-
    write(X),
    f(Xs).

main :-
    get_number(A, B),
    repX(max(A,B), min(A,B), Xs),
    f(Xs),
    writeln("").

    % statistics(inferences, IC), writeln(IC).


Measured memory_bytes: 8124
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using pull = pair<ull, ll>;
#define INF 1000000
#define LLINF 10000000000000000ll
#define MOD 1000000007LL

bool dbgflag = false;

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

  ll x, y, a, b, c;
  cin >> x >> y >> a >> b >> c;
  vector<ll> red(a), green(b), blue(c);
  for (int i = 0; i < a; i++) cin >> red[i];
  for (int i = 0; i < b; i++) cin >> green[i];
  for (int i = 0; i < c; i++) cin >> blue[i];

  sort(red.begin(), red.end());
  reverse(red.begin(), red.end());
  sort(green.begin(), green.end());
  reverse(green.begin(), green.end());
  sort(blue.begin(), blue.end());
  reverse(blue.begin(), blue.end());

  ll get_red = x-1, get_green = y-1;
  ll get_blue = 0;
  ll get;
  bool redf = true, greenf = true;

  while (1) {
    //cout << get_red << " " << get_green << " " << get_blue << endl;
    if ((redf) && (greenf)) {
      get = min(red[get_red], green[get_green]);
      if (get > blue[get_blue]) break; 
      else if (get == red[get_red]) get_red--;
      else get_green--;
    }
    else if (redf) {
      get = red[get_red];
      if (get > blue[get_blue]) break;
      get_red--;
    }
    else if (greenf) {
      get = green[get_green];
      if (get > blue[get_blue]) break;
      get_green--;
    }
    else break;

    get_blue++;
    if (get_blue == c) break;
    if (get_red == -1) redf = false;
    if (get_green == -1) greenf = false;          
  }
  
  //cout << get_red << " " << get_green << " " << get_blue << endl;
  ll yum = 0;
  for (int i = 0; i <= get_red; i++) yum += red[i];
  for (int i = 0; i <= get_green; i++) yum += green[i];
  for (int i = 0; i < get_blue; i++) yum += blue[i];

  cout << yum << endl;

}


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

int main(){
    int goal;
    int64_t N,ans;
    cin >>N;
    goal = (int)(sqrt(N+1)-1);
    for (int i = 1; i <= goal; i++){
        if((N-i) % i == 0) ans += (N-i)/i;
    }
    cout << ans <<endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <stack>
using namespace std;
int main(){
	stack<char> st;
	string x;
	cin >> x;
	for(int i=0;i<x.size();i++){
		char a = x[i];
		if(a=='T'){
			if(!st.empty()){
				if(st.top()=='S'){
					st.pop();
				}else{
					st.push(a);
				}
			}else{
				st.push(a);
			}
		}else if(a=='S'){
			st.push(a);
		}
	}
	cout << st.size();
	return 0;
}

Measured memory_bytes: 644
import itertools
n=int(input())
A=[int(i) for i in input().split()]
B=[int(i) for i in input().split()]
def bitsum(BIT,i):
  s=0
  while i>0:
    s+=BIT[i]
    i-=i&(-i)
  return s

def bitadd(BIT,i,x):
  while i<=64:
    BIT[i]+=x
    i+=i&(-i)
  return BIT

def tentou(X):
  ret=0
  BIT=[0]*64
  BIT.insert(0,0)
  for i1 in range(n):
    x=X[i1]+1
    ret+=i1-bitsum(BIT,x)
    bitadd(BIT,x,1)
  return ret
N=[int(i) for i in range(n)]
nn=2**n
ans=float("inf")
for _ in range(n//2+1):
  for com in itertools.combinations(N,2*_):
    i=0
    for ura in com:
      i+=2**ura
    E,O=[],[]
    for j in range(n):
      if i&(1<<j)==0:
        if j%2==0:
          E.append(A[j]*100+j)
        else:
          O.append(A[j]*100+j)
      else:
        if j%2==0:
          O.append(B[j]*100+j)
        else:
          E.append(B[j]*100+j)
    if len(E)!=(n+1)//2:
      continue
    else:
      E.sort()
      O.sort()

      chk=True
      C=[E[0]%100]
      prev=E[0]//100
      for i in range(1,n):
        ii=i//2
        if i%2==0:
          C.append(E[ii]%100)
          if E[ii]//100<prev:
            chk=False
            break
          else:
            prev=E[ii]//100
        else:
          C.append(O[ii]%100)
          if O[ii]//100<prev:
            chk=False
            break
          else:
            prev=O[ii]//100
    
    if chk:
      ans=min(ans,tentou(C))
print(-1 if ans==float("inf") else ans)



Measured memory_bytes: 50140
#include<bits/stdc++.h>
using namespace std;
 
int binary(int);
int s[100000],n;

int main(){
  int t,q,count=0;
  cin>>n;
  for(int i=0;i<n;i++)cin>>s[i];
  cin>>q;
  for(int i=0;i<q;i++){
    cin>>t;
    if(binary(t)==1)count++;
  }
  cout<<count<<endl;
  return 0;
}
 
int binary(int key){
  int l=0,r=n,m;
  while(l<r){
    m=(l+r)/2;
    if(key==s[m])return 1;
    else if(key>s[m])l=m+1;
    else r=m;
  }
  return 0;
}



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


int main()
{
  int N,i,j,v,count=0,minj;
  int *A;

  scanf("%d",&N);
  if(N<1 || N>100) exit(2);
  A=(int *)malloc(sizeof(int)*N);

  for(i=0;i<N;i++)
    {
      scanf("%d",&A[i]);
      if(A[i]<0 || A[i]>100) exit(1);
    }

  for(i=0;i<N;i++)
    {
      minj=i;
      for(j=i;j<N;j++)
	{
	  if(A[j]<A[minj])
	    {
	      minj=j;  
	    }
	}

      
      v=A[i];
      A[i]=A[minj];
      A[minj]=v;
      if(A[i]!=A[minj]) count++;
      
    }

  for(i=0;i<N-1;i++)
	{
	  printf("%d ",A[i]);
	  
	}
  printf("%d",A[N-1]);
  printf("\n");

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



  return 0;
}



Measured memory_bytes: 2100
#include <iostream>
using namespace std;
  
int main(){
  int n,m,t,p;
  
  while(1){
    cin >> n >> m >> t >> p ;
  
    if(n==0 && m==0 && t==0 && p==0){
      break;
    }
  
    int Ori[64][64] = {{0}};
    for(int y=0;y<m;y++){
      for(int x=0;x<n;x++){
        Ori[y][x] = 1;
      }
    }
  
    for(int i=0;i<t;i++){
      int d,c;
      cin >> d >> c;
  
      if(d==1){
        for(int x=0;x<c;x++){
          for(int y=0;y<m;y++){
            Ori[y][2*c-1-x] += Ori[y][x];
            Ori[y][x] = 0;
          }
        }
  
        for(int x=0;x<n;x++){
          for(int y=0;y<m;y++){
            Ori[y][x] = Ori[y][x+c];
            Ori[y][x+c] = 0;
          }
        }
      }
      else{
        for(int y=0;y<c;y++){
          for(int x=0;x<n;x++){
            Ori[2*c-1-y][x] += Ori[y][x];
            Ori[y][x] = 0;
          }
        }
  
        for(int y=0;y<m;y++){
          for(int x=0;x<n;x++){
            Ori[y][x] = Ori[y+c][x];
            Ori[y+c][x] = 0;
          }
        }
      }
    }
  
    for(int i=0;i<p;i++){
      int x,y;
      cin >> x >> y;
  
      cout << Ori[y][x] << endl;
    }
  }
  
  return 0;
}


Measured memory_bytes: 3144
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		StringBuilder sb = new StringBuilder();
		char[] s = sc.next().toCharArray();
		int[] a = new int[26];
		for (int i = 0; i < s.length; i++) {
			a[s[i] - 'a']++;
		}
		boolean b = false;
		int i = 0;
		for (; i < 26; i++) {
			if (a[i] == 0) {
				b = true;
				break;
			}
		}
		if (b) {
			System.out.println((char) ('a' + i));
		} else {
			System.out.println("None");
		}
	}
}


Measured memory_bytes: 26324
#include <bits/stdc++.h>
using namespace std;
int main() {
	int N;
	cin>>N;
	int p[N+2];
	for(int i=1;i<=N;i++) {
		cin>>p[i];
	}
	int cnt = 0, minVal,maxVal;
	for(int i=2;i<N;i++) {
		minVal = min(min(p[i-1], p[i]), p[i+1]);
		maxVal = max(max(p[i-1], p[i]), p[i+1]);
		if(p[i] > minVal and p[i]< maxVal) cnt++;
	}
	printf("%d\n",cnt);
	return 0;
}


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

int main(){
	long long a,b,c,k;
  	cin >> a >> b >> c >> k;
  	
  	if(k == a+b+c){
      cout << (a - c);
    }else if(k > a+b && k < a+b+c){
      cout << a-(k - (a+b));
    }else if(k > a && k <= a+b){
      cout << a;
    }else{
      cout << k;
    }
  return 0;
}

Measured memory_bytes: 3576
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
MOD = 10**9+7

n, m = map(int, readline().split())
a = set(map(int, read().split()))

dp = [0] * (n + 1)
dp[0] = 1
if 1 not in a:
    dp[1] = 1
cnt = 0
for i in range(2, n + 1):
    if i not in a:
        dp[i] = (dp[i - 1] + dp[i - 2]) % MOD
        cnt = 0
    else:
        cnt += 1
        if cnt == 2:
            print('0')
            exit()
print(dp[n])

Measured memory_bytes: 17272
import java.io.*;
import java.math.*;
import java.util.*;
 
public class Main {
	static final long MOD = 1000000007L;
	public static void main(String[] args) {
		FastScanner sc = new FastScanner();
		PrintWriter pw = new PrintWriter(System.out);
		
		int N = sc.ni();
		int K = sc.ni();
		int[] next = new int[N];
		for (int i = 0; i < N; i++)
			next[i] = sc.ni()-1;
		long[] cost = new long[N];
		for (int i = 0; i < N; i++)
			cost[i] = sc.nl();
		
		long[][] price = new long[N][N+1];
		long[][] cycle = new long[N][2];
		for (int i = 0; i < N; i++) {
			int cur = i;
			long p = 0;
			int c = 0;
			while (true) {
				cur = next[cur];
				p += cost[cur];
				c++;
				price[i][c] = p;
				
				if (cur==i) {
					cycle[i] = new long[] {p,c};
					break;
				}
			}
		}
		//pw.println(Arrays.deepToString(cycle));
		long ans = Long.MIN_VALUE;
		for (int i = 0; i < N; i++) {
			for (int j = 1; j <= Math.min(K,cycle[i][1]); j++) {
				long val = price[i][j];
				if (cycle[i][0]>0)
					val += cycle[i][0]*((K-j)/cycle[i][1]);
				ans = Math.max(ans,val);
			}
		}
		pw.println(ans);
		pw.close();
	}
	
    static class FastScanner { 
        BufferedReader br; 
        StringTokenizer st; 
  
        public FastScanner() { 
            br = new BufferedReader(new InputStreamReader(System.in)); 
        } 
  
        String next() { 
            while (st == null || !st.hasMoreElements()) { 
                try { 
                    st = new StringTokenizer(br.readLine());
                } catch (IOException  e) { 
                    e.printStackTrace(); 
                } 
            } 
            return st.nextToken(); 
        }
        
        int ni() { 
            return Integer.parseInt(next()); 
        }
  
        long nl() { 
            return Long.parseLong(next()); 
        } 
  
        double nd() { 
            return Double.parseDouble(next()); 
        } 
  
        String nextLine() {
            String str = ""; 
            try { 
                str = br.readLine(); 
            } catch (IOException e) {
                e.printStackTrace(); 
            } 
            return str;
        }
    }
}

Measured memory_bytes: 277832
#include<iostream>

using namespace std;

int main(){
    int n;
    cin >> n;
    int a[n];
    for(int i=0;i<n;i++){
        int x;
        cin >> x;
        a[--x] = i+1;
    }

    for(int i=0;i<n;i++){
        cout << a[i] << " ";
    }
    cout << endl;
}

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

ll d(ll x) {
    ll res=0;
    while(x) {  
        x/=10;
        res++;
    }
    return res;
}

int main() {
    ll n;
    int ans=100,res;
    cin>>n;
    for (int i=1; i<=sqrt(n); i++) {
        if (n%i==0) {
            ll j=n/i;
            res=max(d(i),d(j));
        }
        ans=min(ans,res);
    }
    cout<<ans<<endl;
}   


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
#define rrep(i,n) for(int i=1;i<=(n);++i)
#define Rep(i,s,n) for(int i=(s);i<=(n);++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
const double Pi = acos(-1);
const ll mod=1e9+7;

int main(){
    int N;
    cin >>N;
    Rep(n,1,N){
        int sn=n^(1/2)+1;
        int ans=0;
    Rep(x,1,sn){
        int xx=x*x;
        Rep(y,x,sn){
            if(xx+y*y>n) break;
            Rep(z,y,sn){
                int f = x*x + y*y + z*z + x*y + y*z + z*x;
                if(f>n) break;
                if(f==n){
                    int e=0;
                    if(x==y) e++;
                    if(y==z) e++;
                    if(z==x) e++;
                    if(e==0) ans +=6;
                    else if(e==1) ans+=3;
                    else if(e==3) ans+=1;
                }
                
            }
        }
    }
    cout << ans <<endl;
    }
    return 0;
}

Measured memory_bytes: 3560
import java.util.Scanner;

public class Main{

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int h = scan.nextInt();
		int n = scan.nextInt();
		int sum=0;
		for(int i=0;i<n;i++) {
			sum+=scan.nextInt();
		}
		scan.close();

		System.out.println((h<=sum)? "Yes":"No");

	}
}

Measured memory_bytes: 47076
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define INF 1000000001

struct node{
    int a;
    vector<int> to;
    int ans;
    bool visited;
    node(){
        visited=false;
    }
};
void dfs(int v, int p, vector<node> &nodes, vector<int> &dp){
    nodes[v].visited=true;
    for (int i = 0; i < nodes[v].to.size(); i++){
        int v_to=nodes[v].to[i];
        if(v_to==p)continue;
        if(nodes[v_to].visited)continue;
        dfs(v_to, v, nodes, dp);
        dp[v]+=dp[v_to];
    }
    dp[v]++;
}
int main() {
    int N,M;
    cin>>N>>M;
    vector<node> nodes(N);
    vector<int> dp(N,0);
    for (int i = 0; i < M; i++){
        int u,v;
        cin>>u>>v;
        nodes[u-1].to.push_back(v-1);
        nodes[v-1].to.push_back(u-1);
    }
    int ans=0;
    for (int i = 0; i < N; i++){
        if(nodes[i].visited)continue;
        dfs(i,-1,nodes,dp);
        ans=max(ans,dp[i]);
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 55444
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);

    int price = sc.nextInt();
    int total = sc.nextInt();
    int maxCount = sc.nextInt();

    if (price * maxCount <= total) {
      System.out.println(maxCount);
    } else {

      int count = 0;
      for (int i = 1; i <  maxCount; i++ ) {
        if (price * i <= total) {
          count++;
        }
      }
      System.out.println(count);
    }
  }
}


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

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

    int x = n; 
    while (true) {
        if (x % 2 == 0 and x % n == 0)  {
            cout << x; 
            break; 
        }
         x = x + n; 
    }
    
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
//#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
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; }
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void _main()
{
    int N;
    cin >> N;
    vector<int> a(N);
    rep(i, 0, N) cin >> a[i];
    
    vector<bool> b(N, false);
    rrep(i, N - 1, 0)
    {
        if (a[i] > 0)
        {
            b[i] = true;

            for (int j = 1; j * j <= i + 1; ++j)
            {
                if ((i + 1) % j == 0)
                {
                    a[j - 1] = 1 - a[j - 1];
                    if (j != (i + 1) / j)
                    {
                        a[(i + 1) / j - 1] = 1 - a[(i + 1) / j - 1];
                    }
                }
            }
        }
    }

    int M = 0;
    rep(i, 0, N)
    {
        if (b[i])
        {
            ++M;
        }
    }

    cout << M << endl;

    if (M > 0)
    {
        rep(i, 0, N)
        {
            if (b[i])
            {
                cout << i + 1 << " ";
            }
        }
        cout << endl;
    }
}


Measured memory_bytes: 1792
N = int(input())
AA = input()
BB = input()
CC = input()

A = [int(i) for i in AA.split()]
B = [int(i) for i in BB.split()]
C = [int(i) for i in CC.split()]

score = 0
prev = "None"
for i in range(N):
#    print(i)
    a = A[i]
#    print(a)
    score += B[a-1]
#    print(B[a-1])

    if prev != "None" and prev == a - 1:
        score += C[prev - 1]
    prev = a
    
print(score)        

Measured memory_bytes: 3064
#include <iostream>

using namespace std;

long long int N;

long long int ans = 0;

long long int dp[12][10][2];

int a[12];


int main(void) {

	cin >> N;
	long long int tmp = N;

	for (int i = 1; i <= 11; i++) {
		a[i] = tmp % 10;
		tmp /= 10;
	}

	/*for (int i = 1; i <= 11; i++) {
		cout << "a[" << i << "]= " << a[i] << endl;
	}*/
	
	int M = -1;
	for (M = 11;; M--) {
		if (a[M] != 0) { break; }
	}

	//cout << "M= " << M << endl;

	
		if (a[M] == 7) { dp[M][1<<2][0] = 1; }
		else if (a[M] == 5) { dp[M][1<<1][0] = 1; }
		else if (a[M] == 3) { dp[M][1<<0][0] = 1; }
		
		if (a[M] > 7) { dp[M][1<<2][1]++; }
		if (a[M] > 5) { dp[M][1<<1][1]++; }
		if (a[M] > 3) { dp[M][1<<0][1]++; }


		dp[M][0][1] = 1;
		for (int k = M - 1; k >= 1; k--) {
			dp[k][0][1] = 1;
		}


	for (int k = M-1; k >= 1; k--) {

		//===========
		

		//===========
		for (int h = 0; h <= 7; h++) {
			dp[k][h | (1<<2)][1] += dp[k + 1][h][1]; //7
			dp[k][h |(1 << 1)][1] += dp[k + 1][h][1]; //5
			dp[k][h |( 1 << 0)][1] += dp[k + 1][h][1]; //3
		}
		//===========

		for (int h = 1; h <= 7; h++) {
			// 7
			if (a[k] > 7) { dp[k][h | (1 << 2)][1] += dp[k+1][h][0]; }
			if (a[k] == 7) { dp[k][h |( 1 << 2)][0] += dp[k + 1][h][0]; }
			// 5
			if (a[k] > 5) { dp[k][h | (1 << 1)][1] += dp[k + 1][h][0]; }
			if (a[k] == 5) { dp[k][h |( 1 << 1)][0] += dp[k + 1][h][0]; }
			//3
			if (a[k] > 3) { dp[k][h |( 1 << 0)][1] += dp[k + 1][h][0]; }
			if (a[k] == 3) { dp[k][h |( 1 << 0)][0] += dp[k + 1][h][0]; }
		}
		
	}

	/*for (int k = M; k >= 1; k--) {
		for (int h = 0; h <= 7; h++) {
			cout << "dp[" << k << "]["<<h<<"][0]= " << dp[k][h][0] << endl;
			cout << "dp[" << k << "]["<<h<<"][1]= " << dp[k][h][1] << endl;
		}
	}*/
	

	ans = dp[1][7][1] + dp[1][7][0];

	cout << ans << endl;

	//system("pause");
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <set>

typedef long long ll;
ll N, X, M;

int main() {
  std::cin >> N >> X >> M;
  std::vector<ll> xp = {X};
  std::set<ll> up = {X};
  ll x = X, r;
  while (true) {
    x = (x * x) % M;
    if (up.find(x) != up.end()) {
      r = x;
      break;
    }
    xp.push_back(x);
    up.insert(x);
  }

  int n, m;
  for (int i = 0; i < xp.size(); ++i)
    if (xp[i] == r) {
      n = i;
      m = xp.size() - n;
      break;
    }

  ll tail_sum = 0, cycle_sum = 0;
  for (int i = 0; i < n; ++i)
    tail_sum += xp[i];
  for (int i = n; i < xp.size(); ++i)
    cycle_sum += xp[i];

  ll ans;
  if (N <= n) {
    ans = 0;
    for (int i = 0; i < N; ++i)
      ans += xp[i];
  } else {
    ans = tail_sum;
    N -= n;
    ans += cycle_sum * (N / m);
    for (int i = 0; i < (N % m); ++i)
      ans += xp[i+n];
  }
  std::cout << ans << "\n";

  return 0;
}


Measured memory_bytes: 5936
#include "bits/stdc++.h"
using namespace std;
#ifdef _DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

//#define int long long
#define rep(i, a, b) for (int i = (a); i < (b); i++)
#define rrep(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define all(c) begin(c), end(c)
const int INF =
    sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = 1e9 + 7;
template <class T>
bool chmax(T &a, const T &b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template <class T>
bool chmin(T &a, const T &b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}

signed main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a, p;
    cin >> a >> p;
    cout << (a * 3 + p) / 2 << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        String s = String.valueOf(n);
        switch(s.substring(s.length() - 1)){
            case "2":
            case "4":
            case "5":
            case "7":
            case "9":
                System.out.println("hon");
                break;
            case "0":
            case "1":
            case "6":
            case "8":
                System.out.println("pon");
                break;
            case "3":
                System.out.println("bon");
                break;
        }
    }
}

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

int main(){
  int N;
  cin >> N;
  N--;
  vector<int> B(N);
  rep(i, N){
    cin >> B[i];
  }
  
  int ans = 0;
  ans = B[0] + B[N-1];
  rep(i, N-1){
    ans += min(B[i+1], B[i]);
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include <cstdio>

int main(){
	int n;
	int a[101];
	scanf("%d",&n);
	for(int i=0;i<n;i++){scanf("%d",&a[i]);}
	while(n>1){printf("%d ",a[n-1]);n--;}
	printf("%d\n",a[0]);
}

Measured memory_bytes: 1024
#include <iostream>
#include <numeric>
#include <iomanip>
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)




int main() {
	double T,X;
	cin >>T>>X;
	
	cout << T+(X/2)<< endl;
}

Measured memory_bytes: 256
import java.util.Arrays;
import java.util.HashSet;
import java.util.Scanner;

class Main {
	public static void main(String[] args) throws Exception {
		new Main().run();
	}
	
	final long mod=(long)1e9+7;
	
	int N=(int)3e6;
	long[] fac=new long[N];
	long[] inv=new long[N];
	long[] ifac=new long[N];
	{
		fac[0]=fac[1]=ifac[0]=ifac[1]=inv[0]=inv[1]=1;
		for(int i=2;i<fac.length;++i)fac[i]=i*fac[i-1]%mod;
		for(int i=2;i<inv.length;++i)inv[i]=mod-inv[(int)(mod%i)]*(mod/i)%mod;
		for(int i=2;i<ifac.length;++i)ifac[i]=inv[i]*ifac[i-1]%mod;
	}
	
	long binom(int n,int k) {
		if(n<0||n<k)return 0;
		return fac[n]*ifac[k]%mod*ifac[n-k]%mod;
	}
	
	long brute(int r,int c) {
		long ret=0;
		for(int i=0;i<=r;++i) {
			for(int j=0;j<=c;++j) {
				ret+=binom(i+j,j);
				ret%=mod;
			}
		}
		return ret;
	}
	
	long f(int r,int c) {
		if(r<0||c<0)return 0;
		long ret=((r+2)*binom(r+c+2,c)%mod-(c+1))*inv(c+1)%mod;
		ret=(ret%mod+mod)%mod;
		return ret;
	}
	
	void run() {
		Scanner sc = new Scanner(System.in);
		int r1=sc.nextInt();
		int c1=sc.nextInt();
		int r2=sc.nextInt();
		int c2=sc.nextInt();
		long ans=f(r2,c2)+f(r1-1,c1-1)-f(r1-1,c2)-f(r2,c1-1);
		ans=(ans%mod+mod)%mod;
		System.out.println(ans);
	}
	
	long inv(long a) {
		return pow(a,mod-2);
	}
	
	long pow(long a,long n) {
		long r=1;
		for(;n>0;n>>=1,a=a*a%mod)if(n%2==1)r=r*a%mod;
		return r;
	}

	static void tr(Object... objects) {
		System.out.println(Arrays.deepToString(objects));
	}

}


Measured memory_bytes: 95828
#include <stdio.h>

int main(void)
{
	int num;
	double w, t, bmi;
	
	
	while (scanf("%d,%lf,%lf", &num, &w, &t) != EOF){
		
		bmi = w / (t * t);
		
		if (bmi >= 25){
			printf("%d\n", num);
		}
	}
	return (0);
}

Measured memory_bytes: 628
#include <stdio.h>
#include <algorithm>
 
using namespace std;
 
int main(){
    int H,W;
    while(true){
        scanf("%d %d",&H,&W);
        if(H == 0 && W == 0) break;
        for(int i = 0; i < H; i++){
            for(int j = 0; j < W; j++){
                if((i+j)%2 == 0) printf("#");
                else{
                    printf(".");
                }
            }
            printf("\n");
        }
        printf("\n");
    }
}


Measured memory_bytes: 2572
#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
using namespace std;
#define rep(i,x) for(ll i = 0; i < (ll)(x); i++)
#define rrep(i,x) for(ll i = (ll)(x)-1;0 <= i; i--)
#define reps(i,x) for(ll i = 1; i < (ll)(x)+1; i++)
#define rreps(i,x) for(ll i = (ll)(x); 1 <= i; i--)
#define debug(x) cerr << #x << ": " << (x) << "\n";
#define all(x) (x).begin(), (x).end()
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll,ll> Pll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<vector<vector<ll>>> vvvl;
const ll INF = numeric_limits<ll>::max()/4;
const int n_max = 1e5+10;
#define int ll

signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    
    ll n,k; cin >> n >> k;
    vector<ll> cnt(n);
    rep(i,k){
        ll d; cin >> d;
        rep(j,d){
            ll a; cin >> a;
            a--;
            cnt[a]++;
        }
    }
    ll ans = 0;
    rep(i,n)if(cnt[i] == 0)ans++;
    cout << ans << endl;
}

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

int main() {
	int N,K;
  	cin>> N >> K;
  	vector<int> p(N);
  
  	long double ex=0.0;
    long double max=0.0;
  
  	for(int i=0;i<N;i++){
     	 cin>>p.at(i);
    }
   for(int i=0;i<K;i++){
     ex+=(p.at(i)+1);
   }
  	max=ex;
    for(int i=0;i<N-K;i++){
     	ex-=(p.at(i)+1);
      	ex+=(p.at(i+K)+1);
      	if(ex>max){
         	max=ex; 
        }
    }
  
  	cout<<fixed << setprecision(20)<<max/2.0<<endl;
  	
}

Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <set>
#include <deque>
#include <map>
#include <iomanip>
#include <queue>
#include <stack>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <utility>
using namespace std;
int ky[8] = {-1,1,-2,2,-2,2,-1,1}; 
int kx[8] = {-2,-2,-1,-1,1,1,2,2};
int dy[4] = {-1,0,1,0};
int dx[4] = {0,1,0,-1};
int ddy[8] = {-1,0,1,-1,1,-1,0,1};
int ddx[8] = {-1,-1,-1,0,0,1,1,1};
typedef long long ll;
#define pi pair
#define MP make_pair
#define PB push_back
#define F first
#define S second
#define rep1(i,a,b) for(int i = a; i < b; i++)
#define rep2(i,a,b) for(int i = a; i <= b; i++) 
#define LB lower_bound
#define UP upper_bound
#define INF 999999999999
const double PI = acos(-1.0);
ll n,ans;

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    cin >> n;
    for(ll i = 2; i*i <= n; i++){
        ll cnt = 0;
        while(n%i == 0){
            cnt++;
            n /= i;
        }

        for(ll j = 1;;j++){
            if(cnt >= j){
                cnt -= j;
                ans++;
            }
            else break;
        }
    }
    if(n > 1) ans++;

    cout << ans;
    return 0;     
}


Measured memory_bytes: 3652
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <string>
using namespace std;

typedef struct{
	string word;	
	int page[100];
	int now;
}list;

int main(){
	list a[100];
	int b=0;
	
	string s;
	int n;
	
	while( cin >> s >> n ){
		
		bool find=false;
		for(int i=0; i<b; ++i){
			if(a[i].word==s){
				a[i].page[ a[i].now ]=n;
				a[i].now++;
				find=true;		
			}
		}	
		
		if( !find ){
			a[b].word=s;
			a[b].page[0]=n;
			a[b].now=1;
			b++;
		}	
		
	}
	
	for(int i=0; i<b; ++i) sort(a[i].page, a[i].page+a[i].now);	
		
	for(int i=0; i<b; ++i){
		for(int j=i; j<b; ++j){
			if(a[i].word > a[j].word) swap(a[i], a[j]);
		}	
	}	
	
	for(int i=0; i<b; ++i){
		cout << a[i].word << endl;	
		for(int j=0; j<a[i].now; ++j){
			if(j>0) printf(" ");
			printf("%d", a[i].page[j]);	
		}
		printf("\n");
	}
	
}

Measured memory_bytes: 1296
//#include<bits/stdc++.h>
#include<iostream>
#include<set>
 
#define YES() printf("YES\n")
#define NO() printf("NO\n")
#define Yes() printf("Yes\n")
#define No() printf("No\n")
#define fast() ios::base::sync_with_stdio(false); cin.tie(NULL);
typedef long long int ll;
//using ll = long long;
 
template<typename T>
inline T Abs(T a){return a < 0 ? -a : a; }
template<typename T>
inline T Max(T a, T b){return a < b ? b : a; }
template<typename T>
inline T Min(T a, T b){return a > b ? b : a; }
 
using namespace std;
 
int main(){
    //fast()
    
    set<int> num;
    for(int i = 0; i < 3; i++){
        int temp; cin >> temp;
        num.insert(temp);
    }

    if(num.size() == 2) Yes();
    else No();
    return 0;
}

Measured memory_bytes: 256
#include <math.h>
#include <stdio.h>
#include <algorithm>
#include <fstream>
#include <functional>
#include <iostream>
#include <map>
#include <string>
#include <utility>
#include <vector>
using namespace std;

int main() {
  long long x;
  cin >> x;
  long long count = 0;
  count = x / 11;
  count *= 2;
  x %= 11;
  if (x > 6)
    count += 2;
  else if (x != 0)
    count++;
  cout << count << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
	int a,b;
	char op;
	while(1){
		cin >> a >> op >> b;
		if(op=='?')break;
		if(op=='+'){
			cout << a+b << endl;
		}else if(op=='-'){
			cout << a-b << endl;
		}else if(op=='*'){
			cout << a*b << endl;
		}else if(op=='/'){
			cout << a/b << endl;
		}
	}
}
	


Measured memory_bytes: 3104
#include <stack>
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <cmath>
#include <array>
#include <iomanip>
#include <string>
#include <limits>
using namespace std;
int gcd(int a, int b)//最大公約数
{
   if (a%b == 0)
   {
       return(b);
   }
   else
   {
       return(gcd(b, a%b));
   }
}
int mod = 1000000000 + 7;
vector<int> v;
class Calc
{
    // 宣言
    long long a;

    public:
        // 素因数分解
        void decompositPrime(long long a);
};

/*
 * 素因数分解
 */
void Calc::decompositPrime(long long n)
{
    // 割る数の初期値
    a = 2;
    // √n ≧ a ( n ≧ a * a ) の間ループ処理
    while (n >= a * a) {
        // a で割り切れたら、a は素因数
        // そして、割られる数を a で割る
        // a で割り切れなかったら、 a を 1 増加させる
        if (n % a == 0) {
            //printf("%d * ", a);
             v.push_back(a);
            n /= a;
        } else {
            a++;
        }
    }
    // 最後に残った n は素因数
    v.push_back(n);
    //printf("%d\n", n);
}
vector<int> divisor(int n) {//約数発見
    vector<int> ret;
    for (int i = 1; i * i <= n; i++) {
        if (n % i == 0) {
            ret.push_back(i);
            if (i * i != n) ret.push_back(n / i);
        }
    }
    std::sort(ret.begin(), ret.end());
    return ret;
}
long nc2(long n){
    return n*(n-1)/2;
}
template<typename TypeInt>
std::string Itoa(const TypeInt v, int base)
{
	static const char table[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
	string ret;
	static numeric_limits<TypeInt> t;
	TypeInt n = v;
	if (t.is_signed) {
		if (v < 0) n *= -1;
	}

	while (n >= base) {
		ret += table[n%base];
		n /= base;
	}
	ret += table[n];
	if (t.is_signed) {
		if (v < 0 && base == 10) ret += '-';
	}
	// 文字列の順番を逆にする
	std::reverse(ret.begin(), ret.end());

	return ret;
}

int main(){
    //std::stack<int> stack;
    int n;
    cin >> n;
    vector<long> a(n);
    for(int i = 0; i < n; i++){
        cin >> a[i];
    }
    sort(a.begin(), a.end());
    int cnt = 1;
    long ans = a[n-1];
    int idx = n-2;
    while(cnt < n-1){
        ans += a[idx];
        if(cnt%2 == 0){
            idx --;
        }
        cnt ++;
    }
    cout << ans << endl;
    return 0;
}






Measured memory_bytes: 4792
#include <algorithm>
#include <iostream>
#include <vector>
#include <math.h>
#include <set>
#include <map>
#include <string>
#include <stack>
#include <queue>
#include <iomanip>
#include <numeric>
#include <tuple>
#include <bitset>
#include <complex>
#include <unistd.h>
#include <cassert>
#include <cctype>
#include <random>
#include <time.h>
#define _USE_MATH_DEFINES
#define _GLIBCXX_DEBUG
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> plglg;
typedef pair<double, ll> pdlg;
typedef tuple<int, int, int> tiii;
typedef tuple<ll, ll, ll> tlglglg;
typedef tuple<double, double, double> tddd;
typedef complex<double> xy_t;
typedef vector<ll> vll;
typedef vector< vector<ll> > matrix;
#define REP(i, x, y) for(ll i = (ll)x; i < (ll)y; i++)
#define DREP(i, x, y, d) for(ll i = (ll)x; i < (ll)y; i += (ll)d)
#define PER(i, x, y) for(ll i = (ll)x; i > (ll)y; i--)
#define DPER(i, x, y, d) for(ll i = (ll)x; i > (ll)y; i -= (ll)d)
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
double pi = 3.141592653589793;
ll mod = 1000000007;
int intmax = 2147483647;
int intmin = -2147483648;
ll llmax = 9223372036854775807;
ll llmin = -9223372036854775807;
int iinf = intmax / 8;
ll inf = llmax / 8;
double eps = 1e-12;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll X, A;
    cin >> X >> A;
    if (X < A) {
        cout << 0 << endl;
    } else {
        cout << 10 << endl;
    }
}


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





int main() 
{
  ll N; cin>>N;
  ll A,B,C,D,E; cin>>A>>B>>C>>D>>E;
  ll hoge=min(A,min(B,min(C,min(D,E))));
  ll ans=4+N/hoge;
  if(N%hoge!=0) {ans++;}
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
n=int(input())

#L=[n//i*(i+n//i*i)//2 for i in range(1,n+1)]
#print(sum(L))
ans=0
#for i in range(1,n+1):
#    for j in range(1,n+1):
#        if i%j==0:
#            ans+=i
#print(ans)
g=lambda x:(x*(n//x)*(n//x+1))//2
print(sum(g(i) for i in range(1,n+1)))


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

int main(){
    int N;
    cin >> N;
    vector<int> x(N),y(N),h(N);

    for(int i = 0;i < N; i++){
        cin >> x[i] >> y[i] >> h[i];
    }

    int MAX = 100;

    for(int posX = 0; posX <= MAX; posX++){
        for(int posY = 0; posY <= MAX; posY++){
            int needH = -1;

            for(int i = 0; i < N; i++){
                if(h[i] > 0){
                int tmp = h[i] + abs(x[i]-posX) + abs(y[i]-posY);
                if(needH == -1){
                    needH = tmp;
                }else{
                    //高度の定義に反していたら
                    if(needH != tmp){
                        needH = -2;
                        break;
                    }
                }
                }

            }
            //breakからそのままおりてきて。。。
            if(needH == -2) continue;

            for(int i = 0; i < N; i++){
                if(h[i] == 0){
                    int dist = abs(x[i]-posX) + abs(y[i]-posY);
                    //distが０より小さくないとmax（）で０が選ばれたことにならない
                    if(needH > dist){
                        needH = -2;
                        break;
                    }
                }
            }

            if(needH == -2) continue;

            cout << posX << " " << posY << " " << needH << endl;
			return 0;
            
            
        }
    }
}

Measured memory_bytes: 256
import java.util.*;

class Main{
  public static void main(String[] args){
    Scanner sc=new Scanner(System.in);
    int k=sc.nextInt();
    Deque<Long> dq=new ArrayDeque<>();
    if(k<10){
      System.out.println(k);
      return;
    }
    for(long i=1;i<10;i++){
      dq.addLast(i);
    }
    int cnt=9;
    while(true){
      long x=dq.pollFirst();
      long bi=x%10;
      if(bi!=0){
        dq.addLast(x*10+bi-1);
        cnt++;
        if(cnt==k){break;}
      }
      dq.addLast(x*10+bi);
      cnt++;
      if(cnt==k){break;}
      if(bi!=9){
        dq.addLast(x*10+bi+1);
        cnt++;
        if(cnt==k){break;}
      }
    }
    long last=0;
    while(!dq.isEmpty()){
      last=dq.pollFirst();
    }
    System.out.println(last);
  }
}

Measured memory_bytes: 22736