akhauriyash/Code-Regression huggingface dataset:
#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 drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define eb emplace_back
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
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; }
ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}
int const INF = 1001001001;


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

int N,K;
cin >> N >> K;
vl V(N);
rep(i,N) cin >> V[i];

ll ans = 0;

int R = min(N,K);
for(int a = 0; a <= R;++a){ 
    for(int b = 0; a + b <= R;++b) {
        ll cur = 0;
        vl v;
        rep(i,a) {v.push_back(V[i]); cur += V[i];}
        rep(i,b) {v.push_back(V[N-1-i]); cur += V[N-1-i];}
        sort(all(v));
        for (int i = 0; i < min(K - a - b, (int)v.size()); ++i) {
                if (v[i] < 0) cur -= v[i];
            }
        ans = max(ans, cur);
    }
}

cout << ans << endl;

return 0;
}

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


int main()
{
int n;
string s;

cin >> n >> s;



if((s.substr(0,n/2) == s.substr((n/2),n-1) ) && n%2==0)
{
	cout << "Yes" <<  endl;
}
else
{
	cout << "No" << endl;
}

  return 0;
}




Measured memory_bytes: 3600
from collections import Counter


s = list(input())
s_cnt = Counter(s)
s_cnt_keys = list(s_cnt.keys())
if len(s_cnt.keys()) == 4:
    print('Yes')
    exit()
elif len(s_cnt.keys()) == 2:
    if s_cnt_keys[0] == 'S' and s_cnt_keys[1] == 'N':
        print('Yes')
        exit()
    elif s_cnt_keys[0] == 'N' and s_cnt_keys[1] == 'S':
        print('Yes')
        exit()
    elif s_cnt_keys[0] == 'E' and s_cnt_keys[1] == 'W':
        print('Yes')
        exit()
    elif s_cnt_keys[0] == 'W' and s_cnt_keys[1] == 'E':
        print('Yes')
        exit()
print('No')

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

int N;
int A[200100];
vector<int> v;
 
signed main() {
    cin.tie(0); ios::sync_with_stdio(false);
    cin >> N;
    rep(i, N) {
        cin >> A[i];
        v.pb(A[i]);
    }
    sort(v.begin(), v.end());
    reverse(v.begin(), v.end());
    rep(i, N) {
        if (v[0]==A[i]) cout << v[1] << endl;
        else cout << v[0] << endl;
    }
}

Measured memory_bytes: 4848
#include<bits/stdc++.h>
using namespace std;
void IMP(){puts("IMPOSSIBLE"); exit(0);}

vector<int> conn[1010];
int P[1010];
int X[1010];
int W[1010]; // i node X[i] - W[i]
int N;

void doDP(int v)
{
  int capacity = X[v];
  int Wval = 0;
  vector<int> childs;
  for(auto x: conn[v])
  {
    capacity -= min(X[x], W[x]);
    childs.push_back(abs(X[x]-W[x]));
    Wval += X[x] + W[x];
  }
  if(capacity < 0) IMP();
  vector<bool> DP(capacity+1, false); DP[0] = true;
  for(auto x: childs)
    for(int i=capacity-x; i>=0; --i)
      if(DP[i]) DP[i+x] = true;
  for(int i=capacity; i>=0; --i)
    if(DP[i])
    {
      Wval += capacity-i;
      W[v] = Wval-X[v];
      return;
    }
}
int main()
{
  scanf("%d", &N);
  for(int i=2; i<=N; ++i)
  {
    scanf("%d", P+i);
    conn[P[i]].push_back(i);
  }
  for(int i=1; i<=N; ++i)
    scanf("%d", X+i);
  for(int i=N; i>=1; --i)
    doDP(i);
  puts("POSSIBLE");
  return 0;
}

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

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define FOR(i,n,m) for(int i=(int)(n); i<=(int)(m); i++)
#define RFOR(i,n,m) for(int i=(int)(n); i>=(int)(m); i--)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define RITR(x,c) for(__typeof(c.rbegin()) x=c.rbegin();x!=c.rend();x++)
#define setp(n) fixed << setprecision(n)

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 (a>b) { a=b; return 1; } return 0; }

#define ll long long
#define vll vector<ll>
#define vi vector<int>
#define pll pair<ll,ll>
#define pi pair<int,int>

#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define ins insert

using namespace std;

/* Some Libraries */

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

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N,M,K; cin>>N>>M>>K;
    vll a(N),b(M);
    rep(i,N) cin>>a[i];
    rep(i,M) cin>>b[i];
    vll asum(N+1), bsum(M+1);
    rep(i,N) asum[i+1]=asum[i]+a[i];
    rep(i,M) bsum[i+1]=bsum[i]+b[i];
    int ans=0;
    rep(i,N+1){
        ll sum=0;
        sum += asum[i];
        if (sum > K) break;
        chmax(ans, (int)(i+upper_bound(all(bsum), K-sum)-bsum.begin()-1));
    }
    cout<<ans<<endl;
    return 0;
}


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

typedef long long int ll;

int main()
{
    string s;
    ll ans = 0;
    cin >> s;
    for(ll i = 0;i < s.size() / 2;i++){
        if(s[i] != s[s.size() - i - 1]){
            ans++;
        }
    }

    cout << ans;

    return 0;
}

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

#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define endl '\n'
#define fcin ios::sync_with_stdio(false); cin.tie(nullptr);
#define INF 0x3f3f3f3f
#define all(x) x.begin(), x.end()
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

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

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

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

void debug_out(){ cerr << endl;}
template <typename First, typename... Next>
void debug_out(First F, Next... N){
    cerr << " " << to_string(F);
    debug_out(N...);
}

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

int main(){
    fcin;

    ll a, b, k;
    cin >> a >> b >> k;

    ll r = min(a, k);
    a -= r;
    k -= r;

    if(k) b -= min(b, k);

    cout << a << " " << b << endl;
    return 0;
}



Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        final String DREAM = "maerd";
        final String DREAMER = "remaerd";
        final String ERASE = "esare";
        final String ERASER = "resare";
        Scanner sc= new Scanner(System.in);
        StringBuilder sb = new StringBuilder();
        String s = sc.next();
        sb.append(s);
        sb.reverse();
        String[] dreams = {DREAM, DREAMER, ERASE, ERASER};
        boolean daydream = true;
        String ans = "NO";
        dd:while(daydream) {
            for(String dre : dreams) {
                if(sb.indexOf(dre) == 0) {
                    sb.replace(0, dre.length(), "");
                    daydream = true;
                    continue dd;
                }
                daydream = false;
            }
        }
        if(sb.length() == 0)ans = "YES";
        System.out.println(ans);
    }
}


Measured memory_bytes: 26228
#include <bits/stdc++.h>
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++)
typedef long long ll;

int main(){
    ll A,B,total=0;
    cin >> A >> B;

    if(A<=B*2){
        puts("0");
    }else{
        cout << A-2*B << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define rep(i, n) for (ll i = 0; i < n; i++)
#define Rep(i, r, n) for (ll i = r; i < n; i++)
#define pb push_back
#define MOD 1000000007
#define INF 1000000000000
#define EPS 0.00000000001
typedef long long ll;

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
    //---------------------------------------------

    int n;
    cin>>n;
    cout<<n*n*n<<endl;
}

Measured memory_bytes: 256
from itertools import accumulate
import bisect

n = int(input())
ls = []
res = 0
for i in range(1, n+1):
    if res > n:
        break
    res += i
    ls.append(res)
while n:
    ind = bisect.bisect_left(ls, n)
    print(ind + 1)
    n -= ind + 1

Measured memory_bytes: 3572
package main

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

func configure(scanner *bufio.Scanner) {
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, 1000005), 1000005)
}
func getNextString(scanner *bufio.Scanner) string {
	scanned := scanner.Scan()
	if !scanned {
		panic("scan failed")
	}
	return scanner.Text()
}
func getNextInt(scanner *bufio.Scanner) int {
	i, _ := strconv.Atoi(getNextString(scanner))
	return i
}
func getNextInt64(scanner *bufio.Scanner) int64 {
	i, _ := strconv.ParseInt(getNextString(scanner), 10, 64)
	return i
}
func getNextFloat64(scanner *bufio.Scanner) float64 {
	i, _ := strconv.ParseFloat(getNextString(scanner), 64)
	return i
}
func main() {
	fp := os.Stdin
	wfp := os.Stdout
	extra := 0
	if os.Getenv("I") == "IronMan" {
		fp, _ = os.Open(os.Getenv("END_GAME"))
		extra = 100
	}
	scanner := bufio.NewScanner(fp)
	configure(scanner)
	writer := bufio.NewWriter(wfp)
	defer func() {
		r := recover()
		if r != nil {
			fmt.Fprintln(writer, r)
		}
		writer.Flush()
	}()
	solve(scanner, writer)
	for i := 0; i < extra; i++ {
		fmt.Fprintln(writer, "-----------------------------------")
		solve(scanner, writer)
	}
}
func solve(scanner *bufio.Scanner, writer *bufio.Writer) {
	n := getNextInt(scanner)
	y := getNextInt(scanner) / 1000
	for i := 0; i <= n; i++ {
		for j := 0; j <= n; j++ {
			k := n - i - j
			if k < 0 {
				break
			}
			if 10*i+j*5+k == y {
				fmt.Fprintln(writer, fmt.Sprintf("%d %d %d", i, j, k))
				return
			}
		}
	}
	fmt.Fprintln(writer, "-1 -1 -1")
}


Measured memory_bytes: 1784
# -*- coding: utf-8 -*-
"""
Created on Thu May 14 16:15:19 2020

@author: shinba
"""

n,t = map(int,input().split())

T = list(map(int,input().split()))
T.append(10**10)
R = []
for i in range(n):
    R.append(T[i+1]-T[i])

ans = 0
start = T[0]

for i in range(n):
    if R[i] <= t:
        continue
    ans += t+(T[i]-start)
    start = T[i+1]
    
print(ans)

Measured memory_bytes: 97616
#include<iostream>
#include<vector>
#include<utility>
#include<deque>
#include<algorithm>
#include <iomanip>
#include<cmath>

using namespace std;
using ll = long long int;
constexpr int INF = 1 << 29;
constexpr ll MOD = ll(1e9 + 7);

int n, a, m;

int main(void) {
	cin >> n;
	cout << n * n * n << endl;
	return 0;
}

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

using namespace std;
#define DBG(x)                         \
    (void)(cout << "L" << __LINE__     \
                << ": " << #x << " = " \
                << (x) << '\n')
#define Lower_bound(v, x) distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) distance(v.begin(), upper_bound(v.begin(), v.end(), x))
typedef long long ll;
using pii = pair<int, int>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
const long double PI = (acos(-1));
const long double EPS = 0.0000000001;
const int INF = 0x3f3f3f3f;
const int maxn = 1100000;
char mp[10][10];
void run_case()
{
    int H, W, K;
    cin >> H >> W >> K;
    for (int i = 0; i < H; i++)
    {
        cin >> mp[i];
    }
    int len1 = (1 << H) - 1;
    int len2 = (1 << W) - 1;
    // DBG(len1);
    // DBG(len2);
    int ans = 0;
    for (int col = 0; col <= len1; col++)
    {
        //int cnt = 0;
        for (int row = 0; row <= len2; row++)
        {
            int cnt = 0;
            for (int i = 0; i < H; i++)
            {
                for (int j = 0; j < W; j++)
                {
                    char ch = mp[i][j];
                    if (ch == '#' && ((col >> i) & 1) == 0 && ((row >> j) & 1) == 0)
                        cnt++;
                }
            }
            if (cnt == K)
                ans++;
        }
    }
    cout << ans << "\n";
}
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << setiosflags(ios::fixed) << setprecision(12);
    run_case();
    cout.flush();
    return 0;
}

Measured memory_bytes: 3660
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> l_l;
typedef vector<ll> vel;
typedef vector<int> vei;
typedef vector<string> ves;
typedef vector<vector<int>> ve_vei;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<(int)(n);i++)
#define rep2(i,n) for(int i=2;i<(int)(n);i++)
#define fs first
#define sc second
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
 
int main() {
	//cout.precision(10);
	cin.tie(0);
	ios::sync_with_stdio(false);

    int N; cin >> N;
    vei a(N);
    rep(i,N) cin >> a[i];

    sort(rall(a));
    cout << a[0] - a[N-1] << endl;
    return 0;
}

Measured memory_bytes: 256
import static java.lang.Integer.*;
import static java.lang.Long.*;
import static java.lang.System.*;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Main {

    static void solve() throws Exception {
        int N = scanInt(), K = scanInt();
        int[] ans = new int[N];
        for (int i = 0; i < K; i++) {
            int d = scanInt();
            for (int j = 0; j < d; j++) {
                int index = scanInt();
                ans[index-1] = 1;
            }
        }
        int count = 0;
        for (int i = 0; i < N; i++) {
            if (ans[i] == 0) count++;
        }
        System.out.println(count);
    }

    static int scanInt() throws IOException {
        return parseInt(scanString());
    }

    static long scanLong() throws IOException {
        return parseLong(scanString());
    }

    static String scanString() throws IOException {
        while (tok == null || !tok.hasMoreTokens()) {
            tok = new StringTokenizer(in.readLine());
        }
        return tok.nextToken();
    }

    static BufferedReader in;
    static PrintWriter out;
    static StringTokenizer tok;

    public static void main(String[] args) {
        try {
            in = new BufferedReader(new InputStreamReader(System.in));
            out = new PrintWriter(System.out);
            solve();
            in.close();
            out.close();
        }
        catch (Throwable e) {
            e.printStackTrace();
            exit(1);
        }
    }
}

Measured memory_bytes: 34872
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define P pair<ll,ll>
#define FOR(I,A,B) for(ll I = (A); I < (B); ++I)
#define FORR(I,A,B) for(ll I = (B-1); I >= (A); --I)
#define SORT(x) (sort(x.begin(),x.end())) // 0 2 2 3 4 5 8 9
#define REV(x) (reverse(x.begin(),x.end())) //reverse
ll gcd(ll a,ll b){if(a<b)swap(a,b);if(a%b==0)return b;else return gcd(b,a%b);}
ll lcm(ll a,ll b){ll c=gcd(a,b);return ((a/c)*(b/c)*c);}//saisyo kobaisu
#define NEXTP(x) next_permutation(x.begin(),x.end())
const ll INF=1e18+7;
const ll MOD=1e9+7;

vector<ll> enum_div(int n)//nの約数を列挙
{
	vector<ll> ret;
	for(ll i=1 ; i*i<=n ; ++i)
	{
		if(n%i == 0)
		{
			ret.push_back(i);
			if(i!=1 && i*i!=n)
			{
				ret.push_back(n/i);
			}
		}
	}
	return ret;
}

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	ll N , M;
	cin >> N >> M;
	ll ans = 1;
	vector<ll> yakusu;
	yakusu = enum_div(M);
	yakusu.push_back(M);
	for (auto x : yakusu){
		if(M>=N*x)ans = max(ans,x);
	}
	cout << ans << endl;
}

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

void solve()
{
    int x;
    cin >> x;
    string s;
    set<string> se;
    while (x--)
    {
        cin >> s;
        se.insert(s);
    }
    cout << se.size();
}
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    solve();
    return 0;
}

Measured memory_bytes: 19260
#include <iostream>
#include <math.h>
#include <string>
#include <algorithm>
#include <set>
#include <queue>
#include <stack>
#include <utility>
#include <tuple>
using namespace std;

const double pi = acos(-1);

#define nyan cout<<"(=^•ω•^=)"<<endl;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)

string s;
int w;

signed main(){
    cin>>s>>w;
    for(int i=0;i*w<s.length();i++)cout<<s[i*w];
    cout<<endl;
    return 0;
}

Measured memory_bytes: 256
/*
    問題をよく読もう！
    論理的に考えよう！
    サンプルを確認しよう!
    絶対に諦めるな！
    工夫をしろ！
    配列は少し多めにとっておく

    Twitterは終わるまでログアウト！
    （間違えて解法をツイートしてはいけないから）

*/
//include
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
#include<stdio.h>
#include<cstring>
//namespace
using namespace std;
//繰り返し
#define REP(i, m, n) for(int i=(int)m; i<(int)n; ++i)
#define rep(i, n) REP(i, 0, n)
//イテレータ
#define all_range(C) begin(C), end(C)
//簡略化
typedef long long ll;
typedef pair<int,int> pint;
typedef pair<ll,int> pli;
typedef pair<string,int> pst;

const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;
//最大最小
template<typename T1, typename T2> inline void chmin(T1 &a, T2 b) {if(a>b) a=b;}
template<typename T1, typename T2> inline void chmax(T1 &a, T2 b) {if(a<b) a=b;}

//関数

//最大公約数を求める
ll my_gcd(ll x, ll y) {
  ll r;

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

  return x;
}

//最小公約数を求める
ll my_lcm(ll x, ll y) {

  return (x*y)/my_gcd(x,y);
}

//xのy乗を求める ※参考：10^18乗まで
ll my_pow(ll x, ll y) {
  ll sum = 1;

  while(y>0) {
    sum *= x;
    --y;
  }

  return sum;
}

/*考えを書くスペース
  累乗和で解く

  ・総和を求める
  ・取り消すところの一つ先を見る
*/
//main.cpp----------------------------
#define max_n 8

void solve();

int c[3][3];

int main() {
  rep(i, 3) {
    rep(j, 3) cin >> c[i][j];
  }

  solve();

  return 0;
}

void solve() {

  if((c[0][1]-c[0][0])+(c[1][0]-c[0][0])!=(c[1][1]-c[0][0])) {
    cout << "No" << endl;
  }else if((c[0][2]-c[0][0])+(c[2][0]-c[0][0])!=(c[2][2]-c[0][0]))  {
    cout << "No" << endl;
  }else if((c[1][2]-c[1][1])+(c[2][1]-c[1][1])!=(c[2][2]-c[1][1])) {
    cout << "No" << endl;
  }else {
    cout << "Yes" << endl;
  }
}


Measured memory_bytes: 256
import sys
read = sys.stdin.read
readline = sys.stdin.readline
from itertools import accumulate
from collections import deque
from math import sqrt
from collections import defaultdict
def main():
    n = int(input())
    cnt = defaultdict(int)
    for _ in range(n):
        s = input()
        cnt[s] += 1
    print('AC x ', end='')
    print(cnt['AC'])
    print('WA x ', end='')
    print(cnt['WA'])
    print('TLE x ', end='')
    print(cnt['TLE'])
    print('RE x ', end='')
    print(cnt['RE'])
if __name__ == '__main__':
    main()


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

import static java.lang.System.in;

public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        if(!isPalindrome(s.replace("x",""))){
            System.out.println(-1);
            System.exit(0);
        }
        ArrayList<Integer> rec = new ArrayList<>();
        int n = s.length();
        for(int i=0;i<n;i++){
            if(s.charAt(i)!='x') rec.add(i);
        }

        long ans = 0;
        if(rec.size()!=0){
            ans += Math.abs(n-1-rec.get(rec.size()-1)-rec.get(0));
            int flag = 1-rec.size()%2;
            for(int i=0;i<rec.size()/2-flag;i++){
                int left = rec.get(i+1)-rec.get(i);
                int right = rec.get(rec.size()-1-i)-rec.get(rec.size()-2-i);
                ans += Math.abs(left-right);
            }
        }
        /*if(rec.size()%2==1){
          ans += Math.abs(n-1-rec.get(rec.size()-1)-rec.get(0));
          for(int i=0;i<rec.size()/2;i++){
            int left = rec.get(i+1)-rec.get(i);
            int right = rec.get(rec.size()-1-i)-rec.get(rec.size()-2-i);
            ans += Math.abs(left-right);
          }
        } else{
          if(rec.size()==0) continue;
          ans += Math.abs(n-1-rec.get(rec.size()-1)-rec.get(0));
          for(int i=0;i<rec.size()/2-1;i++){
            int left = rec.get(i+1)-rec.get(i);
            int right = rec.get(rec.size()-1-i)-rec.get(rec.size()-2-i);
            ans += Math.abs(left-right);
          }
        }*/
        System.out.println(ans);
    }
    static boolean isPalindrome(String s){
        if(s.length()==0) return true;
        int n = s.length();
        for(int i=0;i<n;i++){
            if(s.charAt(i)!=s.charAt(n-1-i)) return false;
        }
        return true;
    }
}


Measured memory_bytes: 34972
#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;

template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define all(a) a.begin(),a.end()
#define F first
#define S second
#define pb push_back
#define ll long long
#define vi vector<int>
#define pi pair<int,int>
#define mp make_pair

#ifdef LOCAL
#include "debug.h"
#else
#define debug(...) 69
#endif
	

const int mod=1e9+7;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
template<typename A,typename B> istream& operator>>(istream&,pair<A,B>&);
template<typename A> istream& operator>>(istream&,vector<A>&);
void add(int&,int);
int mul(int,int);
int powz(int,int);

const int N=500006;
bool f[N];
int dp[N];
void solve()
{
    int n,m;
    cin>>n>>m;
    vi a(m);
    cin>>a;
    for(auto i:a)f[i]=true;
     dp[0]=1;
    for(int i=1;i<=n;i++)
    {
		if(f[i]==false){if(i>1){add(dp[i],dp[i-1]);add(dp[i],dp[i-2]);}else add(dp[i],dp[i-1]);}
		}
		cout<<dp[n];
}




int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int tc=1;
	//~ cin>>tc;	
	for(int i=0; i<tc; i++)
	{
		solve();
	}

}


int mul(int a,int b)
{
	return ((a)*1ll*(b))%mod;
}

void add(int &a,int b)
{
	a+=b;
	if(a>=mod)a-=mod;
	if(a<0)a+=mod;
}
int powz(int a,int b)
{
	int res=1;
	while(b)
	{
		if(b&1)res=mul(res,a);
		b/=2;
		a=mul(a,a);
	}
	return res;
}

template <typename A, typename B>
istream& operator>>(istream& input,pair<A,B>& x) {
	input>>x.F>>x.S;
	return input;
}

template <typename A>
istream& operator>>(istream& input,vector<A>& x) {
	for(auto& i:x)
		input>>i;
	return input;
}



Measured memory_bytes: 1024
#include <iostream>
using namespace std;
#include<bits/stdc++.h>
#define ll long long 
#define jaldi_chal  ios_base::sync_with_stdio(0); cin.tie(0);
#define tr(c,i) for(auto i=(c).begin(); i != (c).end(); i++)
#define REP(i,k) for( ll i=0;i<k;i++)
#define REW(i,a,b) for(ll i=a;i<=b;i++)
#define M 1000000007
#define F first
#define dbg(x)  cout<<#x<<" " <<x<<endl;
#define S second
#define inf 1e10
#define endl "\n"

float power(float a,ll b)
{
    float res=1;
    while(b)
    {
        if(b%2)
        {
            b--;
            res=res*a;
        }else {
            b=b/2;
            a=a*a;
        }
    }
    return res;
    
}

int main() {
jaldi_chal
double l;
cin>>l;
cout<<setprecision(8);
//cout<<fixed;
double val=(l/(3));
double ans=val*val;
ans=ans*val;
cout<<ans;



	return 0;
}

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

int main(){
    int n;
    cin >> n;
    int answer = 0;
    for(int i = 1; i < n+1; i++){
        int count = 0;
        if(i % 2 == 0){
            continue;
        }
        for(int j = 1; j < n+1; j++){
            if(i % j == 0){
                count += 1;
            }
        }
        if(count == 8){
            answer += 1;
        }
        count = 0;
    }
    cout << answer << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
using vec=vector<ll>;
using mat=vector<vec>;
#define For(i,a,b) for(i=a;i<b;i++)
#define rep(i,N) For(i,0,N)
#define rep1(i,N) For(i,1,N)
#define all(v) (v).begin(),(v).end()
#define vsort(v) sort(all(v))
#define mod 1000000007
using data=pair<ll,ll>;

long mmid(long a,long b,long c){return a<b?(b<c?b:max(a,c)):(b>c?b:min(a,c));}

ll modinv(ll a) {
  ll b=mod,u=1,v=0,t;
  while(b){
    t=a/b;
    a-=t*b; swap(a,b);
    u-=t*v; swap(u,v);
  }
  return (u+mod)%mod;
}

ll moddevide(ll a,ll b){return (a*modinv(b))%mod;}

ll modncr(ll n,ll r){
  ll i,plus=1;
  rep(i,r){
    plus=(plus*(n-i))%mod;
    plus=moddevide(plus,i+1);
  }
  return plus;
}

ll euclidean_gcd(ll a, ll b) {
  if(a<b) return euclidean_gcd(b, a);
  ll r;
  while ((r=a%b)){a=b;b=r;}
  return b;
}

ll countdigits(ll n){
  ll ans=0;
  while(n){n/=10;ans++;}
  return ans;
}

ll sumdigits(ll n){
  ll ans=0;
  while(n){ans+=n%10;n/=10;}
  return ans;
}

void printmap(vector<ll>& a,ll H,ll W){
  ll i,j;
  For(i,0,H+2){
    For(j,0,W+2){cout<<a[i*(W+2)+j];}
    cout<<endl;
  }
}
void inputmap(vector<ll>& a,ll H,ll W){
  ll i,j;
  string ss;
  For(i,1,H+1){
    cin>>ss;
    For(j,1,W+1){
      if(ss[j-1]=='#'){
        a[i*(W+2)+j]=1;
      }else{
        a[i*(W+2)+j]=0;
      }
    }
  }
}


int main(){
  ll i,N,K;
  cin>>N;
  cout<<3*N*N;
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<queue>
#include<climits>
#include<set>
#include<map>
#include<stack>
#define ll long long
using namespace std;

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


}




Measured memory_bytes: 256
import java.util.*;
 
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = Integer.parseInt(sc.next());
        int b = Integer.parseInt(sc.next());
        int c = Integer.parseInt(sc.next());
        int k = Integer.parseInt(sc.next());
        System.out.println(a+b+c+max(a, max(b, c))*(int)(Math.pow(2, k)-1));
    }  
    public static int max(int a, int b) {
        if(a <= b) return b;
        else return a;
    }
}

Measured memory_bytes: 21844
using System;
using System.Collections.Generic;
using System.Text;

namespace AOJ
{
    class Program
    {
        static void Main(string[] args)
        {
            for (; ; )
            {
                var inputLine = Console.In.ReadLine();
                var inputs = inputLine.Split(new char[] { ' ', '\t', '　' });
                if (inputs.Length != 2)
                {
                    return;
                }

                var H = int.Parse(inputs[0]);
                var W = int.Parse(inputs[1]);
                if (H == 0 && W == 0)
                {
                    break;
                }

                for (int ih = 0; ih < H; ++ih)
                {
                    for (int iw = 0; iw < W; ++iw)
                    {
                        int index = ih + iw;
                        if ((index % 2) == 0)
                        {
                            Console.Write("#");
                        }
                        else
                        {
                            Console.Write(".");
                        }
                    }
                    Console.WriteLine();
                }
                Console.WriteLine();
            }
        }
    }
}


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

int main() {
	int N;
    double sum = 0;
	cin >> N;
	vector<double> data(N);
	for (int i = 0; i < N; i++) {
		cin >> data.at(i);
	}
    vector<double> gyakusuu(N);
    for(int i = 0; i < N; ++i){
        gyakusuu.at(i) = 1.0/data.at(i);
    }
    rep(i,N){
        sum += gyakusuu.at(i);
    }
    sum = 1.0/sum;

    cout << setprecision(7) << sum << endl;

}


Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<cmath>
#include<bitset>
#include<iostream>
#include<algorithm>
#include<string>
#include<utility>
#include<tuple>
#include<vector>
#include<list>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<numeric>
#include<functional>
#include<iomanip>
#include<random>

#define IOS ios::sync_with_stdio(false),cin.tie(0)
#define REP(i,n) for(int i = 0;i < n;i++)
#define FOR(i,a,b) for(int i = a;i < b;i++)
#define MEM(a,b) memset(a,b,sizeof(a))
#define ALL(x) (x).begin(),(x).end()
#define LMAX 9223372036854775807
#define LMIN -9223372036854775808

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef pair<ull, ull> UP;
typedef tuple<int, int, int> T;

struct UnionFind {
	vector<int> data;
	UnionFind(int size) : data(size, -1) {}
	void unionSet(int x, int y) {
		x = root(x), y = root(y);
		if (x != y) {
			if (data[y] < data[x])swap(x, y);
			data[x] += data[y]; data[y] = x;
		}
	}
	bool findSet(int x, int y) {
		return root(x) == root(y);
	}
	int root(int x) {
		return data[x] < 0 ? x : data[x] = root(data[x]);
	}
	int size(int x) {
		return -data[root(x)];
	}
};

ll gcd(ll a, ll b) {
	if (a < b)swap(a, b);
	int k = a % b;
	if (k == 1)return 1;
	if (k == 0)return b;
	int ans = gcd(b, k);
	return ans;
}
ll digisum(ll a) {
	int sum = 0;
	while (a) {
		sum += a % 10;
		a /= 10;
	}
	return sum;
}
ll countpow(ll a, ll b) {
	int ans = 0;
	if (b == 0)return -1;
	while (1) {
		if (a % b == 0) {
			a /= b;
			ans++;
		}
		else break;
	}
	return ans;
}


int main() {
	IOS;
	ll n;
	cin >> n;
	cout << (ll)pow(floor(sqrt(n)), 2) << endl;
}



Measured memory_bytes: 256
[N ,K] = list(map(int,input().split()))
max = int((N-1)*(N-2)/2)
if max<K:
    print(-1)
    exit()

tree = []
for i in range(2, N+1):
    tree.append((1,i))
t = 3
a=0
for i in range(0, max-K):
    if i+t-a>N:
        a += i-a
        t+=1 
    tree.append((i+2-a,i+t-a))

print(len(tree))
for i in tree:
    print(str(i[0]) + " " +str(i[1]))


Measured memory_bytes: 3608
#include <bits/stdc++.h>
using namespace std; 
const int dx[]={1,0,-1,0,1,-1,-1,1}; 
const int dy[]={0,1,0,-1,1,1,-1,-1}; 
const int INF = 1e9; 
const long long LINF = 1e18; 
const double EPS = 1e-8; 
#define pb push_back
#define mk make_pair 
#define fr first 
#define sc second 
#define ll long long 
#define reps(i,j,k) for(int i = (j); i < (k); ++i) 
#define rep(i,j) reps(i,0,j) 
#define all(a) (a).begin(),(a).end() 
#define MOD 1000000007 
typedef pair<int,int> Pii;
typedef vector<int> vi;
int main(){
    ll N;
    cin >> N;
    ll even = 0;
    ll odd = 0;
    rep(i,N){
        int tmp;
        cin >> tmp;
        if(tmp % 2 == 0){
            even++;
        }
        else{
            odd++;
        }
    }
    even += odd/2;
    odd = odd%2;

    if(even >= 1 && odd == 0){
        puts("YES");
    }
    else if(even == 0 && odd == 1){
        puts("YES");
    }
    else{
        puts("NO");
    }

    return 0;
}


Measured memory_bytes: 384
import java.util.ArrayList;
import static java.util.Collections.reverse;
import java.util.List;
import java.util.Scanner;

/**
 *
 * @author lenovo
 */
public class Main {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();

        List<Integer> list = new ArrayList<>();

        for (int i = 0; i < n; i++) {
            int a = scanner.nextInt();
            list.add(a);

        }
        // Collections.sort(list, Collections.reverseOrder());
        reverse(list);
        for (int i = 0; i < list.size(); i++) {
            Integer get = list.get(i);
            if (i == list.size()-1) {
                System.out.print(get);
            } else {
                System.out.print(get + " ");
            }
        }
        System.out.println();
    }

}

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

using namespace std;
#define inf 1000000000
#define unvisited -1
#define visited 1
#define eps 1e-9
#define mp make_pair
#define pb push_back
#define pi acos(-1.0)
#define uint64 unsigned long long
#define FastSlowInput ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define debug if(true)
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> ii;
typedef vector<ii> vii;

int a[200001];
int n,k;

bool can(int mid) {
	//harapannya bs panjangnya maks = mid
	int tot = 0;
	for(int i=0;i<n;i++){
		int banyak = a[i] / mid;
		if(a[i]%mid == 0){
			banyak--;
		}
		tot += banyak;
	}
	return tot <= k;
}

int main(){
	int i,j;
	scanf("%d %d",&n,&k);

	int maks = 0, minim = inf;
	for(i=0;i<n;i++){
		scanf("%d",&a[i]);
		maks = max(maks, a[i]);
		minim = min(minim, a[i]);
	}

	int kiri = 1, kanan = maks, mid, ans;
	while(kiri <= kanan){
		mid = (kiri+kanan)/2;
		// printf("mid: %d\n",mid);
		if(can(mid)) {
			ans = mid;
			kanan = mid-1;
		}else{
			kiri = mid+1;
		}
	}
	
	printf("%d\n",ans);
	return 0;
};

Measured memory_bytes: 4584
n = int(input())
lst =[list(map(int,input().split())) for i in range(2)]

ans = 0

for i in range(n):
    if i == 0:
        k1 = min(lst[0][i], lst[1][i])
        k2 = min(lst[0][i+1], lst[1][i] - k1)
        ans += k1 + k2
    else:
        k1 = min(lst[0][i] - k2, lst[1][i])
        k2 = min(lst[0][i+1], lst[1][i] - k1)
        ans += k1 + k2

print(ans)

Measured memory_bytes: 18624
//大文字->小文字 tolower(),逆はtoupper()
//int a = stoi(c); 文字列をintへ
//途中の出力をそのまま残さない
//数値計算 個数以外はdouble
//map<キー,値> p は辞書。p[キー] = 値
//map 全探索
//auto begin = p.begin(), end = p.end();
//for (auto it = begin; it != end; i++) {}
//mapのキー：it->first mapのバリュー：it->second
//絶対値 abs()
//入力は空白で切れる
//大文字判定 isupper(文字) 小文字判定 islower(文字)
//do{}while(next_permutation(ALL(配列)))
//while(N)で回すとき、Nはコピーを作っておく
#include <bits/stdc++.h>
#define rep(i,N) for(int i = 0; i < N;i++)
#define ALL(a) (a).begin(),(a).end()
#define ll long long int
using namespace std;

// K進数でのNの桁数
ll dig(ll N,ll K) {
	ll dig = 0;
	while (N) {
		dig++;
		N /= K;
	}
	return dig;
}
// x,yの最大公約数
ll gcd(ll x, ll y) {
	ll r;
	while (x%y) {
		r = x % y;
		x = y;
		y = r;
	}
	return y;
}

ll memo[87];
ll L(ll n) {
	if (n == 0)return 2;
	if (n == 1)return 1;
	if (memo[n] != 0)return memo[n];
	return memo[n] = L(n - 1) + L(n - 2);
}

int main() {
	ll N; cin >> N;
	cout << L(N) << endl;
}

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

const int MOD = (int)1e9+7;

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

	vector<string> ans={"Sunny","Cloudy","Rainy"};
	for(int i=0;i<3;i++){
		if(S==ans.at(i)){
			if(i!=2)	cout << ans.at(i+1) << endl;
			else	cout << ans.at(0) << endl;
		}
	}

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define re return
#define ll long long
#define ull unsigned ll
#define ld long double
#define f first
#define s second
#define pi acos(-1)
#define oo (ll)1e9
#define OO (ll)1e18
#define EPS 1e-7
#define FX(n) fixed<<setprecision(n)
#define mm(o,k) memset(o,k,sizeof o)
#define IO ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
using namespace std;
const int maxn=200005;

int main()
{
    IO;
    int n;
    cin >> n;
    if(n&1)n*=2;
    cout<<n<<endl;
    re 0;
}

Measured memory_bytes: 256
//%std
#include<bits/stdc++.h>
#define endl '\n'
using namespace std;
typedef long long ll;
inline int read()
{
	int out=0,fh=1;
	char jp=getchar();
	while ((jp>'9'||jp<'0')&&jp!='-')
		jp=getchar();
	if (jp=='-')
		fh=-1,jp=getchar();
	while (jp>='0'&&jp<='9')
		out=out*10+jp-'0',jp=getchar();
	return out*fh;
}
const int MAXN=2e5+10,K=30;
const int P1=1e9+7,P2=998244353;
int add(int a,int b,int P)
{
	return (a+b>=P)?(a+b-P):(a+b);
}
int mul(int a,int b,int P)
{
	return 1LL * a * b % P;
}
struct info
{
	int x,y;
	info(int x=0,int y=0):x(x),y(y) {}
	bool operator == (const info &rhs) const
	{
		return x==rhs.x && y==rhs.y;
	}
	info operator + (const info &rhs) const
	{
		return info(add(x,rhs.x,P1),add(y,rhs.y,P2));
	}
	info operator - (const info &rhs) const
	{
		return info(add(x,P1-rhs.x,P1),add(y,P2-rhs.y,P2));
	}
	info operator * (const info &rhs) const
	{
		return info(mul(x,rhs.x,P1),mul(y,rhs.y,P2));
	}
}pw[MAXN],Base;
int n,a[MAXN],b[MAXN];
int cnt[MAXN];
int main()
{
	Base=info(37,137);
	n=read();
	for(int i=0;i<n;++i)
		a[i]=read();
	for(int i=0;i<n;++i)
		b[i]=read();
	pw[0]=info(1,1);
	for(int i=1;i<=n;++i)
		pw[i]=pw[i-1]*Base;
	for(int p=0;p<K;++p)
	{
		info A=info(0,0),B=info(0,0);
		for(int i=0;i<n;++i)
			A=A*Base+info(a[i]>>p&1,a[i]>>p&1);
		for(int i=0;i<n;++i)
			B=B*Base+info(b[i]>>p&1,b[i]>>p&1);
		for(int k=0;k<n;++k)
		{
			if(A==B)
				++cnt[k];
			int x=a[k]>>p&1;
			A=A-info(x,x)*pw[n-1];
			A=A*Base;
			A=A+info(x,x);
		}
		A=info(0,0),B=info(0,0);
		for(int i=0;i<n;++i)
			A=A*Base+info(!(a[i]>>p&1),!(a[i]>>p&1));
		for(int i=0;i<n;++i)
			B=B*Base+info(b[i]>>p&1,b[i]>>p&1);
		for(int k=0;k<n;++k)
		{
			if(A==B)
				++cnt[k];
			int x=!(a[k]>>p&1);
			A=A-info(x,x)*pw[n-1];
			A=A*Base;
			A=A+info(x,x);
		}
	}
	for(int k=0;k<n;++k)
		if(cnt[k]==K)
			printf("%d %d\n",k,a[k]^b[0]);
	return 0;
}


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

int main() {
    int n;
    cin >> n;
    int p[n];
    vector<int> v;
    for (int i = 0; i < n; i++) {
        cin >> p[i];
        v.push_back(p[i]);
    }

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

    v[n-1] /= 2;

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


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

int main(){
    int m[10];
    for(int i=0; i<10; i++){
        cin>>m[i];
    }
    
    sort(m , m+10 ,greater<int>());
    
    for(int i=0; i<3; i++){
        cout << m[i] <<endl;
    }
    
    return 0;
}

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

using namespace std;

int
main(void){
	int n; cin >> n;
	vector<int> vec(100001);
	int a; 
	int ans = 0;
	for(int i = 0; i < n; i++){
		cin >> a;
		if(a <= 100000){
			vec[a]++;
		}
		else ans++;
	}
	for(int i = 1; i <= 100000; i++){
		if(vec[i] != i){
			if(vec[i] < i) ans += vec[i];
			else ans += (vec[i] - i);
		}
	}
	cout << ans;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (n); i++)
#define RREP(i, n) for (int i = (n); i >= 0; i--)
#define FOR(i, m, n) for (int i = (m); i < (n); i++)
#define ALL(obj) begin(obj), end(obj)
using namespace std;
using ll = long long;
using ull = unsigned long long;

const int INF = 2100100100;
const int MOD = 1e9 + 7;

ll N;
ll nt, nb;
ll c[10][10];

int main() {
    cin >> N;
    FOR(i, 1, N + 1) {
        string s = to_string(i);
        int size = s.size();
        int t = s[0] - '0';
        int b = s[s.size() - 1] - '0';
        c[t][b]++;
    }

    ll ans = 0;
    FOR(i, 1, 10) {
        FOR(j, 1, 10) { ans += c[i][j] * c[j][i]; }
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;

//Atcoder用


/*
 * BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] abc = br.readLine().split(" ");
		int a = Integer.parseInt(abc[0]);
		int b = Integer.parseInt(abc[1]);
		int c = Integer.parseInt(abc[2]);
 */
public class Main {
	public static void main(String[] args) throws IOException{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] abc = br.readLine().split(" ");
		int a = Integer.parseInt(abc[0]);
		int b = Integer.parseInt(abc[1]);
		int c = Integer.parseInt(abc[2]);

		List<Integer> ans = new ArrayList<Integer>(Arrays.asList(a,b,c));
		Collections.sort(ans);
		int i = ans.get(2)*10 + ans.get(1);
		System.out.println(i + ans.get(0));

	}
}

Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;


int main() {
    int n, m;
    cin >> n >> m;
    vector<vector<string>> a(n);
    while (m--) {
        int x;
        cin >> x; x--;
        string s;
        cin >> s;
        a[x].push_back(s);
    }

    int wa = 0;
    int ac = 0;
    for (auto x : a) {
        bool counts = false;
        int wrong = 0;
        for (int i = 0; i < (int)x.size(); i++) {
            if (x[i] == "WA") wrong++;
            else {
                counts = true;
                ac++;
                break;
            }
        }
        if (counts) wa += wrong;
    }

    cout << ac << " " << wa << endl;
    
	return 0;
}

Measured memory_bytes: 10256
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <numeric>
#include <string>
#include <cstdio>
#include <cstring>
#include <queue>
#include <stack>
#include <set>
#include <cmath>
#include <bitset>
#include <iomanip> 

using ll = long long;
using ull = unsigned long long;
using namespace std;

#define FALSE printf("false\n");
#define TRUE printf("true\n");
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int i = 0;(i) < ((int)(n));++(i))
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() )
#define test(a) cout<<"line:"<<__LINE__<<"["<<(#a)<<": "<<(a)<<"]"<<endl

const int INF = 1e9+7;
const ll INFL = 9*1e18;

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

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

ll inline digit(ll num){int tmp = 0;while(num){tmp++;num/=10;}return tmp;} // 桁数
template<typename T>inline void print(T&& x){cout<<x<<endl;}// 改行付き出力
template<typename T>inline T SUM(vector<T> vec){return accumulate(all(vec),(T)0);} // vectorの中身を全部足す
template<typename T>inline T digitSum(T num){T sum = 0;while(num){sum+=num%10;num/=10;}return sum;} // 各桁の和
template<typename T>inline T gcd(T a,T b){if(b == 0)return a;return gcd(b,a%b);} // 最大公約数
template<typename T>inline T lcm(T a, T b){T g = gcd(a,b);return a/g*b;} // 最小公倍数
template<typename T>inline T power(T a,T b){T tmp=1;rep(i,b){tmp*=a;}return tmp;} // 累乗
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; }
int ctoi(char c){return c-'0';}


// TODO: write
int main() {
  string s;cin>>s;
  int n = 0,m = 0;
  rep(i,s.size()){
    ((s[i] == '0')?n:m)++;
  }
  print(min(n,m)*2);
  return 0;
}

Measured memory_bytes: 3668
#include<iostream>
using namespace std;
int main(){
    int a,b,c;
    cin>>a>>b>>c;
    int five =0;
    int seven = 0;
    if(a==5)
        five++;
    else if(a==7)
        seven++;
    
    if(b==5)
        five++;
    else if(b==7)
        seven++;
    
    if(c==5)
        five++;
    else if(c==7)
        seven++;

    if(five == 2 && seven == 1)
        cout<<"YES";
    else
        cout<<"NO";
    
    return 0;
}

Measured memory_bytes: 3096
import java.util.Scanner;
import java.util.Iterator;
public class Main{
	public static void main(String[] args){
		Scanner input = new Scanner(System.in);
		int line=0;
		for(int i = 1;input.hasNext();i++){
			line = input.nextInt();
			if(line!=0){
				System.out.println("Case "+i+": "+line);
			}else{
				break;
			}
		}
	}
}

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

// #undef DEBUG  // Uncomment this line to forcefully disable debug print.
#if DEBUG
template <typename T>
void debug(T value) {
  std::cerr << value;
}
template <typename T, typename... Ts>
void debug(T value, Ts... args) {
  std::cerr << value << ", ";
  debug(args...);
}
#define dbg(...)                              \
  do {                                        \
    cerr << #__VA_ARGS__ << ": ";             \
    debug(__VA_ARGS__);                       \
    cerr << " (L" << __LINE__ << ")" << endl; \
  } while (0)
#else
#define dbg(...)
#endif

void read_from_cin() {}
template <typename T, typename... Ts>
void read_from_cin(T& value, Ts&... args) {
  std::cin >> value;
  read_from_cin(args...);
}
#define in(type, ...) \
  type __VA_ARGS__;   \
  read_from_cin(__VA_ARGS__);

template <typename T>
void write_to_cout(const T& value) {
  std::cout << value << std::endl;
}
template <typename T, typename... Ts>
void write_to_cout(const T& value, const Ts&... args) {
  std::cout << value << ' ';
  write_to_cout(args...);
}
#define out(...) write_to_cout(__VA_ARGS__);

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

using ll = long long;

using namespace std;

int main() {
  in(int, a, b);
  out(a * b - (a + b) + 1);
}


Measured memory_bytes: 3600
#include <bits/stdc++.h>
using namespace std;
  
int main(){
  int n,k; cin>>n>>k;
  int L[n];
  for(int i=0;i<n;i++){
    int l; cin>>l;
    L[i]=l;
  }
  sort(L,L+n);
  reverse(L,L+n);
  int ans=0;
  for(int i=0;i<k;i++){
    ans+=L[i];
  }
  cout<<ans<<endl; 
}

Measured memory_bytes: 256
N,K = map(int,input().split())
P = list(map(int,input().split()))

# T[i]に1からiまでの合計値が入っている
# M[i]にiの目があるさいころの期待値が入っている
# T = [0]
# M = [0]
# for j in range(1,1001):
#     T.append(j + T[j-1])
#     K.append(T[j]/j)
# 計算すると(n+1)/2


# M = [0]
# for j in range(1,1001):
#     M.append((j+1)/2)
# # print(K)

# PP = []
# for k in P:
#     PP.append(M[k])
# TEMP = []
ANS = 0
for i in range(N-K+1):
    # TEMP.append(sum(P[i:i+K]))
    if i == 0:
        TEMP = sum(P[i:i+K])
    else:
        TEMP = TEMP - P[i-1] + P[i+K-1]
    if TEMP > ANS:
        ANS = TEMP
# ANS = max(TEMP)
print((ANS+K)/2)



Measured memory_bytes: 25060
#include <bits/stdc++.h>
using namespace std;
#define rep(i, N) for(int i=0; i<N; i++)
typedef long long ll;
const long long INF = 1LL << 60;

int main() {
    int N; cin >> N;
    vector<int> a(N+2, -1);
    vector<vector<int>> x(N+2, vector<int>(N+2));
    vector<vector<int>> y(N+2, vector<int>(N+2));
    for(int i=1; i<=N; i++){
        cin >> a.at(i);
        for(int j=1; j<=a.at(i); j++){
            cin >> x.at(i).at(j) >> y.at(i).at(j);
        }
    }

    int cnt_max = 0;
    for(ll i=1; i<(1<<N); i++){
        bool ok = true;
        int cnt = 0;
        for(int j=1; j<=N; j++){
            if(i&(1<<j-1)){
                cnt++;
                for(int k=1; k<=a.at(j); k++){
                    if(y.at(j).at(k) ^ (1&(i>>(x.at(j).at(k)-1)))) ok = false;
                }
            }
        }
        if(ok){
            cnt_max = max(cnt, cnt_max);
        }
    }

    cout << cnt_max << endl;
    
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int a, b, c, k;
    cin >> a >> b >> c >> k;
    int j = 0;
    int sum = 0;
    while (j < k && a > 0)
    {
        sum++;
        j++;
        a--;
    }
    while (j < k && b > 0)
    {
        j++;
        b--;
    }
    while (j < k && c > 0)
    {
        sum--;
        c--;
        j++;
    }
    cout << sum << "\n";

    return 0;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
#define ALL(a) (a).begin(),(a).end()
#define rALL(a) (a).rbegin(),(a).rend()
typedef pair<int, int> Pint;
typedef pair<int64_t, int64_t> Pll;

void teiki(vector<vector<int>> &S, vector<bool> &check, int a, int re){
    check.at(a) = true;
    if (re == 2){
        return;
    }
    for (int j = 0; j < S.at(a).size(); j++) {
        teiki(S, check, S.at(a).at(j), re + 1);
    }
    return;
}

int main() {
    int N, M;
    cin >> N >> M;
    vector<vector<int>> S(N);
    for  (int i = 0; i < M; i++) {
        int a, b;
        cin >> a >> b;
        S.at(a - 1).emplace_back(b - 1);
    }
    vector<bool> check(N, false);
    int re = 0;
    teiki(S, check, 0, re);
    if (check.at(N - 1)) {
        cout << "POSSIBLE" << endl;
    }
    else {
        cout << "IMPOSSIBLE" << endl;
    }
}


Measured memory_bytes: 8576