akhauriyash/Code-Regression huggingface dataset:
#include <vector> 
#include <list> 
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <queue>
using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); }

//math
//-------------------------------------------
template<class T> inline T sqr(T x) { return x * x; }

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI = acos(-1.0);

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

//debug
#define dump(x)  cerr << #x << '=' << (x) << endl;
#define debug(x) cerr << #x << '=' << (x) << '('<<'L' << __LINE__ << ')' << ' ' << __FILE__ << endl;

const LL mod = 1e9 + 7;

int main() {
	int N, K;
	cin >> N >> K;
	vector<int> A(N+1);
	REP(i, N) {
		int a_;
		cin >> a_;
		A[a_] ++;
	}
	sort(ALL(A), greater<int>());
	int sum = 0;
	REP(i, (N < K) ? N : K) {
		sum += A[i];
	}
	cout << N - sum << endl;
}

Measured memory_bytes: 1024
import java.util.*;
import java.lang.*;
import java.math.*;
import java.io.*;

import static java.lang.Math.*;
import static java.util.Arrays.*;

public class Main{

	Scanner sc=new Scanner(System.in);

	int INF=1<<28;
	double EPS=1e-9;

	String e1, e2, e3;
	int x;

	void run(){
		for(; sc.hasNext();){
			String[] ss=sc.nextLine().split("[+]");
			e1=ss[0];
			ss=ss[1].split("=");
			e2=ss[0];
			e3=ss[1];
			solve();
		}
	}

	void solve(){
		for(x=0; x<10; x++){
			if(x==0){
				if(e1.length()>1&&e1.charAt(0)=='X')
					continue;
				if(e2.length()>1&&e2.charAt(0)=='X')
					continue;
				if(e3.length()>1&&e3.charAt(0)=='X')
					continue;
			}
			if(toBI(e1).add(toBI(e2)).compareTo(toBI(e3))==0){
				println(""+x);
				return;
			}
		}
		// x0+x0=x0
		println("NA");
	}

	BigInteger toBI(String s){
		BigInteger bi=BigInteger.ZERO;
		for(char c : s.toCharArray()){
			if(c=='X'){
				bi=bi.multiply(BigInteger.TEN).add(new BigInteger(""+x));
			}else{
				bi=bi.multiply(BigInteger.TEN).add(new BigInteger(""+c));
			}
		}
		return bi;
	}

	void debug(Object... os){
		System.err.println(Arrays.deepToString(os));
	}

	void print(String s){
		System.out.print(s);
	}

	void println(String s){
		System.out.println(s);
	}

	public static void main(String[] args){
		// System.setOut(new PrintStream(new BufferedOutputStream(System.out)));
		new Main().run();
	}
}

Measured memory_bytes: 12000
#include <iostream>
#include <cmath>

using namespace std;

int main() {
    int a, b;
    cin >> a >> b;

    double taxA = 0.08;
    double taxB = 0.1;

    pair<int, int> ta = {ceil(a / taxA), floor((a + 1) / taxA)};
    pair<int, int> tb = {ceil(b / taxB), floor((b + 1) / taxB)};

    if (ta > tb) swap(ta, tb);
    if (ta.first <= tb.first && tb.first < ta.second) {
        cout << tb.first;
    } else {
        cout << -1;
    }
    return 0;
}


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

int gcd(int a, int b)
{
  if(a < b) swap(a, b);
  int r = a%b;
  while(r != 0)
  {
    a = b;
    b = r;
    r = a%b;
  }
  return b;
}

int main()
{
  int n, start;
  cin >> n >> start;
  vector<int> x(n);
  vector<int> a(n);
  int i;
  for(i = 0; i < n; i++)
  {
    cin >> x.at(i);
    a.at(i) = abs(start-x.at(i));
  }
  int gc = a.at(0);
  for(i = 1; i < n; i++)
  {
    gc = gcd(gc, a.at(i));
  }
  cout << gc << endl;
}

Measured memory_bytes: 1024
from sys import stdout, stdin

n = int(stdin.readline())
ls = list(map(int, stdin.readline().split()))
dp = [0] * (n + 1)
if n == 1:
	print(0)
elif n == 2:
	print(abs(ls[1] - ls[0]))
else:
	dp[2] = abs(ls[1] - ls[0])
	for i in range(3, n+1):
		dp[i] = min(dp[i - 1] + abs(ls[i - 1] - ls[i - 2]), dp[i - 2] + abs(ls[i - 1] - ls[i - 3]))
	print(dp[n])


Measured memory_bytes: 85072
#include<stdio.h>
#include<stdlib.h>
#include<math.h>


int main()
{
int r,d,x,i;

scanf("%d %d %d",&r,&d,&x);

for(i=0;i<10;i++)
{
    x = r*x - d;
    printf("%d\n",x);
}

return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define pb push_back
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) FOR(i, 0, n)
#define ll long long
using namespace std;

const ll P = 1000000007;
int gcd(int a, int b) { return b != 0 ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a / gcd(a, b) * b; }

int main()
{
  cout << fixed << setprecision(10);
  string S;
  cin >> S;
  set<char> se;
  int N = S.size();
  rep(i, N)
  {
    se.insert(S[i]);
  }
  if (se.size() == 26)
  {
    cout << "None" << endl;
  }
  vector<char> vec(26);
  vec = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'};
  if (se.size() != 26)
  {
    rep(i, 26)
    {
      if (se.count(vec[i]))
      {
        continue;
      }
      else
      {
        cout << vec[i] << endl;
        break;
      }
      
    }
  }
  return 0;
}


Measured memory_bytes: 512
#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
char s[15];
int n;
void dfs(int x,int tp){
	if(x>n){
		for(int i=1;i<=n;i++)
		printf("%c",s[i]);
		printf("\n");
		return ;
	}
	for(int i=1;i<=tp;i++){
		s[x]='a'+i-1;
		dfs(x+1,tp);
	}
	s[x]='a'+tp;
	dfs(x+1,tp+1);
}
int main(void){
	scanf("%d",&n);
	s[1]='a';
	dfs(2,1);
	return 0;
}

Measured memory_bytes: 1536
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;

public class Main {

	static int n, m;
	static int[] l, r, d;

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		n = sc.nextInt();
		m = sc.nextInt();
		l = new int[m];
		r = new int[m];
		d = new int[m];
		List<Edge>[] edges = new ArrayList[n];
		for(int i = 0 ; i < n ; i++) edges[i] = new ArrayList<>();
		for(int i = 0 ; i < m ; i++) {
			l[i] = sc.nextInt() - 1;
			r[i] = sc.nextInt() - 1;
			d[i] = sc.nextInt();
			edges[l[i]].add(new Edge(r[i], d[i]));
			edges[r[i]].add(new Edge(l[i], -d[i]));
		}
		boolean ok = true;
		int[] x = new int[n];
		Arrays.fill(x, -Integer.MAX_VALUE);
		for(int i = 0 ; i < n ; i++) {
			if(x[i] == -Integer.MAX_VALUE) {
				x[i] = 0;
				ok &= dfs(i, x, edges);
			}
		}
		System.out.println(ok ? "Yes" : "No");
	}

	static boolean dfs(int i, int[] x, List<Edge>[] edges) {
		List<Edge> edge = edges[i];
		for(int j = 0 ; j < edge.size() ; j++) {
			int to = edge.get(j).to;
			int cost = edge.get(j).cost;
			if(x[to] == -Integer.MAX_VALUE) {
				x[to] = x[i] + cost;
				if(!dfs(to, x, edges)) return false;
			} else {
				if(x[i] + cost != x[to]) return false;
			}
		}
		return true;
	}

	static class Edge {
		int to, cost;
		Edge(int to, int cost) {
			this.to = to;
			this.cost = cost;
		}
	}
}


Measured memory_bytes: 179328
#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>
using namespace std;

/*BigInteger
#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/rational.hpp>
namespace xxx = boost::multiprecision;
using Bint = xxx::cpp_int;
using Real = xxx::number<xxx::cpp_dec_float<1024>>;
*/

#define int long long
#define pb(x) push_back(x)
#define m0(x) memset((x), 0LL, sizeof(x))
#define mm(x) memset((x), -1LL, sizeof(x))

//container
#define ALL(x) (x).begin(), (x).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define EACH(i, c) for (typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define EXIST(s, e) ((s).find(e) != (s).end())
#define UNIQUE(v) (v).erase(unique((v).begin(), (v).end()), (v).end());
#define PERM(c) \
  sort(ALL(c)); \
  for (bool c##p = 1; c##p; c##p = next_permutation(ALL(c)))

// debug
#define GET_VAR_NAME(variable) #variable
#define test(x) cout << GET_VAR_NAME(x) << " = " << x << endl;

// bit_macro
#define Bit(n) (1LL << (n))
#define Bitset(a, b) (a) |= (1LL << (b))
#define Bitunset(a, b) (a) &= ~(1LL << (b))
#define Bitcheck(a, b) ((((a) >> (b)) & 1LL) == 1LL)
#define Bitcount(a) __builtin_popcountll((a))

//typedef
typedef long long lint;
typedef unsigned long long ull;
typedef complex<long double> Complex;
typedef pair<int, int> P;
typedef tuple<int, int, int> TP;
typedef vector<int> vec;
typedef vector<vec> mat;

//constant
constexpr int INF = (int)1e18;
constexpr int MOD = (int)1e9 + 7;
constexpr double PI = (double)acos(-1);
constexpr double EPS = (double)1e-10;
constexpr int dx[] = {-1, 0, 0, 1, 0, -1, -1, 1, 1};
constexpr int dy[] = {0, -1, 1, 0, 0, 1, -1, 1, -1};

//
template <typename T>
void chmax(T &a, T b) { a = max(a, b); }
template <typename T>
void chmin(T &a, T b) { a = min(a, b); }
//
inline int toInt(string s) {
  int v;
  istringstream sin(s);
  sin >> v;
  return v;
}
template <class T>
inline string toString(T x) {
  ostringstream sout;
  sout << x;
  return sout.str();
}

//
struct Accelerate_Cin {
  Accelerate_Cin() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout << fixed << setprecision(20);
  };
} Accelerate_Cin;

int cnt1[26], cnt2[4], cnt3[2];

signed main() {
  int H, W;
  cin >> H >> W;
  char A;
  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) {
      cin >> A;
      cnt1[A - 'a']++;
    }
  }
  for (int i = 0; i < 26; i++) {
    cnt1[i] %= 4;
    cnt2[cnt1[i]]++;
  }
  cnt2[1] += cnt2[3];
  cnt2[2] += cnt2[3];
  if (cnt2[2] * 2 <= (H / 2) * 2 * (W % 2) + (W / 2) * 2 * (H % 2)) {
    if ((H % 2 && W % 2 && cnt2[1] == 1) || ((H % 2 == 0 || W % 2 == 0) && cnt2[1] == 0)) {
      cout << "Yes" << endl;
    } else
      cout << "No" << endl;
    return 0;
  }
  cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 256
///
// File:  1153.cpp
// Author: ymiyamoto
//
// Created on Thu Nov  9 18:23:50 2017
//

#include <cstdint>
#include <iostream>
#include <vector>

using namespace std;

int32_t main()
{
  while (true) {
    uint32_t n, m;
    cin >> n >> m;
    if (n == 0) break;

    vector<uint32_t> a;
    vector<uint32_t> b;
    uint32_t a_total = 0;
    uint32_t b_total = 0;
    for (uint32_t i = 0; i < n; i++) {
      uint32_t val;
      cin >> val;
      a.push_back(val);
      a_total += val;
    }

    for (uint32_t i = 0; i < m; i++) {
      uint32_t val;
      cin >> val;
      b.push_back(val);
      b_total += val;
    }

    int32_t a_index = -1;
    int32_t b_index = -1;
    int32_t total = -1;
    for (uint32_t i = 0; i < a.size(); i++) {
      for (uint32_t j = 0; j < b.size(); j++) {
        a_total -= a[i];
        a_total += b[j];

        b_total += a[i];
        b_total -= b[j];
        if (a_total == b_total) {
          if (total == -1 || (total > a[i] + a[j])) {
            a_index = i;
            b_index = j;
            total = a[a_index] + b[b_index];
          }
        }
        a_total += a[i];
        a_total -= b[j];

        b_total -= a[i];
        b_total += b[j];
      }
    }

    if (total == -1) {
      cout << -1;
    } else {
      cout << a[a_index] << " " << b[b_index];
    }
    cout << endl;
  }

  return 0;
}

Measured memory_bytes: 3100
import java.util.Scanner;

public class Main {

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

		String ans = (n == m) ? "Yes" : "No";

		System.out.println(ans);
        return;
    }

}



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

#define ll long long
const int mod = 1e9 + 7;

void solve() {
	int n, k;
	cin >> n >> k;
	vector<int> v(n);
	for (int i = 0; i < n; ++i)
		cin >> v[i];
	for (int i = k; i < n; ++i) {
		if (v[i] > v[i - k])
			cout << "Yes\n";
		else
			cout << "No\n";
	}
}

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

#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif

	int t = 1;
	// cin >> t;
	// int c = 1;
	while (t--) {
		// cout << "Case #" << c << ": ";
		solve();
		// c++;
	}
}

Measured memory_bytes: 3984
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String line = "";

		String s;
		while (!(line = br.readLine()).equals("0")) {
			s = Integer.toOctalString(Integer.parseInt(line));
			s = s.replace('7', '9');
			s = s.replace('6', '8');
			s = s.replace('5', '7');
			s = s.replace('4', '5');
			System.out.println(s);
		}
	}
}

Measured memory_bytes: 34016
#include <algorithm>
#include <cassert>
#include <cfloat>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <deque>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>

#define FOR(i,k,n) for (int (i)=(k); (i)<(n); ++(i))
#define rep(i,n) FOR(i,0,n)
#define all(v) begin(v), end(v)
#define debug(x) std::cerr<< #x <<": "<<x<<"\n"
#define debug2(x,y) std::cerr<< #x <<": "<< x <<", "<< #y <<": "<< y <<"\n"

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vector<int> > vvi;
typedef vector<ll> vll;
typedef vector<vector<ll> > vvll;
typedef deque<bool> db;
template<class T> using vv=vector<vector< T > >;

// cout vector
template<typename T> ostream& operator<<(ostream& s, const vector<T>& v) {
  int len = v.size(); s << "\n";
  for (int i = 0; i < len; ++i) {
    s << v[i]; if (i < len - 1) s << "\t";
  }
  s << "\n"; return s;
}

// cout 2-dimentional vector
template<typename T> ostream& operator<<(ostream& s, const vector< vector<T> >& vv) {
  int len = vv.size();
  for (int i = 0; i < len; ++i) { s << vv[i]; }
  return s;
}


int n, m;
vi a;

int main() {
  scanf("%d", &n);
  m = (1 << n);
  a.assign(m+1, 0);
  rep(i, m) {
    scanf("%d", &a[i]);
  }
  a[m] = 0;

  vvi bt(m, vi(2, m));
  rep (i, m) {
    bt[i][0] = i;
  }
  FOR (i, 1, m) {
    vi tmp;
    tmp.insert(tmp.end(), all(bt[i]));
    rep (j, n) {
      int tt = (1 << j);
      if ((i & tt) == 0) { continue; }
      tmp.insert(tmp.end(), all(bt[i-tt]));

      /*
      int k = i - tt;
      if (bt[i][1] >= bt[k][0]) {
      } else if (bt[i][0] >= bt[k][0]) {
        bt[i][1] = bt[k][0];
      } else { // bt[i][0] < bt[k][0]
        if (bt[i][0] >= bt[k][1]) {
          bt[i][1] = bt[i][0];
          bt[i][0] = bt[k][0];
        } else {
          bt[i][1] = bt[k][1];
          bt[i][0] = bt[k][0];
        }
      }
      */
    }
    sort(all(tmp), [](auto x, auto y) {
        return a[x] > a[y];
        });
    tmp.erase(unique(all(tmp)), tmp.end());
    bt[i][0] = tmp[0];
    bt[i][1] = tmp[1];
  }
  vi ans(m, 0);
  FOR (i, 1, m) {
    ans[i] = a[bt[i][0]] + a[bt[i][1]];
    ans[i] = max(ans[i], ans[i-1]);
    printf("%d\n", ans[i]);
  }

  return 0;
}


Measured memory_bytes: 19456
#include <bits/stdc++.h>
using namespace std;
using vec = vector<int>;
using intk = int64_t;

int main() {
int N;
  cin >>N;
  vec d(N);
  for(int i=0;i<N;i++) cin >> d[i];
	int s = N/2;
  int ans;
  sort(d.begin(),d.end());
  ans = d[s]-d[s-1];
  printf("%d\n",ans);
}
  


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

int A[3][3];

int main(){
	for(int i = 0; i < 3; i++)
		for(int j = 0; j < 3; j++) scanf("%d", &A[i][j]);
	int a[3], b[3];
	for(int i = 0; i < 3; i++) a[i] = min(A[i][0], min(A[i][1], A[i][2]));
	for(int i = 0; i < 3; i++) b[i] = A[0][i] - a[0];
	for(int i = 0; i < 3; i++)
		for(int j = 0; j < 3; j++)
			if(A[i][j] != a[i] + b[j]){
				printf("No\n");
				return 0;
			}
	printf("Yes\n");
	return 0;
}


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

/* メモリ食い過ぎ注意 */
#define int long long

typedef long long ll;

/* define const */
const ll INF = (1ll << 60);
const ll MOD = (ll)1e9 + 7;
/* end defineing */

signed main()
{
    int n;
    vector<string> v;
    string s;
    cin >> n;
    char en;

    bool f = true;
    for (int i = 0; i < n; i++)
    {
        cin >> s;
        for (int j = 0; j < v.size(); j++)
        {
            if (s == v[j])
            {
                // cout << "bbb:" << s << "," << v[j] << endl;
                f = false;
            }
        }
        if (i != 0)
        {
            if (s[0] != en)
            {
                // cout << "aaa;" << s << "," << en << endl;
                f = false;
            }
            en = s[s.length() - 1];
            v.push_back(s);
        }
        else
        {
            en = s[s.length() - 1];
            v.push_back(s);
        }
    }
    if (f)
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }
}


Measured memory_bytes: 256
n = int(input())
A = list(map(int, input().split()))
B = []
C = [0] * n
for i in reversed(range(n)):
    if sum(C[i::i+1]) % 2 != A[i]:
        B.append(i+1)
        C[i] += 1
print(len(B))
print(' '.join(map(str, B)))


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

using namespace std;

#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define fin(ans) cout << (ans) << endl;
#define blank(ans) cout << (ans) << " ";
#define mp(p, q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()

typedef long long ll;
typedef long long lli;
typedef unsigned long long ull;
typedef long double ld;
typedef string str;

typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<ld> vd;
typedef vector<str> vs;
typedef vector<ll> vll;
typedef vector<pair<ll, ll>> vpll;
typedef vector<pair<ll, str>> vpls;
typedef vector<tuple<str, ll, ll>> vtsl;
typedef vector<vector<ll>> vvll;
typedef vector<vector<char>> vvc;
typedef vector<vector<str>> vvs;

const ld PI = acos(-1.0);
const ll MAX = 9000000000000000000;
const ll MIN = -9000000000000000000;
const ld DMAX = 4500;
const ld DMIN = -4500;
const ll MOD = 1000000007;

//実行部
void Main()
{
  ll a, b, c; cin >> a >> b >> c;
  fin(a * b / 2)
}

//前処理
int main()
{
  //ios::sync_with_stdio(false);
  //cin.tie(0);
  cout << fixed << setprecision(20); //高精度少数表示
  Main();
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <limits>
using ll = long long;
constexpr int INF = std::numeric_limits<int>::max() / 2;
constexpr ll LNF = std::numeric_limits<ll>::max() / 2;

using namespace std;
int main() {
    int a, b;
    cin >> a >> b;
    if (b >= a) {
        cout << a << endl;
    } else {
        cout << a-1 << endl;
    }

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
 
using ll = long long int ;
 
 
int main(void){
	cin.tie(0);ios::sync_with_stdio(false);
 
    string week[] = {"SUN","MON","TUE","WED","THU","FRI","SAT"};
    string s;
    int ans = 0;

    cin >> s;

    auto w = find(&week[0], &week[6], s);
    if(w == &week[0]){
        ans = 7;
    }else{
        ans = 7 - (w - &week[0]);
    }

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

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

const int nxx=1e5+5;
int arr[nxx],dp[nxx];
int n;

long long cost(int i){
	if(i==n) return 0;

	else if(i>n) return (long long)1e18;
	if(dp[i]!=-1) return dp[i];
	long long ans=min((cost(i+1)+abs(arr[i+1]-arr[i])),(cost(i+2)+abs(arr[i+2]-arr[i])));

	return dp[i]=ans;
}
int main(){
	cin>>n;
	for(int i=1;i<=n;i++){
		cin>>arr[i];
	}
	memset(dp,-1,sizeof(dp));
/*	dp[n]=0;
	for(int i=n-1;i>=1;i--){
		if(i=n-1)dp[i]=dp[i+1]+abs(arr[i+1]-arr[i]);
		else dp[i]=min(dp[i+1]+abs(arr[i+1]-arr[i]),dp[i+2]+abs(arr[i+2]-arr[i]));
	}*/
	cout<<cost(1);
	return 0;
}

Measured memory_bytes: 7496
/*Whose woods these are I think I know.
His house is in the village though;
He will not see me stopping here
To watch his woods fill up with snow.
 
My little horse must think it queer
To stop without a farmhouse near
Between the woods and frozen lake
The darkest evening of the year.
 
He gives his harness bells a shake
To ask if there is some mistake.
The only other sound’s the sweep
Of easy wind and downy flake.
 
The woods are lovely, dark and deep,
But I have promises to keep,
And miles to go before I sleep,
And miles to go before I sleep.*/
 
#include<bits/stdc++.h>
using namespace std;
#define lli long long int
#define pb push_back
#define fi first
#define se second
#define MOD 1000000007
const int maxn= 100010;
lli a[2*maxn];
lli f[2*maxn];
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n=0;
    cin>>n;
    for(int i=2;i<=n;++i)
	{
		cin>>a[i];
		++f[a[i]];
	}
	for(int i=1;i<=n;++i)
	{
		cout<<f[i]<<endl;
	}	
}


Measured memory_bytes: 6736
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const long long MOD=1e9+7;

int main() {
  int n,m;
  cin>>n>>m;
  vector<int> num(n,-1);
  bool ans=true;
  rep(i,m){
    int s,c;
    cin>>s>>c;
    if(n!=1 && s==1 && c==0){
      ans=false;
      break;
    }
    
    if(num[s-1]==-1 || num[s-1]==c)
      num[s-1]=c;
    else{
      ans=false;
      break;
    }
  }
  
  if(!ans) cout<<"-1"<<endl;
  else{
    rep(i,n){
      if(num[i]==-1){
        if(i==0 && n>1) cout<<"1";
        else cout<<"0";
      }
      else cout<<num[i];
    }
    cout<<endl;
  }
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream> 
#include <string>
#include <vector>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <numeric>

using namespace std;
using ll = long long;

const ll INF = 1e9;
const ll MOD = 1e9 + 7;
int dx[4] = { 1,0,-1,0 };
int dy[4] = { 0,1,0,-1 };

int main()
{
	char s[15];

	cin >> s;

	cout << "2018/01/" << s[8] << s[9] << endl;
}

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

void solve(std::string O, std::string E){
    if (O.size() == E.size()) {
        REP(i, O.size())
            cout << O[i] << E[i];
        cout << '\n';
    } else {
        char c = O[O.size() - 1];
        REP(i, O.size() - 1)
            cout << O[i] << E[i];
        cout << c << '\n';
    }
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    std::string O;
    std::cin >> O;
    std::string E;
    std::cin >> E;
    solve(O, E);
    return 0;
}


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

#define ll long long
#define ld long double
typedef vector <ll> vi;                 // Vector of long long
typedef vector <vi> vvi;                // Vector of vi
typedef vector <pair<ll,ll>> ii;        // Vector of pairs
#define ff first                        // For pairs
#define ss second                       // For pairs
#define sz(a) int((a).size())           // Function to determine size of any container
#define pb push_back                    // Pushback to vector
#define mp make_pair                    // Makes pairs to be stored as pair
#define all(c) (c).begin(), (c).end()   // Mainly used by me in sorting
// ordered_set adds two new functions to set - (set).find_by_order([kth element based on zero indexing]) and order_of_key()
// order_of_key returns number of elements less that parameter. If element exists, that order is its index
#define ordered_set tree < ll ,  null_type ,  less<ll> ,  rb_tree_tag ,  tree_order_statistics_node_update >
#define MAX (ll)((3 * 1e3) + 5)

ll n;
vi arr;
ll dp[MAX][MAX][2];

ll solve(ll l, ll r, ll t)
{
    if (l > r)
        return 0;

    if (dp[l][r][t] == -1)
    {
        if (t == 0)
            dp[l][r][t] = max(solve(l + 1, r, t ^ 1) + arr[l], solve(l, r - 1, t ^ 1) + arr[r]);
        else
            dp[l][r][t] = min(solve(l + 1, r, t ^ 1) - arr[l], solve(l, r - 1, t ^ 1) - arr[r]);
    }
    return dp[l][r][t];
}

int main(void)
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    memset(dp, -1, sizeof(dp));
    cin >> n;
    arr.resize(n);
    for (int i = 0; i < n; i++)
        cin >> arr[i];

    cout << solve(0, n - 1, 0) << "\n";
}

Measured memory_bytes: 141568
#include <iostream>
#include <vector>
using namespace std;
int main(void){
  int a,b,c;
  cin >> a >> b >> c;
  
  int ans = 1;
  
  if(a != b)
    ans++;
  if(c != a && c != b)
    ans++;
  
  cout << ans << endl;
  
  return 0;
  
}

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

int main() {
  int N, Cnt;
  cin >> N ;
  
  for(int i = 0; i < N; i++){
    string A;
    cin >> A;
    
    if ( A == "Y"){
      cout << "Four" << endl;
      break; }
    else { Cnt ++ ;}
    
    if ( Cnt == N ){
    cout << "Three" << endl ;
    break;
    }    
   }
}


Measured memory_bytes: 256
#include <stdio.h>

int main(){
  int n,k,ans=0;
  scanf("%d %d",&n,&k);
  
  int h[n+1];
  for(int i=1;i<=n;i++){
    scanf("%d",&h[i]);
  }
  
  for(int i=1;i<=n;i++){
    if(h[i]>=k){
      ans+=1;
    }
  }
  printf("%d",ans);
  return 0;
}

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

#pragma GCC optimize "O3"
#define rep(i,a,n) for(long long i=a; i<n; i++)
typedef long long ll;
typedef pair<int,int> P;
const ll MOD = (int)1e9+7;
const ll INF = MOD*MOD;
const double EPS = 1e-9;
const ll powll = 1LL<<1;

/*
while(!frag && cin >> a >>b, a|b)
*/

int main(void){
   string s; cin >> s;
   cout << s;
   if(s[s.size()-1] == 's'){
       cout << "es\n";
   }else{
       cout << "s\n";
   }
}

Measured memory_bytes: 3624
#include<bits/stdc++.h>
//macros
using namespace std;
typedef long long ll;
typedef pair<int, int > P;
#define pb push_back
#define rep(i, a, b) for(ll i=(a); i<(b); i++)
const long long int mod = 1e9 + 7;


string s;
int main()
{
    cin >> s;
    ll cnt_g=0,res=0;
    rep(i,0,s.size()){
        if(s[i] == 'g'){
            if(cnt_g>0){
                cnt_g--;
                res++;
            }else{
                cnt_g++;
            }
        }else{
            if(cnt_g>0){
                cnt_g--;
            }else{
                cnt_g++;
                res--;
            }
        }
    }
    cout << res << endl;

}

Measured memory_bytes: 512
#include <bits/stdc++.h>
 
using namespace std;
 
int main() {
    int a, b, k;
    cin >> a >> b >> k;
    for (int i = a; i <= b; i++) {
        if (i < a + k || i > b - k) {
            cout << i << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }
//---------------------------------------------------------------------------------------------------
/*---------------------------------------------------------------------------------------------------
　　　　　　　　　　　 ∧＿∧  
　　　　　 ∧＿∧ 　（´<_｀ ）　 Welcome to My Coding Space!
　　　　 （ ´_ゝ`）　/　 ⌒i     
　　　　／　　　＼　 　 |　|     
　　　 /　　 /￣￣￣￣/　　|  
　 ＿_(__ﾆつ/　    ＿/ .| .|＿＿＿＿  
　 　　　＼/＿＿＿＿/　（u　⊃  
---------------------------------------------------------------------------------------------------*/




int N, M, A[1010];
int chk[1010];
//---------------------------------------------------------------------------------------------------
void _main() {
    cin >> N >> M;
    rep(i, 0, M) cin >> A[i];
    rep(i, 0, M) chk[A[i] - 1] = 1;

    int ans = 0;
    rep(i, 0, M) if (!chk[i]) ans++;
    cout << ans << endl;
}


Measured memory_bytes: 3184
#include<bits/stdc++.h>
using namespace std;
string st;
int main()
{
	cin>>st;
	for(int i=0;i<st.size();i++)
	{
		if(st[i]=='C')
		{
			for(int j=i+1;j<st.size();j++)
			  if(st[j]=='F')
			{
				cout<<"Yes";return 0;
			}
		}
	}
	cout<<"No";
	return 0;
}

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

using int64 = long long;
using AB = tuple<int, int64>; // (日数, 報酬)

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

    vector<AB> ABs;
    for (int i = 0; i < N; i++) {
        int a, b;
        cin >> a >> b;
        ABs.emplace_back(a, b);
    }

    // 必要日数の降順
    sort(ABs.begin(), ABs.end(), greater<AB>());

    priority_queue<int64> rewards;
    int64 ans = 0;

    for (int d = 1; d <= M; d++) {
        while (!ABs.empty() && get<0>(ABs.back()) <= d) {
            rewards.push(get<1>(ABs.back()));
            ABs.pop_back();
        }

        if (!rewards.empty()) {
            ans += rewards.top();
            rewards.pop();
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3568
sx,sy,tx,ty=map(int,input().split())
for _ in range(ty-sy): print("U",end="")
for _ in range(tx-sx): print("R",end="")
for _ in range(ty-sy): print("D",end="")
for _ in range(tx-sx+1): print("L",end="")
for _ in range(ty-sy+1): print("U",end="")
for _ in range(tx-sx+1): print("R",end="")
print("DR",end="")
for _ in range(ty-sy+1): print("D",end="")
for _ in range(tx-sx+1): print("L",end="")
print("U")

Measured memory_bytes: 9152
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;
typedef long long ll;
#define rep(i, a, b) for (int i = a; i < b; i++)
int main()
{
    int n;
    cin >> n;
    vector<string> s(n);

    rep(i, 0, n)
    {
        cin >> s[i];
    }
    vector<char> ans;

    //  全ての文字列に含まれるアルファベットを取り出す. (重複あり)
    int s0len = s[0].length();
    rep(i, 0, s0len)
    {
        int flg = 1;
        char c = s[0].at(i);
        int idx = 0;
        // cout << "c:" << c << endl;
        rep(j, 1, n)
        {
            rep(k, 0, s[j].length())
            {
                if (s[j].at(k) == c)
                {
                    flg++;
                    break;
                }
            }
        }
        if (flg == n)
        {
            rep(j, 1, n)
            {
                idx = 0;
                rep(k, 0, s[j].length())
                {
                    if (c == s[j].at(k))
                    {
                        idx = k;
                    }
                }
                s[j].erase(idx, 1);
            }
            ans.push_back(c);
        }
    }

    //  取り出したアルファベットを辞書順に並べる
    sort(ans.begin(), ans.end());
    rep(i, 0, ans.size())
    {
        cout << ans[i];
    }
    cout << endl;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<math.h>
#include<string>
#include<algorithm>
#include<functional>
#include<vector>
#include<set>
#include<map>
#define INF 999999
#define EPS 1.0e-6

using namespace std;

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

int h, w;
int alp[28];

int main()
{
	cin >> h >> w;
	char a;
	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) {
			cin >> a;
			int k = a - 'a';
			alp[k]++;
		}
	}
	int f = 0;
	int t = 0;
	int o = 0;
	while (h >= 2&&w >= 2) {
		int k = h / 2;
		int m = w / 2;

		f += 1 + (k - 1) + (m - 1);
		t += h - k * 2 + w - m * 2;

		h -= 2;
		w -= 2;

	}
	if (h == 1) {
		t += w / 2;
		o += w % 2;
	}
	else if (w == 1) {
		t += h / 2;
		o += h % 2;
	}
	
	int ope = 0;
	for (int i = 0; i < 26; i++) {
		while (alp[i] >= 4&&f>0) {
			alp[i] -= 4;
			f--;
		}
		while (alp[i] >= 2 && t > 0) {
			alp[i] -= 2;
			t--;
		}
		while (alp[i] > 0 && o > 0) {
			alp[i]--;
			o--;
		}
		if (alp[i] != 0)ope++;
	}
	if (ope == 0) {
		if (f == 0 && t == 0 && o == 0) {
			cout << "Yes" << endl;
		}
	}
	else cout << "No" << endl;
	return 0;
}

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

using namespace std;

const int MAXN = 1e5 + 5;
int a[MAXN];
int b[MAXN];
int c[MAXN];
int dp[MAXN][3];
int n;

int main()
{
    cin >> n;
    for(int i = 0; i < n; i++){
        cin >> a[i] >> b[i] >> 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][1], dp[i - 1][0]) + c[i];
    }
    cout << max(max(dp[n - 1][0], dp[n - 1][1]), dp[n - 1][2]);
}


Measured memory_bytes: 2560
#include <iostream>
#include <cmath>
#include <vector>
#include <bitset>
#include <string>
#include <utility>
#include <queue>
#include <algorithm>
#include<set>
using namespace std;
long long int mpown(long long int m, int n);
long long int bign=1000000007;
int bitCount(int bits);

int main()
{
    long long int n,m,k;
    cin >> n >> m >> k;
    // vector<vector<long long int>> comb(n*m,vector<long long int>(k-1,0));
    // vector<long long int> comb(max(n,m));
    long long int comb = 1;
    if(k!=2){
    vector<long long int> inv(k-1);
    inv.at(1)=1;
    // cout << "a"<<endl;
    for(int i=2;i<k-1;i++){
        inv.at(i) = bign-inv.at(bign%i)*(bign/i)%bign;
    }
    
    
    for(int i=1;i<=k-2;i++){
        comb = (((comb*(n*m-2-i+1))%bign)*inv.at(i))%bign;
    }
    }
    long long int ans=0;
    long long int temp=0;
    // comb.at(0).at(0)=1;
    // for(long long int i=1;i<n*m-1;i++){
    //     for(long long int j=0;j<=min(k-2,i);j++){
    //         // cout << "a " << endl;
    //         comb.at(i).at(j)=(j>0? (comb.at(i-1).at(j-1)+comb.at(i-1).at(j))%bign:comb.at(i-1).at(j));
    //         // cout << i << "," << j << "," << comb.at(i).at(j) << endl;
    //     }
    // }


    for(int d=1;d<=n-1;d++){
        
        temp = ((((((comb*d)%bign)*m)%bign)*m)%bign)*(n-d);
        temp %= bign;
        ans=(ans+temp)%bign;
    }
    for(int d=1;d<=m-1;d++){
        temp = ((((((comb*d)%bign)*n)%bign)*n)%bign)*(m-d);
        temp %= bign;
        ans=(ans+temp)%bign;
    }
    cout << ans << endl;
    
    return 0;
}

int bitCount(int bits)
{
    bits = (bits & 0x55555555) + (bits >> 1 & 0x55555555); //  2bitごとに計算
    bits = (bits & 0x33333333) + (bits >> 2 & 0x33333333); //  4bitごとに計算
    bits = (bits & 0x0f0f0f0f) + (bits >> 4 & 0x0f0f0f0f); //  8bitごとに計算
    bits = (bits & 0x00ff00ff) + (bits >> 8 & 0x00ff00ff); //  16ビットごとに計算
    return (bits & 0x0000ffff) + (bits >> 16);             //  32ビット分を計算
}
long long int mpown(long long int m, int n)
{
    if (n == 0)
        return 1;
    else if (n == 1)
        return m;
    else
    {
        long long int temp = mpown(m, n / 2);
        return temp * temp * (n & 1 ? m : 1);
    }
}

Measured memory_bytes: 4280
#include <stdio.h>

int main(void){
	int a,b,c,d,n,i,max,min,sign1=0,sign2=0;
	
	scanf("%d %d %d %d %d",&n,&a,&b,&c,&d);
	
	char s[n];
	
	scanf(" %s",s);
	
	if(c>d){
		max=c;
		min=d;
	}else{
		max=d;
		min=c;
	}
	
	for(i=a-1;i<=d-1;i++){
		if(s[i]=='#'&&s[i+1]=='#'){
			sign1=1;
		}
	}
	
	for(i=b-2;i<=min-2;i++){
		if(s[i]=='.'&&s[i+1]=='.'&&s[i+2]=='.'){
			sign2=1;
		}
	}
	
	if(c<d&&sign1==0){
		printf("Yes\n");
	}else if(sign1==0&&sign2==1){
		printf("Yes\n");
	}else{
		printf("No\n");
	}
	
}

Measured memory_bytes: 384
#!/usr/bin/env python3
import sys
sys.setrecursionlimit(300000)


def solve(N: int, T: int, A: "List[int]"):
    mx = 0
    mn = float('inf')
    ret = 0
    for a in A:
        if a < mn:
            mn = a
        if a - mn > mx:
            mx = a - mn
            ret = 1
        elif a - mn == mx:
            ret += 1
    print(ret)
    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    T = int(next(tokens))  # type: int
    A = [ int(next(tokens)) for _ in range(N) ]  # type: "List[int]"
    solve(N, T, A)

if __name__ == '__main__':
    main()


Measured memory_bytes: 15988
N, W = map(int, input().split())
I = [list(map(int, input().split())) for _ in range(N)]
MAX_V = sum(v for v, _ in I)

dp = [W+1] * (MAX_V + 1)
dp[0] = 0
for v, w in I:
    for j in range(MAX_V, v-1, -1):
        dp[j] = min(dp[j-v] + w, dp[j])
        
for i in range(MAX_V, -1, -1):
  if dp[i] <= W:
    print(i)
    break



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

int main(){
  int A, B, C;
  cin >> A >> B >> C;

  bool ok = false;
  for (int i = 1; i <= B; i++)
  {
    if (A * i % B == C){
      ok = true;
      break;
    }

  }
    
  cout << (ok ? "YES" : "NO") << endl;
}

Measured memory_bytes: 3600
//#include <bits/stdc++.h>
#include <iostream>
#include<cstdio>
#include<vector>
#include<string>
#include<algorithm>
#include<sstream>
#include<queue>
#include<set>
#include<map>
#include<stack>
#define i64 long long
#define vi32 vector<int>
#define vi64 vector<long long>
#define  ii pair<int,int>
const long long mod = 1000000007LL, inf = 1e9, linf = 1e18;
using namespace std;
#define pb push_back
#define mp make_pair
#define N 100005	
using namespace std;
i64 a, b;

int main()
{
	cin >> a >> b;
	cout << (a * 3 + b) / 2;
}



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

int main(void){
     
     int i,j;
     int A,B,C,D;
     int sum;

    scanf("%d\n",&A);
    scanf("%d\n",&B);
    scanf("%d\n",&C);
    scanf("%d",&D);

    if(A > B){
        sum = B;
    }else{
        sum = A;
    }
    if(C>D){
        sum +=D;
    }else{
        sum += C;
    }
    printf("%d\n",sum);
}

Measured memory_bytes: 128
#include <bits/stdc++.h>  //2fat2code a.k.a grandmixer420
#define ll long long
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#define all(a) (a).begin(), (a).end()
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define sz size
#define fr first
#define sc second
#define pb push_back
#define er erase
#define in insert
#define mp make_pair
#define pi pair
#define rc(s) return cout<<s,0
#define int long long
using namespace std;

int n,m,a[100005],ans;
vector<int>p;

int32_t main(){
    ios_base :: sync_with_stdio(0); cin.tie(); cout.tie();
    cin >> n >> m;
    n=min(n,m);
    for(int i=1;i<=m;i++) cin >> a[i];
    sort(a+1,a+m+1);
    for(int i=1;i<m;i++){
        p.push_back(a[i+1]-a[i]);
    }
    sort(all(p));
    int ans=0;
    for(int i=0;i<p.size()-n+1;i++){
        ans+=p[i];
    }
    cout<<ans;
}


Measured memory_bytes: 2168
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define fast ios::sync_with_stdio(0);cin.tie(0);
using namespace std;



int main() {
    fast
 ll x;
    cin >> x;
 
    for(ll a = -118; a < 120 ; a++){
        for(ll b = -119; b < 119; b++){
            ll A = a*a*a*a*a;
            ll B = b*b*b*b*b;
            if(A - B == x){
                cout << a << " " << b << endl;
                return 0;
            } 
        }
    }
return 0;
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<P,int> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-8;
const ll mod=1e9+7;
const int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};

int main(){
	int res=700;
	for(int i=0;i<3;i++){
		char c;
		cin>>c;
		if(c=='o') res+=100;
	}
	cout<<res<<endl;
}

Measured memory_bytes: 256
#define DEBUG
#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;
 
#define F first
#define S second 
#define pb push_back
#define endl "\n"

#define IOS { ios :: sync_with_stdio(false); cin.tie(0); cout.tie(0); }

#ifdef DEBUG
    #define dbg(s) {s;}
#endif

#ifndef DEBUG
    #define dbg(s)
#endif

using namespace std;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int grand(int x) { // from [0, x-1]
    return uniform_int_distribution<int>(0, x - 1)(rng);
}

#define int ll
#define i32 int32_t

#define RBTTYPE int
#define ordered_set tree<RBTTYPE, null_type, less<RBTTYPE>, rb_tree_tag,tree_order_statistics_node_update> 

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

typedef long long ll;
typedef long double ld;
typedef pair< int, int > pii;
typedef pair< ll, ll > pll;

int getInt () {
    bool minus = false;
    int result = 0;
    char ch;
    ch = getchar();
    while (true) {
        if (ch == '-') break;
        if (ch >= '0' && ch <= '9') break;
        ch = getchar();
    }
    if (ch == '-') minus = true; else result = ch-'0';
    while (true) {
        ch = getchar();
        if (ch < '0' || ch > '9') break;
        result = result*10 + (ch - '0');
    }
    if (minus)
        return -result;
    else
        return result;
}


ll gcd(ll x, ll y) {
    if (x < y) return gcd(y, x);
    if (y == 0) return x;
    return gcd(y, x % y);
} 

const ll mod = 1e9 + 7;

ll modexp(ll x, ll ex) {
    ll ans = 1ll;
    while (ex > 0) {
        if (ex & 1ll) ans = (ans * x) % mod;
        ex >>= 1ll;
        x = (x * x) % mod;
    }
    return ans;
}

const int maxn = 50000;

const ll inf = 1e9 + 7;


i32 main() {
    //freopen("<file>.in", "r", stdin);
    //freopen("<file>.out", "w", stdout);

    IOS;

    int n;
    cin>>n;

    int val;
    for(int x=1;x<=maxn;x++)
    {
        val = x*8;
        val/=100;

        val+=x;
        if(val==n)
        {
            cout<<x<<endl;
            return 0;
        }
    }
    

    cout<<":("<<endl;
    
}





Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repr(i, n) for (int i = (n); i >= 0; --i)
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define FORR(i, m, n) for (int i = (m); i >= (n); --i)
#define equals(a, b) (fabs((a) - (b)) < EPS)
using namespace std;
typedef long long ll;
typedef long double ld;
const ll mod = 1000000007;
const ll mod2 = 998244353;
const int inf = 1e9 + 10;
const ll INF = 1e18;
const ld EPS = 1e-10;
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};

ll ndat;
vector<ll> dat;

void rmg_init(ll n_) {
  ndat = 1;
  while (ndat < n_) ndat *= 2;
  dat.resize(2 * ndat - 1, -1);
}

void update(ll k, ll a) {
  k += ndat - 1;
  dat[k] = a;
  while (k > 0) {
    k = (k - 1) / 2;
    dat[k] = max(dat[k * 2 + 1], dat[k * 2 + 2]);
  }
}

ll query(ll a, ll b, ll k, ll l, ll r) {
  if (r <= a || b <= l) return -1;
  if (a <= l && r <= b) return dat[k];
  else {
    ll vl = query(a, b, k * 2 + 1, l, (l + r) / 2);
    ll vr = query(a, b, k * 2 + 2, (l + r) / 2, r);
    return max(vl, vr);
  }
}

int main() {
  ll n;
  cin >> n;
  vector<pair<ll, ll>> r(n);
  rep(i, n) cin >> r[i].first >> r[i].second;

  sort(r.begin(), r.end());
  vector<ll> x(n), d(n);
  rep(i, n) x[i] = r[i].first, d[i] = r[i].second;
  vector<ll> nxt(n);
  rmg_init(n);
  repr(i, n - 1) {
    ll res = lower_bound(x.begin(), x.end(), x[i] + d[i]) - x.begin();
    update(i, res);
    nxt[i] = query(i, res, 0, 0, ndat);
    update(i, nxt[i]);
  }
  vector<ll> dp(n + 1, 0);
  dp[n] = 1;
  repr(i, n - 1) {
    dp[i] = (dp[i + 1] + dp[nxt[i]]) % mod2;
  }
  cout << dp[0] << endl;
  





  
  return 0;
}

Measured memory_bytes: 13696
#include <algorithm>
#include <bits/stdc++.h>
#include <cstdint>
#include <iostream>
#include <iterator>
#include <vector>

// lib/util.hpp
#ifndef UTIL_HPP
#define UTIL_HPP


typedef ::std::int_fast64_t i64;
typedef ::std::uint_fast64_t u64;
typedef ::std::int_fast32_t i32;
typedef ::std::uint_fast32_t u32;

namespace tools {
  template <typename T>
  void read(::std::istream& is, ::std::vector<T>& vector, const typename ::std::vector<T>::size_type size) {
    vector.reserve(size);
    ::std::copy_n(::std::istream_iterator<T>(is), size, ::std::back_inserter(vector));
  }
  template <typename T>
  void read(::std::vector<T>& vector, const typename ::std::vector<T>::size_type size) {
    ::tools::read(::std::cin, vector, size);
  }

  template <typename T, ::std::size_t N>
  void read(::std::istream& is, ::std::array<T, N>& array) {
    ::std::copy_n(std::istream_iterator<T>(is), N, array.begin());
  }
  template <typename T, ::std::size_t N>
  void read(::std::array<T, N>& array) {
    ::tools::read(::std::cin, array);
  }
}

#endif

// main.cpp

int main() {
  i64 N, M;
  std::cin >> N >> M;
  std::vector<i64> A;
  tools::read(A, N);

  std::priority_queue<i64> queue(A.begin(), A.end());
  for (i64 i = 0; i < M; ++i) {
    const i64 A_i = queue.top();
    queue.pop();
    queue.push(A_i / 2);
  }

  i64 answer = 0;
  while (!queue.empty()) {
    answer += queue.top();
    queue.pop();
  }

  std::cout << answer << std::endl;
  return 0;
}

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

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

	for(char c = 'a';c <= 'z';c++){
		bool found = false;
		for(int i = 0;i < s.length();i++){
			if(s[i] == c){
				found = true;
			}
		}
		if(!found){
			cout << c << endl;
			return 0;
		}
	}
	cout << "None" << endl;
	return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
int main() {
  int A;
  string S;
  cin >> A>> S;
  
  if(A % 2 == 1){
    cout << "No" << endl;
  }
  
  else{
    
  int count = 0;
  
  for(int i = 0;i < A / 2; i++){
    if(S.at(i) == S.at(A / 2 + i)){
      count++;
    }
  }
  
  if(count == A / 2){
    cout << "Yes" << endl;
  }
  else{  
    cout << "No" << endl;
  }
  }
}
 

Measured memory_bytes: 256
#include<iostream>
using namespace std;
const int N=200005;
int a[N];
long long cnt[N];
bool vis[N];
void solve()
{
	int n;
	cin>>n;
	int i;
	long long sum=0;
	for(i=1;i<=n;i++) 
	{
		cin>>a[i];
		cnt[a[i]]++;
	}
	for(i=1;i<=n;i++)
	{
		if(vis[a[i]]) continue;
		sum=sum+cnt[a[i]]*(cnt[a[i]]-1)/2;
		vis[a[i]]=1;
	}
	for(i=1;i<=n;i++)
	{
		//减去所有a[i]的贡献，加上cnt[a[i]]-1个a[i]的贡献 
		printf("%lld\n",sum-cnt[a[i]]*(cnt[a[i]]-1)/2+(cnt[a[i]]-1)*(cnt[a[i]]-2)/2);
	}
}
int main()
{
	solve();
	return 0;
}


Measured memory_bytes: 4096