akhauriyash/Code-Regression huggingface dataset:
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

/**
 * TITLE : Welcome to AtCoder
 * URL : https://atcoder.jp/contests/abc151/tasks/abc151_c
 */
public class Main {

    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int M = sc.nextInt();
        Map<Integer, Takahasi> map = new HashMap<Integer, Takahasi>();
        for (int i = 0; i < M; i++) {
            int P = sc.nextInt();
            String S = sc.next();

            if (!map.containsKey(P)) {
                Takahasi t = new Takahasi();
                t.count(S);
                map.put(P, t);
            }
            else {
                map.get(P).count(S);
            }
        }

        Answer answer = new Answer();
        for (Takahasi t : map.values()) {
            answer = t.sum(answer);
        }
        answer.print();
        sc.close();
    }

    private static class Takahasi {
        private int penaltyCount;

        private boolean acFlag;

        public void count(String status) {
            if (acFlag)
                return;

            if ("AC".equals(status)) {
                acFlag = true;
            }
            else {
                penaltyCount++;
            }
        }

        public Answer sum(Answer answer) {
            if (acFlag) {
                answer.ac++;
                answer.wa += penaltyCount;
            }
            return answer;
        }
    }

    private static class Answer {
        int ac;

        int wa;

        public void print() {
            System.out.println(ac + " " + wa);
        }
    }
}

Measured memory_bytes: 69264
#include <bits/stdc++.h>
using namespace std;
using Int = long long;
constexpr Int MOD = 1e9 + 7;
Int dp[100001][13];
int main()
{
    string S; cin >> S;
    if (S[S.size()-1] == '?') {
        for (int i = 0; i < 10; i++) dp[0][i] = 1;
    } else {
        dp[0][S[S.size()-1]-'0'] = 1;
    }
    int d = 10;
    for (int i = 1; i < S.size(); i++) {
        char c = S[S.size()-1-i];
        auto f = [&](int t) {
            for (int j = 0; j < 13; j++) {
                (dp[i][(j+d*t)%13] += dp[i-1][j]) %= MOD;
            }
        };
        if (c == '?') {
            for (int t = 0; t < 10; t++) f(t);
        } else {
            f(c-'0');
        }
        d = (d * 10) % 13;
    }
    cout << dp[S.size()-1][5] << endl;
    return 0;
}

Measured memory_bytes: 10624
n=int(input())
s=[input()for i in range(n)]
m_cnt,a_cnt,r_cnt,c_cnt,h_cnt=0,0,0,0,0
import itertools
ans=0
for i in range(n):
    if s[i][0]=="M":
        m_cnt+=1
    elif s[i][0]=="A":
        a_cnt+=1
    elif s[i][0]=="R":
        r_cnt+=1
    elif s[i][0]=="C":
        c_cnt+=1
    elif s[i][0]=="H":
        h_cnt+=1
x=list(itertools.combinations((m_cnt,a_cnt,r_cnt,c_cnt,h_cnt),3))
for i in x:
    ans+=i[0]*i[1]*i[2]
print(ans)


Measured memory_bytes: 9772
from sys import stdin
from collections import Counter
N = int(stdin.readline().rstrip())
A = [int(x) for x in stdin.readline().rstrip().split()]
c = Counter(A)

s = 0
for i in c.values():
    s += ((i*(i-1)//2))

for i in A:
    cnt = c[i]
    ans = s
    if cnt != 1:
        ans -= (cnt*(cnt-1)//2)
        ans += ((cnt-1)*(cnt-2)//2)
    print(ans)

Measured memory_bytes: 26780
#include<iostream>
#include<stdio.h>
#include<cstdio>
#include<vector>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<queue>
#include<string>
#include<stack>
#include<set>
#include<map>
#include<time.h>
#include<cstdlib>
typedef long long ll;
//#pragma comment(linker, "/STACK:1024000000,1024000000")
#define mm(a) memset(a,0,sizeof(a))
#define lr rt<<1
#define rr rt<<1|1
#define sync std::ios::sync_with_stdio(false);std::cin.tie(0);
#define inf 0x3f3f3f3f
//#define eqs 1e-8
#define lb(x) (x&(-x))
#define ch(a) (int(a-'0'))
#define rep(i,a,b) for(int i=a;i<=b;i++)
using namespace std;
typedef pair<int,int> pii;
const double pi=acos(-1);
const int maxn=200010;
//const ll Mod=1000000007;
const ll Mod=998244353;
using namespace std;




ll a[maxn];

int main()
{
    sync;
    ll k,n;
    cin>>k>>n;
    rep(i,1,n)
    {
        cin>>a[i];
    }
    ll zd=k+a[1]-a[n];
    rep(i,2,n)
    {
        zd=max(zd,a[i]-a[i-1]);
    }
    cout<<k-zd<<endl;
    
    return 0;
}


Measured memory_bytes: 1792
#pragma GCC optimize("O3")
#define _CRT_SECURE_NO_WARNINGS
#define _CRT_DISABLE_PERFCRIT_LOCKS
#define POPCNTI(a) __builtin_popcount(a)
 
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>
#include <bits/stdc++.h>
 
using namespace std;
using namespace  __gnu_pbds;
 
// #ifndef _LOCAL_DEFINE
// inline int getchar_unlocked(){return _getchar_nolock();}
// inline void putchar_unlocked(char c) {_putchar_nolock(c);}
// #endif
 
typedef long long ll;  
typedef pair<int,int> pr; 
 
const ll MOD = 1e9 + 7,OOl=LLONG_MAX;
const int N = 1e6+1, M = 1e6+1, OO = INT_MAX,OOmem = 0x4f4f4f4f;
 
inline void WRITE_CHAR(char c)  {putchar_unlocked(c);}
 
template<typename T> 
inline bool READn (T &result) {
  int minus = 1;
  char ch;
  result=0;
  ch = (char) getchar_unlocked();
  if(ch!='-') while (!isdigit(ch) && ch!=EOF) ch= (char) getchar_unlocked(), minus = (ch == '-'? -1 : minus);
 
  if(ch==EOF) return false;
  while (isdigit(ch))  result = result*10 + (int) (ch - '0'),ch = (char) getchar_unlocked();
  
  result *= minus;
  return ch != '\n';
}
template<typename T>
inline void WRITEn(T x) {
  if (x < 0) {putchar_unlocked('-'); x = -x; }
  char writeBuffer[20], *writePtr = writeBuffer;
  do {
    *writePtr++ = (char)('0' + x % 10);
    x /= 10;
  }
  while (x);
  do  { putchar_unlocked(*--writePtr); }
  while (writePtr > writeBuffer);
}
inline bool Read_CHAR(char &c)
{
  char READ_CHARACTER = (char)getchar_unlocked();
  while ((READ_CHARACTER == '\n' || READ_CHARACTER == '\t' || READ_CHARACTER == ' ')) READ_CHARACTER = (char)getchar_unlocked();
  if(READ_CHARACTER == EOF) return false;
  c = READ_CHARACTER;
  return true;
} 
inline bool READ_CHAR_ARRAY(char (&x)[N]) {
  char READ_CHARACTER = (char)getchar_unlocked();
  while ((READ_CHARACTER == '\n' || READ_CHARACTER == '\t' || READ_CHARACTER == ' ')) READ_CHARACTER = (char)getchar_unlocked();
  if(READ_CHARACTER == EOF) return false;
  char *ptr = &x[0];
  while ((READ_CHARACTER != '\n' && READ_CHARACTER != '\t' && READ_CHARACTER != ' ' && READ_CHARACTER != EOF)) *ptr++ = READ_CHARACTER, READ_CHARACTER = (char)getchar_unlocked();
  *ptr = '\0';
  return true;
}
inline void WRITE_CHAR_ARRAY(const char *x) {
  while(*x != '\0')
    putchar_unlocked(*x++);
}
int a[N],b[N],c[N],dp[N][3],n;
int main()
{
  
  READn(n);
  for(int i=0;i<n;++i) READn(a[i]),READn(b[i]),READn(c[i]);
  dp[0][0] = a[0];
  dp[0][1] = b[0];
  dp[0][2] = c[0];
  for(int i=1;i<n;++i)
  {
    dp[i][0] = max(dp[i-1][1],dp[i-1][2])+a[i];
    dp[i][1] = max(dp[i-1][0],dp[i-1][2])+b[i];
    dp[i][2] = max(dp[i-1][0],dp[i-1][1])+c[i];
  }
  WRITEn(max({dp[n-1][0],dp[n-1][1],dp[n-1][2]}));
  return 0;
}


Measured memory_bytes: 7552
#include<bits/stdc++.h>
using namespace std;
int main() {
    int N;
    cin >> N;
    vector<int> L(2*N);
    for(int i=0; i<2*N; i++) cin >> L[i];
    sort(L.begin(), L.end(), greater<int>());
    int ans = 0;
    for(int i=1; i<2*N; i=i+2){
        ans += L[i];
    }
    cout << ans;


}

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

using namespace std;

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

	for (int i = 0; i < N.length(); i++) {
		if (N[i] == '9') {
			cout << "Yes" << endl;
			return 0;
		}
	}
	cout << "No" << endl;
	
}


Measured memory_bytes: 3604
#include <iostream>
#include <string>
#include <vector>
#include <numeric>
#include <queue>
#include <unordered_map>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <sstream>
#include <stack>
#include <map>
#include <set>

using namespace std;

int main() {
    int N, M;
    cin >> N;
    map<string, int> s;
  
  //青のカード
    for (int i = 0; i < N; i++) {
        string input;
        cin >> input;
        s[input]++;               //keyのvalueが1増加
    }
  
  //赤のカード
    cin >> M;
    for (int i = 0; i < M; i++) {
        string input;
        cin >> input;
        s[input]--;
    }

    int ans = 0;
    for (auto&& str : s) {
        ans = max(ans, str.second);
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;
#define all(c) (c).begin(), (c).end()
#define loop(i,a,b) for(ll i=a; i<ll(b); i++)
#define rep(i,b) loop(i,0,b)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple
template<class T> ostream & operator<<(ostream & os, vector<T> const &);
template<int n, class...T> typename enable_if<(n>=sizeof...(T))>::type _ot(ostream &, tuple<T...> const &){}
template<int n, class...T> typename enable_if<(n< sizeof...(T))>::type _ot(ostream & os, tuple<T...> const & t){ os << (n==0?"":" ") << get<n>(t); _ot<n+1>(os, t); }
template<class...T> ostream & operator<<(ostream & os, tuple<T...> const & t){ _ot<0>(os, t); return os; }
template<class T, class U> ostream & operator<<(ostream & os, pair<T,U> const & p){ return os << "(" << p.first << ", " << p.second << ") "; }
template<class T> ostream & operator<<(ostream & os, vector<T> const & v){ rep(i,v.size()) os << v[i] << (i+1==(int)v.size()?"":" "); return os; }
#ifdef DEBUG
#define dump(...) (cerr<<#__VA_ARGS__<<" = "<<mt(__VA_ARGS__)<<" ["<<__LINE__<<"]"<<endl)
#else
#define dump(...)
#endif

ll const inf = 1LL<<60;

typedef ll Weight;
struct UnionFindWeighted {
    vector<int> par;
    vector<Weight> ws;
    int cnt;
    UnionFindWeighted(int size_) : par(size_, -1), ws(size_, 0), cnt(size_) { }
    bool set(int x, int y, Weight w) {
        w += weight(x) - weight(y);
        x = find(x); y = find(y);
        if (x != y) {
            if (par[y] < par[x]) swap(x, y), w = -w;
            par[x] += par[y]; par[y] = x;
            cnt--;
            ws[y] = w;
        }
        return x != y;
    }
    bool get(int x, int y) {
        return find(x) == find(y);
    }
    int find(int x) {
        if(par[x] < 0){
            return x;
        } else {
            int d = find(par[x]);
            ws[x] += ws[par[x]];
            return par[x] = d;
        }
    }
    int size(int x) {
        return -par[find(x)];
    }
    int size() {
        return cnt;
    }
    Weight weight(int x){
        find(x);
        return ws[x];
    }
    Weight dist(int x, int y){ // x -> y の距離
        return get(x,y) ? weight(x) - weight(y) : inf;
    }
};

int main(){
    int n,m;
    while(cin >> n >> m && n){
        UnionFindWeighted t(n+1);
        rep(i,m){
            char c;cin >> c;
            if(c=='!'){
                int a,b,w;
                cin >> a >> b >> w;
                t.set(a,b,w);
            } else {
                int a,b;
                cin >> a >> b;
                Weight ans = t.dist(b,a);
                if(ans == inf) cout << "UNKNOWN";
                else cout << ans;
                cout << endl;
            }
        }
    }
}

Measured memory_bytes: 2364
mod = 10**9+7
N = int(input())
a = list(map(int, input().split()))
S = [0]*(N+1)
for i in range(1, N+1):
    S[i] = S[i-1]+a[i-1]
dp = [[float('inf')]*(N+1) for _ in range(N)]
for i in range(N):
    dp[i][i+1] = 0
for l in range(2, N+1):
    for i in range(N-l+1):
        j = i+l
        for ll in range(1, l):
            k = i+ll
            dp[i][j] = min(dp[i][j], dp[i][k]+dp[k][j]+S[j]-S[i])
print(dp[0][-1])

    








Measured memory_bytes: 46684
#include <iostream>
#include <string>
#include <map>
#include <vector>
#include <set>
#include <iomanip>
#include <stack>
#include <fstream>
#include <cstdint>
#include <cmath>
#include <queue>
#include <algorithm>
#include <utility>
#include <numeric>
#include <functional>

using namespace std;

constexpr int INF = 1000000000;/* 1e+9a */
constexpr int MODULO = 1000000007;

typedef int64_t ll;

array<int, 0x10000> ans;
uint abcd[] = {0xcccc, 0xaaaa, 0xf0f0, 0xff00};

uint parse(string s, int k = 0){
    if(s[k] == '-'){
        return (~parse(s, k+1)) & 0xffffu;
    }
    if(s[k] == '('){
        uint e1 = parse(s, k+1);
        k++;
        int d = 1;
        while(d > 0){
            if(s[k] == '(') d++;
            else if(s[k] == ')') d--;
            else if(d == 1) {
                if (s[k] == '^') { return e1 ^ parse(s, k+1); }
                else if (s[k] == '*') { return e1 & parse(s, k+1); }
            }
            k++;
        }
    }
    if(s[k] == '0') return 0;
    if(s[k] == '1') return 0xffffu;
    return abcd[s[k] - 'a'];
}


void calc(){
    for (int i = 0; i < ans.size(); ++i) {
        ans[i] = 1000;
    }
    queue<pair<int, int>> q;
    q.push({0, 1});
    ans[0] = 1;
    q.push({0xffff, 1});
    ans[0xffff] = 1;
    q.push({abcd[0], 1});
    ans[abcd[0]] = 1;
    q.push({abcd[1], 1});
    ans[abcd[1]] = 1;
    q.push({abcd[2], 1});
    ans[abcd[2]] = 1;
    q.push({abcd[3], 1});
    ans[abcd[3]] = 1;
    while(!q.empty()){
        uint val, len;
        tie(val, len) = q.front();
        q.pop();
        uint minus = (~val) & 0xffffu ;
        if(len+1 < ans[minus]) {
            q.push({minus, len+1});
            ans[minus] = len+1;
        }
        for (int i = 0; i < ans.size(); ++i) {
            if(ans[i] != 1000) {
                uint prod = val & i;
                uint Xor = val ^i;
                uint actLen = len + ans[i] + 3;
                if(actLen > 16) continue;
                if (actLen < ans[prod]) {
                    q.push({prod, actLen});
                    ans[prod] = actLen;
                }
                if (actLen < ans[Xor]) {
                    q.push({Xor, actLen});
                    ans[Xor] = actLen;
                }
            }
        }
    }
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    calc();
    while(1){
        string s;
        cin >> s;
        if(s == ".") break;
        cout << ans[parse(s)] << endl;
    }
}



Measured memory_bytes: 3400
def sarch(n, l):
    a = n * 10 + 5
    b = n * 10
    if l - 1 > 0:
        ans = sarch(a, l - 1)
        ans += sarch(b, l - 1)
    else:
        ans = 0
    # print(a, b)
    while n % 5 == 0 and n > 0:
        # print(n, 2)
        ans += 1
        n //= 5
    # print(n)
    return ans

n = int(input())
if n % 2 == 0:
    ans = 0
    tmp = 10
    while tmp <= n:
        ans += n // tmp
        tmp *= 5
    print(ans)
else:
    print(0)

Measured memory_bytes: 3064
#include<cstdio>
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
	int i,j,n;
	int f=0;
	cin>>n;
	for(i=0;i<=n/4;i++){
		for(j=0;j<=n/7;j++){
			if(i*4+j*7==n){
				printf("Yes\n");
				f=1;
				break;
			}
		}
		if(f)break;
	}
	if(!f)printf("No\n");
	return 0;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES

#include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <iterator>
#include <map>
#include <numeric>
#include <set>
#include <vector>
#include <queue>

using namespace std;

#define ll long long

void preambule() {
  cin.tie(0);
  cout.precision(16);
  cout << fixed;
}

int n;
int k;

string s;

void input() {
  cin >> n >> k >> s;
}

void solve1() {
  s[k - 1] = tolower(s[k - 1]);

  cout << s;
}

int main() {
#ifdef _DEBUG
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
#endif

  preambule();
  input();
  solve1();
}


Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>

#define M 3442871/* your task*/
#define L 14

char H[M][L]; /* Hash Table */

int getChar(char ch){
  if ( ch == 'A') return 1;
  else if ( ch == 'C') return 2;
  else if ( ch == 'G') return 3;
  else if ( ch == 'T') return 4;
  return 0;
}

/* convert a string into an integer value */
long long getKey(char str[]){
  long long sum = 0, p = 1, i;
  for ( i = 0; i < strlen(str); i++ ){
    sum += p*(getChar(str[i]));
    p *= 5;
  }
  return sum;
}

int h1(int key){ return key % M/* your task */; }
int h2(int key){ return 1 + (key % (M-1))/* your task */; }

int find(char str[]){
  /* your task */
  int i=0,flag=0;
  long long k,h;
  k = getKey(str);

  while(1) {
    h = (h1(k) + i * h2(k)) % M;
    if(strcmp(H[h],str) == 0) {
      flag = 1;
      break;
    }
    else if(strlen(H[h]) == 0) {
      break;
      }
    else {
      i++;
      continue;
    }
  }
  return flag; 
}

int insert(char str[]){
  /* your task */
  int i=0;
  long long k,h;
  k = getKey(str);

  while(1) {
    h = (h1(k) + i * h2(k)) % M;
    if(strcmp(H[h],str) == 0) {
      break;
    }
    else if(strlen(H[h]) == 0) {
      strcpy(H[h],str);
      break;
      }
    else {
      i++;
      continue;
    }
  }
  return 0;
}

int main(){
    int i, n, h;
    char str[L], com[9];
    for ( i = 0; i < M; i++ ) H[i][0] = '\0';
    
    scanf("%d", &n);
    
    for ( i = 0; i < n; i++ ){
	scanf("%s %s", com, str);
	
	if ( com[0] == 'i' ){
	    insert(str);
	} else {
	    if (find(str)){
		printf("yes\n");
	    } else {
		printf("no\n");
	    }
	}
    }

    return 0;
}



Measured memory_bytes: 48812
#include <iostream>
using namespace std;
 
int main()
{
   int a[5];
    for(int i=0;i<5;i++)
    {
        scanf("%d",&a[i]);
    }
  for(int i=0;i<5;i++)
    {
    if(a[i]==0)
    {
      printf("%d",i+1);
      break;}
  }
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N,K;
  cin>>N>>K;
  int X=K,i=0,ans=1;
  while(K>0){
    K/=2;
    i++;
  }
  if(N<=i){
    for(int j=0;j<N;j++) ans*=2;
  }else{
    for(int j=0;j<i;j++) ans*=2;
    for(int j=0;j<N-i;j++) ans+=X;
  }
  cout<<ans<<endl;
}

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

#define INF 1e09

using std::cin;
using std::cout;
using std::endl;
using std::setprecision;
using std::fixed;
using std::pair;
using std::make_pair;
using std::min;
using std::max;
using std::string;
using std::vector;
using std::list;
using std::map;
using std::set; // insert erase find count
using std::queue;
using std::priority_queue;
using std::stack;

typedef vector<int> VI;
typedef vector<vector<int> > VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<int, pair<int, int> > PIII;

#define MAX 1e05+1

int main(void) {
    int n;
    cin >> n;
    int start;
    int end;
    VI table(MAX + 1, 0);

    for (int i = 0; i < n; i++) {
        cin >> start >> end;
        start--;
        end--;
        for (int j = start; j <= end; j++) {
            table[j]++;
        }
    }

    for (int i = MAX; i >= 0; i--) {
        if (i <= table[i]) {
            cout << i << endl;
            break;
        }
    }
    return 0;
}

Measured memory_bytes: 3060
#include <cstdio>
#include <cstdlib>
#include <cassert>
#include <algorithm>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#define repi(i,a,b) for(ll i=(a);i<(b);++i)
#define rep(i,a) repi(i,0,a)
#define itr(it,a) for( auto it = (a).begin(); it != (a).end(); ++it )
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()

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

using ll = long long;

ll N;

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

  std::cout << N*N*N << std::endl;

  return 0;
}

Measured memory_bytes: 256
//by Top1
#include <bits/stdc++.h>
          
#define f first
#define s second
#define int long long
#define ld long double
#define ull unsigned long long
#define pii pair <int, int>
#define pll pair <long, long>
#define mp make_pair
#define pb push_back
#define pf push_front
#define pp pop_back
#define cerr cout
#define rev reverse
#define all(s) s.begin(), s.end()
#define sz(s) (int)s.size()
#define forn(i, a, b) for (int i = a; i <= b; i++)
#define boost ios_base::sync_with_stdio(false); cin.tie(0),cout.tie(0);
#define nxtp next_permutation
#define pvtp prev_permutation
#define KZ return 
#define x1 x21212121
#define y1 y21212121
#define sqr(x) x * x 
      
const int inf = (1e9) + 1;
const int mod = 479001599;
const int maxn = 3e6 + 111;
        
using namespace std;          

int n, x;
set <int> s;

void solve(){
	cin >> n;

	for (int i = 1; i <= n; i++){
		cin >> x;
		s.insert(x);
	}

	if (sz(s) == n)
		puts("YES");
	else
		cout << "NO";
}                              
      
main(){
	//freopen(".in", "r", stdin);
	//freopen(".out", "w", stdout);

    boost;
    
    int q = 1;
 
    //cin >> q;
    
    while (q--){
        solve();
    }
}

Measured memory_bytes: 9600
-module('Main').
-export([main/1]).

main(_) ->
    {ok, [S]} = io:fread("", "~s"),
    RStrings = string:split(S, "S", all),
    RStringLengthes = lists:map(fun(X) ->
                                        string:length(X)
                                end,
                                RStrings),
    Ans = lists:max(RStringLengthes),
    io:format("~p~n", [Ans]),
    halt().

Measured memory_bytes: 26824
#include<bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;

int n, m, E, ans;
int fir[N], nex[N], arr[N], dp[N], lin[N];

inline void Add_Edge(int x, int y) {
	nex[++E] = fir[x];
	fir[x] = E; arr[E] = y;
}

void dfs(int x) {
	dp[x] = 0;
	for (int i = fir[x]; i; i = nex[i]) {
		dfs(arr[i]);
		dp[x] = max(dp[x], dp[arr[i]] + 1);
	}
//	cout << x << ' ' << dp[x] << endl;
	if (dp[x] == m - 1 && !lin[x]) dp[x] = -1, ++ans;
}

int main() {
	cin >> n >> m >> ans;
	ans = (ans != 1);
	lin[1] = 1;
	for (int i = 2; i <= n; ++i) {
		int to;
		scanf("%d", &to);
		Add_Edge(to, i);
		if (to == 1) lin[i] = 1;
	}
	dfs(1);
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 4992
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
using namespace std;

int main(){
    string s;
    cin >> s;
    if(s.at(5)=='0'&&((s.at(6)=='1')||(s.at(6)=='2')||(s.at(6)=='3')||(s.at(6)=='4'))) cout << "Heisei" << endl;
    else cout << "TBD" << endl;
}

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

int main()
{
	int w;
	string s;

	cin >> w;

	while (w > 0) {
		if (w % 3 == 0) {
			s = '0' + s;
			w /= 3;
		}
		else if (w % 3 == 1) {
			s = '+' + s;
			w /= 3;
		}
		else {
			s = '-' + s;
			w /= 3;
			w++;
		}
	}

	cout << s << endl;

	return 0;
}


Measured memory_bytes: 3228
#include<bits/stdc++.h>
using namespace std;
#define ff first
#define ss second
#define N 100009
#define mod 1000000007
typedef long long int ll;
typedef long int li;

int n,x,y,dp[N][2];
vector<int> g[N];
bool vis[N];

void dfs(int u) {
    vis[u] = true;
    if(g[u].size() == 1) {
       dp[u][0] = 1; dp[u][1] = 1;
    }
    ll b = 1,w = 1;
    for(int v : g[u]) {
        if(!vis[v]) {
            dfs(v);
        	b = (b*dp[v][1])%mod;
        	w = w*(dp[v][0] + dp[v][1])%mod;
        }
    }
    dp[u][0] = b; dp[u][1] = w;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    
    cin>>n;
    for(int i=1;i<n;i++) {
        cin>>x>>y;
        g[x].push_back(y);
        g[y].push_back(x);
    }
    dfs(1);
    cout<<((dp[1][0] + dp[1][1])%mod);
    return 0;
}


Measured memory_bytes: 12160
<?php
fscanf(STDIN, "%d", $n);
$list = explode(" ", trim(fgets(STDIN)));
$result = array_product($list);
if (in_array(0, $list)) {
    echo 0;
} elseif ($result > pow(10, 18)) {
    echo -1;
} else {
    echo $result;
}


Measured memory_bytes: 25452
#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<string.h>
#include<math.h>
#include<vector>
#include<queue>
#include<set>
#include<map>
#define INF 0x3f3f3f3f
#define eps 1e-8

using namespace std;

int main()
{
    long long  n,k,s;
    cin>>n>>k>>s;
    for(int i=0;i<k;i++)
    {
        cout<<s<<" ";
    }
    if(s==1e9)
    {
        for(int i=0;i<n-k;i++)
        {
            cout<<"1"<<" ";
        }
    }
    else
    {
        for(int i=0;i<n-k;i++)
        {
            cout<<s+1<<" ";
        }
    }
    return 0;
}


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

int main()
{
    int n, m;
    cin >> n >> m;
    vector<int> a(n);
    vector<int> b(n);
    for (int i = 0; i < n; i++)
    {
        cin >> a.at(i) >> b.at(i);
    }
    vector<int> c(m);
    vector<int> d(m);
    for (int i = 0; i < m; i++)
    {
        cin >> c.at(i) >> d.at(i);
    }
    long long miti;
    long long hozon;
    int xxx;
    for(int i=0;i<n;i++){
        hozon=abs(a.at(i)-c.at(0))+abs(b.at(i)-d.at(0));;
        xxx=0;
        for(int j=0;j<m;j++){
            miti=abs(a.at(i)-c.at(j))+abs(b.at(i)-d.at(j));
            if(hozon<=miti){
                continue;
            }
            else{
                hozon=miti;
                xxx=j;
            }
        }
        cout<<xxx+1<<endl;
    }
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
int main()
{
	int sum,n;
	while(1)
	{
		cin>>sum;
		if(sum==0)
			break;
		for(int i=0;i<9;i++)
		{
			cin>>n;
			sum-=n;
		}
		cout<<sum<<endl;
	}
	return 0;
}


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

// ----------- define --------------
#define int long long
#define vi vector<int>
#define vc vector<char>
#define mii map<int,int>
#define ii pair<int,int>
#define fi first
#define sc second
#define all(x) (x).begin(),(x).end()
#define get_bit(x, k) ((x >> k) & 1)
// ---------------------------------

void MAIN() {
  string s, t;
  cin >> s >> t;
  map<char, char> m, r;
  for (int i = 0; i < s.size(); i++) {
    if (m.count(s[i]) && m[s[i]] != t[i]) {
      cout << "No" << '\n';
      return;
    }
    m[s[i]] = t[i];
    if (r.count(t[i]) && r[t[i]] != s[i]) {
      cout << "No" << '\n';
      return;
    }
    r[t[i]] = s[i];
  }
  for (char i = 'a'; i <= 'z'; i++) {
    if (!m.count(i)) continue;
    vector<int> v(256);
    char j = i;
    do {
      if (v[j]) {
        cout << "No" << '\n';
        return;
      }
      v[j] = 1;
      if (!m.count(j)) break;
      j = m[j];
    } while (j != i);
  }
  cout << "Yes" << '\n';
}

signed main() {
  ios::sync_with_stdio(0); cin.tie(0);
  int T = 1;
  // cin >> T;
  while (T--) MAIN();
}


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

#define Sort(x) sort(x.begin(), x.end())
#define Sort_rev(x) sort(x.begin(), x.end(), greater<int>())
#define ll long long

int main() {
    int a, b;
    cin >> a >> b;
    if ( a-(b*2) > 0 ) {
        cout << a-(b*2) << endl;
    } else {
        cout << 0 << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
//debug
#define vecprint(v) rep(i,v.size())cout << v[i] << " ";cout << endl;
#define setprint(s) for(auto i=s.begin();i!=s.end();i++)cout << *i << " ";cout << endl;
#define mappairprint(s) for(auto i=s.begin();i!=s.end();i++)cout << i->first << " " << i->second << endl;cout << endl;
//reader
#define r1(a) cin>>(a)
#define r2(a,b) cin>>(a)>>(b)
#define r3(a,b,c) cin>>(a)>>(b)>>(c)
//writer
#define w1(a) cout<<(a)<<" "
#define w2(a,b) cout<<(a)<<" "<<(b)<<" "
#define w3(a,b,c) cout<<(a)<<" "<<(b)<<" "<<(c)<<" "
#define wl1(a) cout<<(a)<<endl
#define wl2(a,b) cout<<(a)<<" "<<(b)<<endl
#define wl3(a,b,c) cout<<(a)<<" "<<(b)<<" "<<(c)<<endl
//variable definition
#define pii pair<int,int>
#define pis pair<int,string>
#define psi pair<string,int>
#define pll pair<ll,ll>
//roop
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rep1(i,n) for (int i = 1; i <= (n); ++i)
#define all(c) c.begin(),c.end()
//term
#define elif else if
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define eb emplace_back
using namespace std;
using ll = long long;
//const
constexpr double PI = 3.141592653589793238462643383279;
vector<int> dx = {1, 0, -1, 0}, dy = {0, 1, 0, -1};

int main() {
  //input
  string s, t;
  cin >> s >> t;
  
  int min = s.length();
  rep(i, s.length() - t.length() + 1) {
    int cnt = 0;
    int si = i;
    rep(j, t.length()) {
      if (s[si] != t[j])
        cnt++;
      si++;
    }
    if (min > cnt) 
      min = cnt;
  }
  
  //process
  cout << min << endl;
  
  
}


Measured memory_bytes: 3600
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;

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

    vector<char> spart;
    vector<char> tpart;

    for(int i = 0; i < s.length(); i++) spart.push_back(s[i]);
    for(int i = 0; i < t.length(); i++) tpart.push_back(t[i]);
    
    sort(spart.begin(), spart.end());
    sort(tpart.rbegin(), tpart.rend());

    s = "", t = "";

    for(char x : spart) s += x;
    for(char x : tpart) t += x;

    if(s < t)   cout << "Yes" << endl;
    else        cout << "No" << endl;

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,x,n) for(int i=x;i<n;i++)
#define mod 1000000007 //10^9+7
#define INF 1000000000000 //10^12
#define F first
#define S second
#define P pair<int,int>
#define all(vec) vec.begin(),vec.end()
//library begin
int gcd(int a,int b){
    if(a%b==0)return b;
    return gcd(b,a%b);
}
int lcm(int a,int b){
    return a*b/gcd(a,b);
}
int log(int a){
    int b=a;
    int cnt=0;
    while(b%2==0){
        b/=2;
        cnt++;
    }
    return cnt;
}
int mypow(int a,int b){
    if(b==0)return 1;
    if(b==1)return a;
    int t=mypow(a,b/2);
    if(b%2==0)return t*t;
    return t*t*a;
}
//Union-Find;
#define MAX_N 200000
int par[MAX_N];
int siz[MAX_N];
int Rank[MAX_N];
void init(int n){
    rep(i,n){
        par[i]=i;
        siz[i]=1;
        Rank[i]=0;
    }
}
int find(int x){
    if(par[x]==x){
        return x;
    }else{
        return par[x]=find(par[x]);
    }
}
void unite(int x,int y){
    x=find(x);
    y=find(y);
    if(x==y)return;
    if(Rank[x]<Rank[y]){
        par[x]=y;
        siz[par[x]]=siz[x]+siz[y];
    }else{
        par[y]=x;
        siz[par[y]]=siz[x]+siz[y];
        if(Rank[x]==Rank[y])Rank[x]++;
    }
}
bool same(int x,int y){
    return find(x)==find(y);
}

//library end
int n,m,k;
int fri[200000];
vector<P>blo;
int ans[200000];
signed main(){
    cin>>n>>m>>k;
    init(n);
    rep(i,m){
        int a,b;
        cin>>a>>b;
        a--;b--;
        fri[a]++;
        fri[b]++;
        unite(a,b);
    }
    rep(i,n){
        ans[i]=siz[find(i)]-fri[i]-1;
    }
    rep(i,k){
        int c,d;
        cin>>c>>d;
        c--;d--;
        if(c>d)swap(c,d);
        if(same(c,d)){
            ans[c]--;
            ans[d]--;
        }
    }
    rep(i,n-1){
        cout<<ans[i]<<" ";
    }
    cout<<ans[n-1]<<endl;
    return 0;
}


Measured memory_bytes: 6912
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
#include <array>
#include <iomanip>
using namespace std;

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

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<long double> VD;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef vector<VD> VVD;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

template<typename T> void chmin(T &a, T b) { if (a > b) a = b; }
template<typename T> void chmax(T &a, T b) { if (a < b) a = b; }

int in() { int x; scanf("%d", &x); return x; }
ll lin() { ll x; scanf("%lld", &x); return x; }
#define INF 1LL<<60

int main() {
    ll H, W;
    cin >> H >> W;
    
    ll ans = 0;
    if(H==1 || W==1) {
        ans = 1;
    }
    else{
        ans = (H*W+1)/2;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <cstdio>

using namespace std;

int N;
int bit[1<<18];
void add(int i, int x){
  while(i<=N){
	bit[i] += x;
	i += i&-i;
  }
}

int sum(int i){
  int res = 0;
  while(i > 0){
	res += bit[i];
	i -= i&-i;
  }
  return res;
}

int main(){
  int Q; scanf("%d %d", &N, &Q);
  
  while(Q--){
	int q, i, j;
	scanf("%d %d %d", &q, &i, &j);
	if(q) printf("%d\n", sum(j) - sum(i-1));
	else add(i, j);
  }
  
  return 0;
}

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

template<typename T>
inline bool chmax(T& a, const T& b) {
    if (a < b){
        a = b;
        return true;
    }
    return false;
}

template<typename T>
inline bool chmin(T& a, const T& b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}

/**
 * @brief 多次元 vector の作成
 * @author えびちゃん
 */
namespace detail {
    template<typename T, int N>
    auto make_vec(vector<int>& sizes, T const& x) {
        if constexpr (N == 1) {
            return vector(sizes[0], x);
        } else {
            int size = sizes[N-1];
            sizes.pop_back();
            return vector(size, make_vec<T, N-1>(sizes, x));
        }
    }
}
template<typename T, int N>
auto make_vec(int const(&sizes)[N], T const& x = T()) {
    vector<int> s(N);
    for (int i = 0; i < N; ++i) s[i] = sizes[N-i-1];
    return detail::make_vec<T, N>(s, x);
}

__attribute__((constructor))
void fast_io() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
}

int main() {
    int h, w;
    cin >> h >> w;

    map<int, int> mp;
    multiset<int> st;
    rep(i, w) mp[i] = i;
    rep(i, w) st.insert(0);

    rep(i, h) {
        int l, r;
        cin >> l >> r;
        l--;
        int mr = -1;
        auto it = mp.lower_bound(l);
        while (it != mp.end() && it->first <= r) {
            chmax(mr, it->second);
            st.erase(st.find(it->first - it->second));
            mp.erase(it++);
        }
        if (mr != -1 && r < w) {
            st.insert(r - mr);
            mp[r] = mr;
        }
        int ans = -1;
        if (!st.empty()) {
            ans = *st.begin() + i + 1;
        }
        cout << ans << '\n';
    }
}


Measured memory_bytes: 22336
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <map>
#include <algorithm>
#include <iomanip>
#include <queue>
#include <utility>
#include <set>
#include <stack>
#define int long long
using namespace std;
int32_t main(){
    ios_base::sync_with_stdio(false);cin.tie(NULL);
    int n,k;
    cin >> n >> k;
    vector<int>a;
    for(int i = 0; i<n; ++i){
        int t;
        cin >> t;
        a.push_back(t);
    }
    if(k>=n)
        cout << 0 << "\n";
    else{
        sort(a.begin(),a.end());
        int ans = 0;
        for(int i = 0; i < n-k;i++)
            ans+=a[i];
        cout << ans << "\n";
    }
    return 0;
}

Measured memory_bytes: 2420
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <stdio.h>
#include <queue>
#include <deque>
#include <cstdio>
#include <set>
#include <map>
#include <bitset>
#include <stack>
#include <cctype>
using namespace std;
long long a[100010];
int main() {
	int n;
	long long sum = 0;
	cin >> n;
	for (int i = 0; i < n + 1; i++) {
		cin >> a[i];
		sum += a[i];
	}
	long long ans = 1, ans1 = 0;
	for (int i = 0; i < n + 1; i++) {
		ans -= a[i];
		if (i != n) {
			if (ans <= 0) {
				cout << "-1" << endl;
				return 0;
			}
		}
		else {
			if (ans < 0) {
				cout << "-1" << endl;
				return 0;
			}
		}
		ans *= 2;
		sum -= a[i];
		ans = min(ans, sum);
		ans1 += ans;
	}
	cout << ans1 + 1 << endl;
}


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

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

using namespace std;
using ll = long long;

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

void solve()
{
  string s;
  cin >> s;
  int ans = 0;
  if (s[0] == 'R') ans++;
  if (s[1] == 'R') ans++;
  if (s[2] == 'R') ans++;
  if (s == "RSR") ans = 1;
  cout << ans;
}

int main()
{
  fastio;
  solve();

  return 0;
}

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


#define ll long long int 
#define all(v) v.begin(),v.end()
#define MOD 1000000007
#define PB push_back
#define F first
#define S second


int main(){
     
     string st;
     cin>>st;
     st+='e';

     ll cnt=0;
     ll ans=0;
     for(auto i:st){
        if(i=='R') cnt++;
        else{
            ans = max(cnt,ans);
            cnt=0;
        }
     }
     cout<<ans<<endl;

    return 0;
}

Measured memory_bytes: 3632
import java.util.*;


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

		long a = sc.nextLong();
		long b = sc.nextLong();
		long x = sc.nextLong();
		
		if( a==0 ) {
			System.out.println( b/x + 1 );
		}else {
			System.out.println( (b/x + 1) - ((a-1)/x + 1) );
		}
		
	}
}


Measured memory_bytes: 23252
#include <iostream>
#include <vector>
#include <iostream>
#include <set>
#include <map>
#include <queue>
#include <algorithm>
#include <list>
#include <stack>
#include <climits>
#include <unordered_set>
#define m7 1000000007
#define m9 1000000009
#define ll long long
#define pii pair<int,int>
#define F first
#define S second

using namespace std;
int main()
{
	int n;
	cin >> n;
	vector<vector<int>> dp(n, vector<int>(3)), H(n, vector<int>(3));

	for (int i = 0; i < n; i++) {
		cin >> H[i][0]>>H[i][1]>>H[i][2];
		dp[i][0] = dp[i][1] = dp[i][2] = INT_MIN;
	}
	dp[0][0] = H[0][0];
	dp[0][1] = H[0][1];
	dp[0][2] = H[0][2];
	for (int i = 1; i < n; i++) {
		dp[i][0] = max(dp[i - 1][1], dp[i - 1][2]) + H[i][0];
		dp[i][1] = max(dp[i - 1][0], dp[i - 1][2]) + H[i][1];
		dp[i][2] = max(dp[i - 1][1], dp[i - 1][0]) + H[i][2];
	}
	cout << max(dp.back()[0],max(dp.back()[1], dp.back()[2]));
	return 0;
}

Measured memory_bytes: 11136
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> mp;
ll inf =  1e18+2;
ll n,k;
vector<ll> a,f;
bool can( ll v ){
    ll cnt = 0;
    for(int i=0;i<n;i++){
	ll res = a[i]*f[i] - v;
	if( res <= 0 )continue;
	//cout<<res<<' '<< res/f[i] + ( res%f[i] != 0 );
	cnt += res/f[i];
	if( res%f[i] != 0 )cnt++;
	//cout<<cnt<<endl;
	if( cnt > k ){
	    return false;
	}
    }
    return true;
}

int main(){
    cin>>n>>k;
    a.resize(n);
    f.resize(n);
    for(int i=0;i<n;i++)cin>>a[i];
    for(int i=0;i<n;i++)cin>>f[i];
    sort(a.begin(),a.end() );
    sort(f.begin(),f.end());
    reverse( f.begin(),f.end() );
    ll res = inf;
    ll mc = 0;
    for(int i=0;i<n;i++){
	mc = max( mc , a[i]*f[i]);
	//cout<<a[i]<<' '<<f[i]<<endl;
    }
    ll l = 0, r = mc+1;
    while( abs( r-l ) > 1){
	//cout<<l<<' '<<r<<endl;
	ll mid = (l+r)/2;
	if( can( mid ) ){
	    r = mid;
	}else{
	    l = mid;
	}
    }
    if( can(l) )cout<<l<<endl;
    else cout<<r<<endl;
    //if( can(12) )cout<<12<<endl;
    return 0;
}


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

#define ll long long
#define all(a) a.begin(),a.end()
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define Rep(i,n,m) for(int i=(int)(n);i<(int)(m);i++)

//library----------------------------------------------


int main(){
  int a,b,c; cin>>a>>b>>c;
  int ans = 0;
  Rep(i,1,c+1){
    if(a*i<=b) ans = i;
  }
  printf("%d\n",ans);
  return 0;
}


Measured memory_bytes: 256
import java.util.*;
 
public class Main {

    private static final long MOD = 998244353;

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[] num = new int[N+10];
        int maxDist = 0;
        boolean valid = true;
        for (int i = 0; i < N; i++) {
            int dist = sc.nextInt();
            if (i == 0 && dist != 0) {
                valid = false;
            }
            num[dist]++;
            maxDist = Math.max(maxDist, dist);
        }
        if (!valid || num[0] != 1) {
            // invalid
            System.out.println(0);
            return;
        }
        /*
        for (int i = 0; i <= maxDist; i++) {
            if (num[i] == 0) {
                // invalid
                System.out.println(0);
                return;
            }
        }
        */

        long ans = 1;
        //int i = 0;
        for (int i = 0; i <= maxDist; i++) {
            int a = i > 0 ? num[i-1] : 1;
            int n = num[i];
            // a^n
            while (n-- > 0) {
                ans *= (long)a;
                ans %= MOD;
            }
        }
        System.out.println(ans);
    }
}


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

#define int long long
#define INT int
#define MOD 1000000007

#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep1(i, n) for (int i = 1; i < (n); i++)
#define rrep(i, n) for (int i = (n)-1; i >= 0; i--)
#define all(i) (i).begin(), (i).end()
#define rall(i) (i).begin(), (i).end(), greater<int>()
#define elif else if
#define eb emplace_back
#define pb push_back
#define mp make_pair
#define fst first
#define sec second
template <typename T>
void print(T x)
{
    std::cout << x << '\n';
}
typedef long long ll;
const long long INF = 1LL << 60;

signed main()
{
    int D;
    cin >> D;
    vector<int> c(26);
    rep(i, 26)
    {
        cin >> c[i];
    }
    vector<vector<int>> s(D, vector<int>(26));

    rep(i, D)
    {
        rep(j, 26)
        {
            cin >> s[i][j];
        }
    }
    vector<int> t(D);
    rep(i, D)
    {
        int m = 0;
        int d_event = 0;
        rep(j, 26)
        {
            if (m < s[i][j])
            {
                d_event = j;
                m = s[i][j];
            }
        }
        cout << d_event + 1 << endl;
    }

    /*
    vector<int> v(D);

    int last[26] = {0};

    rep(d, D)
    {
        v[d] = s[d][t[d]];
        if (d > 0)
        {
            v[d] += v[d - 1];
        }
        last[t[d]] = d + 1;
        int down = 0;
        rep(i, 26)
        {
            down += c[i] * ((d + 1) - last[i]);
        }
        v[d] -= down;
    }

    rep(i, D)
    {
        cout << v[i] << endl;
    }*/
}

Measured memory_bytes: 3720
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string.h>
#include <set>
#include <cmath>
#include <algorithm>
using namespace std;
int main(){
   int N,K,sum=0;
   int x[100];
   cin>>N; cin>>K;
   for(int i=0;i<N;i++){
       cin>>x[i];
       sum+=(K-x[i]>x[i]?2*x[i]:2*(K-x[i]));
   }
   cout<<sum<<endl;
   
   return 0;
}

Measured memory_bytes: 256
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using db = double;
using ld = long double;
template<typename T> using V = vector<T>;
template<typename T> using VV = vector<vector<T>>;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
#define all(v) (v).begin(),(v).end()
#define siz(v) (ll)(v).size()
#define rep(i,a,n) for(ll i=a;i<(ll)(n);++i)
#define repr(i,a,n) for(ll i=n-1;(ll)a<=i;--i)
#define ENDL '\n'
typedef pair<int,int> Pi;
typedef pair<ll,ll> PL;
constexpr ll mod = 1000000007;
constexpr ll INF = 1000000099;
constexpr ll LINF = (ll)(1e18 +99);
const vector<ll> dx={-1,1,0,0},dy={0,0,-1,1};
template<typename T,typename U> inline bool chmin(T& t, const U& u){if(t>u){t=u;return 1;}return 0;}
template<typename T,typename U> inline bool chmax(T& t, const U& u){if(t<u){t=u;return 1;}return 0;}
template<typename T> inline T gcd(T a,T b){return b?gcd(b,a%b):a;}

template<typename T,typename Y> inline T mpow(T a, Y n) {
  T res = 1;
  for(;n;n>>=1) {
    if (n & 1) res = res * a;
    a = a * a;
  }
  return res;
}

template<typename T,typename Y>
ostream& operator<<(ostream& os,const pair<T,Y>& p){
   return os<<"{"<<p.fs<<","<<p.sc<<"}";
}
template<typename T> ostream& operator<<(ostream& os,const V<T>& v){
   os<<"{";
  for(auto e:v)os<<e<<",";
  return os<<"}";
}
template<typename ...Args>
void debug(Args&... args){
  for(auto const& x:{args...}){
    cerr<<x<<' ';
  }
  cerr<<ENDL;
}



signed main(){
  cin.tie(0);cerr.tie(0);ios::sync_with_stdio(false);
  cout<<fixed<<setprecision(20);
  ll n,k;cin>>n>>k;
  V<ll> po(0),ne(0);
  rep(i,0,n){
    ll x;cin>>x;
    if(x>=0)po.pb(x);
    else ne.pb(x);
  }
  sort(all(po));
  reverse(all(po));

  sort(all(ne));

  int pid=0,nid=0,pn=siz(po),nn=siz(ne);
  ll ans=1;

  while(k>0){

  if(k%2==0){
    if(pid+1<pn && nid+1<nn){
      if(po[pid]*po[pid+1]>ne[nid]*ne[nid+1]){
        ans*=(po[pid]*po[pid+1])%mod;
        pid+=2;
      }else{
        ans*=(ne[nid]*ne[nid+1])%mod;
        nid+=2;
      }
    }else if(pid+1<pn){
      ans*=(po[pid]*po[pid+1])%mod;
      pid+=2;
    }else if(nid+1<nn){
      ans*=(ne[nid]*ne[nid+1])%mod;
      nid+=2;
    }else{
      if(k>=2){
        ans*=(po.back()*(ne.back()+mod))%mod;
      }else{
        ans*=po.back();
      }
    }
    k-=2;
    ans+=mod;
    ans%=mod;
  }else{
    if(pn){
      pid++;
      ans*=po[0];
      --k;
    }else{
      nid++;
      reverse(all(ne));
      ans*=(ne[0]+mod);
      ans%=mod;
      --k;
    }
  }
  }

  cout<<ans<<ENDL;
}
//! ( . _ . ) ! 
//CHECK overflow,vector_size,what to output?

Measured memory_bytes: 5600
/**Bismillahir Rahmanir Rahim.**/
/*
         Md.Fagun Molla
         18ICTCSE006
         BSMRSTU(SHIICT)
*/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
using ll=long long;
using db=double;
///***************************************************** CONSTANTS ******************************************************///

int const N=1e6+3;
ll MOD=1e9+7,fact[N];
const long long inf=(long long)1e18;
const long double PI=3.14159265358979;

///************************************************ CONTAINER DEFINITIONS ***********************************************///

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

///************************************************ SHORT FORM KEYWORDS *************************************************///

#define PB push_back
#define F first
#define S second
#define MP make_pair
#define I insert
#define lb lower_bound
#define ub upper_bound
#define endl '\n'

///************************************************ SHORT FORM FUNCTIONS ************************************************///

#define loop(a,b) for(ll i=a;i<b;i++)
#define loopr(a,b) for(ll i=a-1;i>=b;i--)
#define mem(a,b) memset(a, b, sizeof(a) )
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a*(b/gcd(a,b)))
#define sa(v) sort(v.begin(),v.end())
#define sd(v) sort(v.begin(),v.end(),greater<>())
#define rev(s) reverse(s.begin(),s.end())
#define stll(x) stoll(x, nullptr, 10);
#define yes cout<<"YES"<<endl;
#define no cout<<"NO"<<endl;
#define mx(a) *max_element(all(a))
#define mn(a) *min_element(all(a))
#define all(a) a.begin(),a.end()
#define mxa(a,N) *max_element(a,a+N)
#define mna(a,N) *min_element(a,a+N)
#define print(a) {for(auto x:a)cout<<x<<" ";cout<<endl;}
#define io() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);


///************************************************ SOLUTION STARTS HERE ************************************************///
///======================================================================================================================///

void solve(){
	int n; cin>>n;
	string s;
	cin>>s;
	int c=0;
	string ss=s;
	sort(s.begin(),s.end());
	for(int i=0; i<s.size(); i++){
		if(s[i]!=ss[i]) c++;
	}
	cout<<c/2<<endl;
}
int main()
{
    io();
    int T=1;//cin>>T;
    while(T--) solve();
    return 0;
}

/****************ALHAMDULILLAH******************/


Measured memory_bytes: 3812
n = int(input())
h = list(map(int, input().split()))
dp = [0] * n
dp[1] = abs(h[1] - h[0])
for i, (h, h1, h2) in enumerate(zip(h[2:], h[1:], h)):
    dp[i + 2] = min(dp[i + 1] + abs(h - h1), dp[i] + abs(h - h2))
print(dp[-1])


Measured memory_bytes: 13928