akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstdio>
#include <cmath>
#include <string>
#include <cstring>
#include <algorithm>
#include <iomanip>
#include <cstdlib>
#include <cctype>
#define ll long long
#define PI 3.14159265358979323846
using namespace std;
const int maxn = 1e6+7;

struct Infor{
	ll dam;
	bool iswield;
}infor[200010];

bool cmp(Infor a,Infor b) {
	if(a.dam>b.dam) {
		return true;
	} else {
		return false;
	}
}

int main(){
	ll n,h;
	cin>>n>>h;
//	Infor *infor=new Infor[2*n+1];
	ll a,b;
	for(ll i=0;i<2*n;i+=2){
		cin>>a>>b;
		infor[i].dam=a;
		infor[i+1].dam=b;
		infor[i].iswield=true;
		infor[i+1].iswield=false;
	}
	sort(infor,infor+2*n,cmp);
	
//	for(ll i=0;i<2*n;i++){
//		cout<<infor[i].dam<<endl;
//	}
	
	ll sum=0;
	ll cnt=0;
	for(ll i=0;i<2*n;i++){
		if(infor[i].iswield==true){
			cnt+=ceil((double)(h-sum)/infor[i].dam);
			sum=1e9;
		}
		else{
			sum+=infor[i].dam;
			cnt++;
		}
		if(sum>=h){
			cout<<cnt<<endl;
			break;
		}
	}
	return 0;
}


Measured memory_bytes: 3456
#include<bits/stdc++.h>
#define ll long long int
using namespace std;
int main()
{
    int n,m,c,val;
    cin>>n>>m>>c;
    int a[n][m];
    vector<int> b;
    int sum=0;
    for(int i=0;i<m;++i)
    {
        cin>>val;
        b.push_back(val);
    }
    int c1=0;
    for(int i=0;i<n;++i)
    {
        sum=0;
        for(int j=0;j<m;++j)
        {
            cin>>a[i][j];
        }
        for(int j1=0;j1<m;++j1)
        {
            sum+=(a[i][j1]*b[j1]);
        }
        sum+=c;

        if(sum>0)
            c1++;
    }
    cout<<c1<<endl;
}


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

int main(){
    int a,b,c;
    int n=0;
    cin>>a>>b>>c;
    
    for(int x=a;x<=b;x++){
        if(c%x==0)n++;
    }
    
    cout<<n<<endl;
    
    return 0;
}


Measured memory_bytes: 3084
# coding: utf-8

N = int(input())

pushed = []
button = [0] * (N + 1)

for i in range(1, N+1):
    button[i] = int(input())

push_button = 1
for _ in range(1, N+1):
    if push_button == 2:
        print(len(pushed))
        exit(0)
    else:
        pushed.append(push_button)
        push_button = button[push_button]

print("-1")


Measured memory_bytes: 13712
// #pragma GCC optimize(3, "Ofast", "inline")
#include <bits/stdc++.h>
#define String std::string
#define fi first
#define se second
#define mp std::make_pair
#define Pair std::pair<int, int>
#define Map std::map< int, int >
#define Vector std::vector<int>
#define LEAD (lead && !i)
#define LIM (lim && i == buc[pos])
 
using std::cin;
using std::cout;
using std::endl;
 
typedef long long ll;
typedef unsigned long long ull;
 
const int N = 100000 + 5;
const int M = 1000 + 5;
const int K = 1e7 + 5;
const int MOD = 1e9 + 7;
const int inv2 = 500000004;
const int LOG = 40;
const ull BASE = 19260817;
const int INF = 0x3f3f3f3f;
const int dx[] = { 0, 1, -1, 0, 1, -1, 1, -1 };
const int dy[] = { 1, 0, 0, -1, 1, -1, -1, 1 };
// const double PI = acos(-1);
const double PI = 3.14159;

template<typename T> inline bool chkmin(T &a, const T &b) { return a > b ? a = b, 1 : 0; }
template<typename T> inline bool chkmax(T &a, const T &b) { return a < b ? a = b, 1 : 0; }
 
template<class T>
inline T readT() {
    T res = 0, f = 1;
    char ch = getchar();
    for (; !isdigit(ch); ch = getchar()) if (ch == '-') f = -1;
    for (; isdigit(ch); ch = getchar()) res = (res << 1) + (res << 3) + ch - '0';
    return res * f;
}
#define read readT<int>

namespace Comb{
const int N = 10 + 5;
inline void exgcd(ll a, ll b, ll &g, ll &x, ll &y) {
    if (!b) g = a, x = 1, y = 0;
    else exgcd(b, a % b, g, y, x), y -= x * (a / b);
}
 
inline ll inv(ll a) {
    ll g, res, tmp;
    exgcd(a, MOD, g, res, tmp);
    return ((res % MOD) + MOD) % MOD;
}
 
ll f[N], invFact[N];
 
inline void prepare() {
    f[0] = 1;
    int n = 200000;
    for (int i = 1; i <= n; i++) f[i] = f[i - 1] * i % MOD;
    invFact[n] = inv(f[n]);
    for (int i = n - 1; i >= 1; i--) invFact[i] = invFact[i + 1] * (i + 1) % MOD;
}
 
inline ll C(int n, int m) {
    if (!m) return 1;
    if (n == m) return 1;
    if (m > n) return 0;
    if (m < 0) return 0;
    return f[n] * invFact[m] % MOD * invFact[n - m] % MOD;
}
}

int n, ans;
Pair a[N];

int main() {
    cin >> n;
    for (int i = 1; i <= n; i++) {
        scanf("%d", &a[i].fi);
        a[i].se = i;
    }
    std::sort(a + 1, a + n + 1);
    for (int i = 1; i <= n; i++) {
        // printf("%d %d %d\n", i, a[i].se, a[i].fi);
        ans += (a[i].se % 2 == 0 && i % 2 != 0);
    }
    printf("%d\n", ans);
    return 0;
}

Measured memory_bytes: 1152
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main(){

    input!{
        n: usize,
        a: [usize;n],
    }

    let mut flag: bool = true;
    for value in a{
        if value % 2 == 0{
            if value % 3 != 0 && value % 5 != 0{
                flag = false;
            } 
        }
    }
    if flag == true {
        println!("APPROVED");
    } else {
        println!("DENIED");
    }

}

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

using namespace std;

int main() {
  int N, M;
  cin >> N;
  vector<string> s(N);
  
  
  for (int i=0; i < N; i++) {
    cin >> s.at(i);
  }
  cin >> M;
  vector<string> t(M);
  for (int i=0; i < M; i++) {
    cin >> t.at(i);
  }
  
  vector<string> uniq_string;
  vector<int> num_string;
  
  for (int i=0; i < N; i++) {
    string cur_s = s.at(i);
    int found = 0;
    for (int j=0; j < uniq_string.size(); j++) {
      if (cur_s == uniq_string.at(j)) {
        num_string.at(j) += 1;
        found = 1;
        break;
      }
    }
    
    if (found == 0) {
      uniq_string.push_back(cur_s);
      num_string.push_back(1);
    }
  }
  
  for (int i=0; i < M; i++) {
    string cur_t = t.at(i);
    for (int j=0; j < uniq_string.size(); j++) {
      if (cur_t == uniq_string.at(j)) {
        num_string.at(j) -= 1;
        break;
      }
    }
  }
  
  int max = 0;
  for (int i=0; i < num_string.size(); i++) {
    if (max < num_string.at(i)) {
      max = num_string.at(i);
    }
  }
  
  cout << max << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
using namespace std;
 char d[5] ;
  int a[4]; 
int main(){
  
  for(int i=0;i<4;i++){cin>>d[i];a[i]=d[i]-'0';}
  for(int x=0;x<8;x++){
    int sum=a[0];
    string s; 
    s+=char ('0'+a[0]);
    for(int i=0;i<3;i++){
      if(x &(1<<i)){
        sum+=a[1+i];
        s+='+';
        s+=char('0'+a[i+1]);
      }
      else{
        sum-=a[i+1];
        s+='-';
        s+=char('0'+a[i+1]);
      }
    }
    if(sum==7){cout<<s<<"=7"<<endl;
               return 0;
    }
  }
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define sz(c)      int(c.size())
#define rep(i,a,b) for (int i=a; i<(b); ++i)
#define per(i,a,b) for (int i=(b)-1; i>=(a); --i)
using namespace std;
using ll = long long;

struct DSU {
	vector<int> r;
	DSU(int n):r(n,-1) {}
	int get(int x) {
		return r[x]<0 ? x : r[x]=get(r[x]);
	}
	int size(int x) {
		return -r[get(x)];
	}
	bool join(int x,int y) {
		x=get(x);
		y=get(y);
		if (x==y) return false;
		if (r[x]>r[y]) swap(x,y);
		r[x]+=r[y];
		r[y]=x;
		return true;
	}
};

int const MAXN=110000;
int N;
int x[MAXN],y[MAXN];
vector<int> by_x[MAXN];
set<int> by_y[MAXN];

int main() {
	cin.tie(0);
	ios_base::sync_with_stdio(0);
	cout<<fixed<<setprecision(10);

	cin>>N;
	rep(i,0,N) {
		cin>>x[i]>>y[i];
		by_x[x[i]].push_back(y[i]);
	}

	DSU ds(MAXN);
	rep(i,1,MAXN) rep(j,1,sz(by_x[i])) ds.join(by_x[i][j],by_x[i][j-1]);
	
	rep(i,0,N) by_y[ds.get(y[i])].insert(x[i]);
	
	ll res=0;
	rep(i,1,MAXN) if (ds.get(i)==i) res+=ll(ds.size(i))*sz(by_y[i]);
	cout<<res-N<<"\n";
}


Measured memory_bytes: 13184
#include <cassert>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <iostream>
#include <vector>
#include <string>
#include <sstream>
#include <algorithm>
#include <utility>
#include <unordered_set>
#include <unordered_map>
#include <stack>
#include <queue>
#include <deque>
#include <functional>
#include <numeric>
#include <complex>
#include <iomanip>

using namespace std;

#define bitcount(n) __builtin_popcount(n)

#define debug(n) cout << n << endl;

#define PREC(n) setprecision(n)
#define DOTPREC(n) fixed << setprecision(n)

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

#define fst first
#define scd second
#define PB push_back
#define MP make_pair
#define rep(i,x) for(int i=0;i<(x);++i)
#define rep1(i,x) for(int i=1;i<=(x);++i)
#define rrep(i,x) for(int i=(x)-1;i>=0;--i)
#define rrep1(i,x) for(int i=(x);i>=1;--i)
#define FOR(i,a,x) for(int i=(a);i<(x);++i)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()

#define omajinai ios::sync_with_stdio(false); cin.tie(0)

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

const int inf = 1e9;
const ll linf = 3e18;
const double eps = 1e-9;

const ll MOD = 1000000007;

string ANS = "CODEFESTIVAL2016";
string S;
int main(void)
{
    cin >> S;
    int ans = 0;
    rep(i, ANS.size()) {
        if (ANS[i] != S[i]) ans++;
    }
    cout << ans << endl;
    return 0;
}


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

typedef long long ll;

int main() {        
	int n, k;
	cin >> n >> k;
	//9ll inf = 1e18;
	set<int> s;
	int inf = 1e9 + 7;
	vector<int> v(n + 1);

	for (int i = 0; i < n; ++i) {
		int x;
		cin >> x;
		s.insert(x);
	    v[x]++;
	}
	for (int i = 0; i <= n; ++i) {
		if (v[i] == 0) 
			v[i] = inf;
	}
	if (k >= (int)s.size()) {
		cout << 0;
		return 0;
	}
	sort(v.begin(),v.end());
	//for (int i = 0; i <= n; ++i) {
		//cout << v[i] << " ";
	//}
	int p = (int)s.size() - k;
	int ans = 0;
	for (int i = 0; i < p; ++i) {
		ans += v[i];
	}
	cout << ans;
}






Measured memory_bytes: 13500
// #define _GLIBCXX_DEBUG
#include <bits/stdc++.h>

#define FOR(i, a, b) for (int i = (a); i < int(b); ++i)
#define RFOR(i, a, b) for (int i = (b)-1; i >= int(a); --i)
#define REP(i, n) FOR(i, 0, n)
#define REP1(i, n) FOR(i, 1, int(n) + 1)
#define RREP(i, n) RFOR(i, 0, n)
#define RREP1(i, n) RFOR(i, 1, int(n) + 1)
#define ALL(c) begin(c), end(c)

int _ = (
#ifndef LOCAL
    std::cin.tie(nullptr), std::ios::sync_with_stdio(false),
#endif
    std::cout.precision(10), std::cout.setf(std::ios::fixed));

using ll = long long;
using ull = unsigned long long;
using ld = long double;
template <typename T> using vec = std::vector<T>;
using namespace std;

int main() {
  ull N;
  cin >> N;
  ull res = 0;
  for (ull i = 0; i < N; i++) {
    res += i;
  }
  cout << res << endl;
  return 0;
}


Measured memory_bytes: 3576
#include <bits/stdc++.h>
using namespace std;
struct Fast {
    Fast() {
        cin.tie(0);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(20);
    }
} fast;

long long mod = 1000000007;

long long div(long long a, long long b, long long c) { return b / c - (a - 1) / c; }

void print_binary(long long a) {
    for (int i = 31; i >= 0; i--) {
        cout << (a >> i & 1);
    }
    cout << endl;
}
long long modpow(long long m, long long n) {
    if (n == 0) return 1;
    if (n % 2 == 0) {
        long long t = modpow(m, n / 2);
        return t * t;
    } else {
        return modpow(m, n - 1) * m;
    }
}
void yes() {
    cout << "Yes" << endl;
    exit(0);
}
void no() {
    cout << "No" << endl;
    exit(0);
}

int main() {
    long long r, wrong = 0, c = 0;
    string s;
    cin >> s;
    map<char, int> cnt;
    for (int i = 0; i < s.size(); i++) {
        cnt[s[i]]++;
    }
    if (cnt.size() == 2) {
        yes();
    } else {
        no();
    }
}

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

int main(){
	int a,b;
	cin >> a >> b;
	if(a<b){
	cout << "a < b" << endl;
	}else if(a>b){
	cout << "a > b" << endl; 
	}else if(a==b){
	cout << "a == b" << endl;
	}
	return 0;
}


Measured memory_bytes: 3092
/******************************************
* AUTHOR : HRITIK AGGARWAL *
******************************************/
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define N 100005
#define MOD 1000000007
#define dd double
#define vi vector<int>
#define vll vector<ll>
#define forr(i, n) for(int i = 0; i < n; i++)
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep1(i,b) for(int i=1;i<=b;i++)
#define pb push_back
#define mp make_pair
#define clr(x) x.clear()
#define sz(x) ((int)(x).size())
#define ms(s, n) memset(s, n, sizeof(s))
#define F first
#define S second
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define int ll
ll po(ll a, ll x, ll m) { if (x == 0) {return 1;} ll ans = 1; ll k = 1;  while (k <= x) {if (x & k) {ans = ((ans * a) % m);} k <<= 1; a *= a; a %= m; } return ans; }
// DEKHIYE JI  WALID JO THE ABBA HAMARE WO YEH function CHHOD KR GYE THE
void lcs( string X, string Y, int m, int n )
{
    int L[m + 1][n + 1];

    /* Following steps build L[m+1][n+1] in bottom up fashion. Note
       that L[i][j] contains length of LCS of X[0..i-1] and Y[0..j-1] */
    for (int i = 0; i <= m; i++)
    {
        for (int j = 0; j <= n; j++)
        {
            if (i == 0 || j == 0)
                L[i][j] = 0;
            else if (X[i - 1] == Y[j - 1])
                L[i][j] = L[i - 1][j - 1] + 1;
            else
                L[i][j] = max(L[i - 1][j], L[i][j - 1]);
        }
    }

    // Following code is used to print LCS
    int index = L[m][n];

    // Create a character array to store the lcs string
    char lcs[index + 1];
    lcs[index] = '\0'; // Set the terminating character

    // Start from the right-most-bottom-most corner and
    // one by one store characters in lcs[]
    int i = m, j = n;
    while (i > 0 && j > 0)
    {
        // If current character in X[] and Y are same, then
        // current character is part of LCS
        if (X[i - 1] == Y[j - 1])
        {
            lcs[index - 1] = X[i - 1]; // Put current character in result
            i--; j--; index--;     // reduce values of i, j and index
        }

        // If not same, then find the larger of two and
        // go in the direction of larger value
        else if (L[i - 1][j] > L[i][j - 1])
            i--;
        else
            j--;
    }

    // Print the lcs
    cout  << lcs << "\n";
}
int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    string a, b;
    cin >> a >> b;
    int m = a.length(), n = b.length();
    lcs(a, b, m, n);
    return 0;
}

Measured memory_bytes: 70656
#include <bits/stdc++.h>
using namespace std;
#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 ALL(x) (x).begin(), (x).end()
#define dump(x) cout << (x) << endl
#define LMAX 9223372036854775807LL
#define LMIN -9223372036854775807LL
using ll = long long;
template<typename T>
using vec = vector<T>;
using P = pair<ll, ll>;
template <typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
	fill((T *)array, (T *)(array + N), val);
}

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

ll gcd(ll a, ll b) {
	if (b == 0)return a;
	return gcd(b, a % b);
}
ll lcm(ll a, ll b) {
	return a / gcd(a, b) * b;
}

int main(){
	IOS;
	int n;
	cin >> n;
	ll sum = 0;
	vec<ll> a(n);
	REP(i,n){
		cin >> a[i];
		sum += a[i];
	}
	double ave = sum / (double)n;
	ll ans = 0;
	double unko = 1111;
	REP(i, n){
		double dif = abs(a[i] - ave);
		if(dif < unko){
			ans = i;
			unko = dif;
		}
	}
	dump(ans);
} 

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

using namespace std;

long long s[100000][3];
long long dp[1000000][3];

int main(void)
{
    long long N;
    cin >> N;

    for (long long i = 0; i < N; i++)
    {
        for (int j = 0; j < 3; j++)
        {
            dp[i][j] = 0;
        }
    }

    for (long long  i = 0; i < N; i++)
    {
        cin >> s[i][0] >> s[i][1] >> s[i][2];
    }

    dp[0][0] = s[0][0];
    dp[0][1] = s[0][1];
    dp[0][2] = s[0][2];

    for (long long i = 0; i < N; i++)
    {
        for (int j = 0; j < 3; j++)
        {
            for (int k = 0; k < 3; k++)
            {
                if (j != k)
                    dp[i + 1][j] = max(dp[i + 1][j], dp[i][k] + s[i+1][j]);
            }
        }
    }

    long long ans=0;
    for(int i=0;i<3;i++)
    {
        ans = max(ans, dp[N][i]);
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 8308
import java.util.Scanner;

public class Main {
	
	public  int check(String name, String board){
		int i, j, k, space, next;
		boolean flag = false;
		char[] nameC = name.toCharArray();
		char[] boardC = board.toCharArray();
		
		for(i=0; i<board.length(); i++){
			if(nameC[0] == boardC[i]){
				for(j=i; j<board.length(); j++){
					if(nameC[1] == boardC[j]){
						space = j - i;
						for(k=2, next=j+space; next<board.length(); next+=space, k++){
							flag = false;
							if(nameC[k] == boardC[next]){
								flag = true;
								if(k==name.length()-1)return 1;
							}
							if(flag == false)break;
						}		
					}
				}
			}
		}
		return 0;
	}
	
	void doIt(){
		Scanner sc = new Scanner(System.in);
		int i, cnt = 0;
		int N = sc.nextInt();
		String name = sc.next();
		String[] board = new String[N];
		Main m = new Main();
		for(i=0; i<N; i++)board[i] = sc.next();
		
		for(i=0; i<N; i++){
			cnt += m.check(name, board[i]);
		}
		System.out.println(cnt);
	}
	
	public static void main(String[] args){
		new Main().doIt();	
	}
}

Measured memory_bytes: 27796
//Solution By SlavicG
#include "bits/stdc++.h"
using namespace std;

 
#define forn(i,n)                   for(int i=0;i<n;i++)
#define all(v)                      v.begin(), v.end()
#define rall(v)                     v.rbegin(),v.rend()
	
#define pb                          push_back
#define sz(a)                       (int)a.size()
 
#define   endl                       "\n"
#define fastio                       ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

int  main()
{
	int m,n;
	cin >> n >> m;
	int s=  0;
	vector<int> a(n);
	forn(i,n){
		cin>>a[i];
		s+=a[i];
	}
	sort(rall(a));
	double mn = (double)s / (double)(m * 4);
	forn(i,m)
	{
		if((double)a[i] < mn)
		{
			cout << "No";
			return 0;
		}
	}
	cout << "Yes";
}

Measured memory_bytes: 3632
#include <iostream>
#include <algorithm>
#include <map>
#include <math.h>
#include <string>
#define num_size 100000
typedef long long ll;

using namespace std;

int main(){
    int N;
    cin >> N;
    int T[num_size+10] = {0};
    int sum_T = 0;
    for (int i = 1; i <= N; i++){
	cin >> T[i];
	sum_T += T[i];
    }
    int M;
    cin >> M;
    int res[num_size+10] = {0};
    for (int i = 1; i <= M; i++){
	int p, x;
	cin >> p >> x;
	res[i] = sum_T-(T[p]-x);
    }

    for (int i = 1; i <= M; i++){
	cout << res[i] << endl;
    }

    return 0;
}


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

ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
constexpr int mod = 1e9 + 7;

// clang-format off
struct mint {
  ll x; // typedef long long ll;
  mint(ll x = 0) : x((x % mod + mod) % mod) {}
  mint operator-() const { return mint(-x); }
  mint &operator+=(const mint a) { if ((x += a.x) >= mod) x -= mod; return *this; }
  mint &operator-=(const mint a) { if ((x += mod - a.x) >= mod) x -= mod; return *this; }
  mint &operator*=(const mint a) { (x *= a.x) %= mod; return *this; }
  mint operator+(const mint a) const { mint res(*this); return res += a; }
  mint operator-(const mint a) const { mint res(*this); return res -= a; }
  mint operator*(const mint a) const { mint res(*this); return res *= a; }
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t >> 1);
    a *= a; if (t & 1) a *= *this;
    return a; }
  mint inv() const { return pow(mod - 2); }
  mint &operator/=(const mint a) { return (*this) *= a.inv(); }
  mint operator/(const mint a) const { mint res(*this); return res /= a; }
  friend ostream &operator<<(ostream &os, const mint &a) { os << a.x; return os; }
  friend istream &operator>>(istream &is, mint &a) { is >> a.x; return is; }
};
struct combination {
  vector<mint> fact, ifact;
  combination(int n) : fact(n + 1), ifact(n + 1) {
    assert(n < mod);
    fact[0] = 1;
    for (int i = 1; i <= n; ++i) fact[i] = fact[i - 1] * i;
    ifact[n] = fact[n].inv();
    for (int i = n; i >= 1; --i) ifact[i - 1] = ifact[i] * i;
  }
  mint operator()(int n, int k) { if (k < 0 || k > n) return 0; return fact[n] * ifact[k] * ifact[n - k]; }
};
// clang-format on

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

  if (n == m) cout << "Yes";
  else cout << "No";
  cout << endl;
}


Measured memory_bytes: 256
#include <cstdio>
#include <vector>

using namespace std;

vector< bool > prime( 10000001, 1 );

signed main()
{
    prime[0] = prime[1] = 0;
    for( int i = 2; i * i < 10000001; i++ )
    {
        if( prime[i] )
        {
            for( int j = 1; i * ( j + 1 ) < 10000001; j++ )
            {
                prime[i * ( j + 1 )] = 0;
            }
        }
    }

    int n;
    while( scanf( "%d\n", &n ) != EOF )
    {
        if( n == 0 ) break;
        int sum = 0, cnt = 0;
        for( int i = 0; cnt < n; i++ )
        {
            if( prime[i] )
            {
                sum += i;
                cnt++;
            }
        }
        printf( "%d\n", sum );
    }
    return 0;
}


Measured memory_bytes: 3228
package main

import (
	"fmt"
	"math"
	"reflect"
)

func permutation(n int, k int) int {
	v := 1
	if 0 < k && k <= n {
		for i := 0; i < k; i++ {
			v *= (n - i)
		}
	} else if k > n {
		v = 0
	}
	return v
}

func factorial(n int) int {
	return permutation(n, n-1)
}

func main() {
	// Code for C - Count Order
	var N int
	fmt.Scanf("%d", &N)

	P := make([]int, N)
	Q := make([]int, N)
	for i := 0; i < N; i++ {
		fmt.Scanf("%d", &P[i])
	}

	for i := 0; i < N; i++ {
		fmt.Scanf("%d", &Q[i])
	}

	a := make([]int, 0)
	for i := 1; i <= N; i++ {
		a = append(a, i)
	}

	var n = len(a) - 1
	var i, j int
	var ans1, ans2 int

	if reflect.DeepEqual(a, P) {
		ans1 = 1
	}
	if reflect.DeepEqual(a, Q) {
		ans2 = 1
	}

	for c := 1; c < factorial(len(a)); c++ { // 3! = 6:
		i = n - 1
		j = n
		for a[i] > a[i+1] {
			i--
		}
		for a[j] < a[i] {
			j--
		}
		a[i], a[j] = a[j], a[i]
		j = n
		i++
		for i < j {
			a[i], a[j] = a[j], a[i]
			i++
			j--
		}

		if reflect.DeepEqual(a, P) {
			ans1 = c + 1
		}
		if reflect.DeepEqual(a, Q) {
			ans2 = c + 1
		}
	}

	fmt.Println(int(math.Abs(float64(ans2 - ans1))))
}


Measured memory_bytes: 6032
#include <bits/stdc++.h>
        #include<iostream>
        #include<cstdio>
        #include<vector>
        #include<queue>
        #include<map>
        #include<cstring>
        #include<string>
        #include <math.h>
        #include<algorithm>
    //    #include <boost/multiprecision/cpp_int.hpp>
        #include<functional>
      #define int long long
        #define inf  1000000007
        #define pa pair<int,int>
#define ll long long
        #define pal pair<ll,ll>
        #define ppa pair<int,pa>
        #define  mp make_pair
        #define EPS (1e-10)
        #define equals(a,b) (fabs((a)-(b))<EPS)

        using namespace std;

        class Point{
        	public:
        	double x,y;
        	Point(double x=0,double y=0):x(x),y(y) {}
        	Point operator + (Point p) {return Point(x+p.x,y+p.y);}
        	Point operator - (Point p) {return Point(x-p.x,y-p.y);}
        	Point operator * (double a) {return Point(x*a,y*a);}
        	Point operator / (double a) {return Point(x/a,y/a);}
        	double absv() {return sqrt(norm());}
        	double norm() {return x*x+y*y;}
        	bool operator < (const Point &p) const{
        		return x != p.x ? x<p.x: y<p.y;
        	}
        	bool operator == (const Point &p) const{
        		return fabs(x-p.x)<EPS && fabs(y-p.y)<EPS;
        	}
        };
        typedef Point Vector;

        struct Segment{
        Point p1,p2;
        };

    double hen(Vector a){
    if(fabs(a.x)<EPS && a.y>0) return acos(0);
    else if(fabs(a.x)<EPS && a.y<0) return 3*acos(0);
    else if(fabs(a.y)<EPS && a.x<0) return 2*acos(0);
    else if(fabs(a.y)<EPS && a.x>0) return 0.0;
    else if(a.y>0) return acos(a.x/a.absv());
    else return 2*acos(0)+acos(-a.x/a.absv());

    }

        double dot(Vector a,Vector b){
        	return a.x*b.x+a.y*b.y;
        }
        double cross(Vector a,Vector b){
        	return a.x*b.y-a.y*b.x;
        }
        int dx[4] = {1, 0, -1, 0};
        int dy[4] = {0, 1, 0, -1};
        //----------------kokomade temple------------

vector<pa> ve;

signed main(){
int w,h;
	cin>>w>>h;
	int ans=0,tate=0,yoko=0;
	int z;
	for(int i=0;i<w;i++){
		cin>>z;
		ve.push_back(mp(z,0));
	}
	for(int i=0;i<h;i++){
		cin>>z;
		ve.push_back(mp(z,1));
	}
	
	sort(ve.begin(),ve.end());
	
	for(int i=0;i<w+h;i++){
		pa zz=ve[i];
		if(zz.second==0){
			ans += zz.first*(h+1-yoko);
			tate++;
			
		}
		else{
			ans += zz.first*(w+1-tate);
			yoko++;
		}
		
		
	}
	cout<<ans<<endl;
	return 0;
}

//printf("%.10f\n",ans);


Measured memory_bytes: 4592
use io::*;
use std::*;

fn solve(H: i64, W: i64) {
    if H==1 || W==1 {
        println!("1");
    }else {
        println!("{}",(H*W+1)/2);
    }
}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
fn main() {
    let con = read_string();
    let mut scanner = Scanner::new(&con);
    let mut H: i64;
    H = scanner.next();
    let mut W: i64;
    W = scanner.next();
    // In order to avoid potential stack overflow, spawn a new thread.
    let stack_size = 104_857_600; // 100 MB
    let thd = std::thread::Builder::new().stack_size(stack_size);
    thd.spawn(move || solve(H, W)).unwrap().join().unwrap();
}

pub mod io {
    use std;
    use std::str::FromStr;

    pub struct Scanner<'a> {
        iter: std::str::SplitWhitespace<'a>,
    }

    impl<'a> Scanner<'a> {
        pub fn new(s: &'a str) -> Scanner<'a> {
            Scanner {
                iter: s.split_whitespace(),
            }
        }

        pub fn next<T: FromStr>(&mut self) -> T {
            let s = self.iter.next().unwrap();
            if let Ok(v) = s.parse::<T>() {
                v
            } else {
                panic!("Parse error")
            }
        }

        pub fn next_vec_len<T: FromStr>(&mut self) -> Vec<T> {
            let n: usize = self.next();
            self.next_vec(n)
        }

        pub fn next_vec<T: FromStr>(&mut self, n: usize) -> Vec<T> {
            (0..n).map(|_| self.next()).collect()
        }
    }

    pub fn read_string() -> String {
        use std::io::Read;

        let mut s = String::new();
        std::io::stdin().read_to_string(&mut s).unwrap();
        s
    }

    pub fn read_line() -> String {
        let mut s = String::new();
        std::io::stdin().read_line(&mut s).unwrap();
        s.trim_right().to_owned()
    }
}


Measured memory_bytes: 8572
n = int(input())
a = list(map(int, input().split()))
q = int(input())
bc=[list(map(int,input().split())) for i in range(q)]

ans=sum(a)

from collections import defaultdict
d = defaultdict(int)

for num in a:
    d[num]+=1

for b,c in bc:
    if d[b]==0:
        print(ans)
        continue
    ans-= b*d[b]
    d[c]+=d[b]
    ans+=c*d[b]
    d[b]=0

    print(ans)

Measured memory_bytes: 107128
#include <iostream>
using namespace std;
int main()
{
    int k;
    string s;
    cin>>k>>s;

    int siz=s.length();
    if(k<siz){
        for(int i=0;i<k;i++){
            cout<<s[i];
        }
        cout<<"...";
    }
    else cout<<s;

    return 0;
}


Measured memory_bytes: 3632
#include <iostream>

int main()
{
  int S = 0 ;

  std::cin >> S ;

  int h = S / 3600 ;
  int m = ( S % 3600 ) / 60 ;
  int s = S % 60 ;

  std::cout << h << ":" << m << ":" << s << std::endl ;

  return 0 ;
}

Measured memory_bytes: 3100
n,m,l = map(int,input().split())
A,B,C = [],[],[]
for i in range(n):
	A.append(list(map(int,input().split())))
for ii in range(m):
	B.append(list(map(int,input().split())))
for k in range(n):
	ans = []
	for s in range(l):
		cul = 0
		for kk in range(m):
			cul += A[k][kk] * B[kk][s]
		ans.append(cul)
	ans = list(map(str,ans))
	print(" ".join(ans))


Measured memory_bytes: 6244
#include<iostream>
#include <stdio.h>
#include <stdlib.h>
#include <vector>
#include <algorithm>

using namespace std;

int main(){
  int a, b, plus, minus, multiple;
  cin >> a >> b;
  plus = a + b;
  minus = a - b;
  multiple = a * b;
  cout << max({plus, minus, multiple});
  return 0;
}


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

def dfs(s, mx):
    if len(s) == n:
        print(s)
    else:
        for c in range(ord('a'), mx+1):
            if c == mx:
                dfs(s + chr(c), mx + 1)
            else:
                dfs(s + chr(c), mx)

dfs('', ord('a'))

Measured memory_bytes: 4340
def f(a,b):
    for i in range(a):
        k = b // 2
        if i % 2 ==0:#偶数
            if b % 2 ==0:
                print("#."*k)
            else:
                print("#."*(k)+"#")
        else:#奇数
            if b % 2 ==0:
                print(".#"*k)
            else:
                print(".#"*(k)+".")
    print()

L = []
while True:
        a,b = map(int,input().split())
        k = [a,b]
        L.append(k)
        if a == 0 and b == 0 :
            break

for i in range(len(L)-1):
    f(L[i][0],L[i][1])



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

int main() {
  int N;
  char C;
  bool G, W, Y, P;
  G = W = Y = P = false;
  cin >> N;
  for(int i=0;i<N;i++){
	cin >> C;
    if(C == 'G') G = true;
    if(C == 'W') W = true;
    if(C == 'Y') Y = true;
    if(C == 'P') P = true;
  }
  if(G && W && Y && P){
    cout << "Four" << endl;
  }else{
    cout << "Three" << endl;
  }
}

Measured memory_bytes: 3640
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cctype>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>
#include<complex>

using namespace std;

#define ll long long
#define ld long double
#define INF 1e9
#define LINF (ll)INF*INF
#define MOD 1000000007
#define rep(i,n) for(int i=0;i<(n);i++)
#define loop(i,a,n) for(int i=a;i<(n);i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)

#define int ll //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

const double PI=acos(-1);
const double EPS=1e-9; //うまくいかなかったらゆるめる

typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int,int> pii;
typedef pair<pii,int> ppi;
typedef pair<int,pii> pip;
typedef vector<pii> vp;
typedef vector<vi> vvi;

int gcd(int a, int b){if(b==0) return a;return gcd(b,a%b);}
int lcm(int a, int b){return a/gcd(a,b)*b;}


signed main(void) {
    int k,n;
    cin >> k >> n;
    vi v(n);
    rep(i,n)cin >> v[i];
    v.push_back(k+v[0]);
    vi a(n);
    rep(i,n)a[i] = v[i+1]-v[i];
    sort(all(a));
    int ans = 0;
    rep(i,n-1)ans += a[i];
    cout << ans << endl;
}


Measured memory_bytes: 4736
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main()
{
  int n;
  cin>>n;
  string s;
  cin>>s;
  ll g=0,r=0,b=0;
  for(int i=0;i<n;i++)
  {
    if(s[i]=='R')
      r++;
    else if(s[i]=='B')
      b++;
    else g++;
  }
  ll sum=(r*g*b);
  for(int i=0;i<n-2;i++)
  {
    for(int diff=1;diff<=(n-i)/2;diff++)
    {
      if(s[i]=='R' && s[i+diff]=='G' && s[i+2*diff]=='B')
        sum--;
      else if(s[i]=='R' && s[i+diff]=='B' && s[i+2*diff]=='G')
        sum--;
      else if(s[i]=='G' && s[i+diff]=='R' && s[i+2*diff]=='B')
        sum--;
      else if(s[i]=='G' && s[i+diff]=='B' && s[i+2*diff]=='R')
        sum--;
      else if(s[i]=='B' && s[i+diff]=='R' && s[i+2*diff]=='G')
        sum--;
      else if(s[i]=='B' && s[i+diff]=='G' && s[i+2*diff]=='R')
        sum--;
    }
  }
  cout<<sum;
  return 0;          
}            

Measured memory_bytes: 3628
using System;
using System.Collections.Generic;
using System.Linq;

public class Prog
{
    public void run()
    {
        int N = int.Parse(Console.ReadLine());
        var input = Console.ReadLine().Split();
        int[] A = Array.ConvertAll(input, int.Parse);
        input = Console.ReadLine().Split();
        int[] B = Array.ConvertAll(input, int.Parse);
        input = Console.ReadLine().Split();
        int[] C = Array.ConvertAll(input, int.Parse);
        int Old = -5;
        int New = 0;
        int ans = 0;
        for(int i = 0; i < N; i++)
        {
            New = B[A[i] - 1];
            if(Old == A[i] - 1)
            {
                New += C[Old-1];
            }
            Old = A[i];
            ans += New;
        }
        Console.WriteLine(ans);
    }
    public static void Main()
    {
        var prog = new Prog();
        prog.run();
    }
    /*
    最小公倍数
    public static long Lcm(long a, long b)
    {
        return a * b / Gcd(a, b);
    }

    // ユークリッドの互除法 
    public static long Gcd(long a, long b)
    {
        if (a < b)
            // 引数を入替えて自分を呼び出す
            return Gcd(b, a);
        while (b != 0)
        {
            var remainder = a % b;
            a = b;
            b = remainder;
        }
        return a;
    }
    */
    //a<=c, b<=d;
}

//Array.ConvertAll(int.Parse)
//str.IndexOf("Stage",System.StringComparison.CurrentCulture)


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

int main(int argc,char** argv){
	int N,K;
	int temp,count = 0;
	
	cin >> N >> K;
	
	temp = N;
	N -= K;
	count++;
	while(N>0){
		N -= (K-1);
		count++;
	}

	cout << count << endl;
	return 0;
}

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

typedef long long ll;

int mods[4];

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

    for (int i = 0; i < N; i++) {
        int a;
        cin >> a;
        mods[a % 4]++;
    }

    int nzeros = mods[1] + mods[3] + ((mods[2] > 0) ? 1 : 0) - 1;

    if (mods[0] >= nzeros) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }

}

Measured memory_bytes: 256
import sys
from heapq import*
r=sys.stdin.readline
def g(s,g):
 F=[1e7]*-~n;F[s]=0
 H=[(0,s)]
 while H:
  c,u=heappop(H)
  if u==g:return c
  for f,v in E[u]:
   t=c+f
   if t<F[v]:
    F[v]=t
    heappush(H,(t,v))
 return-1
for e in iter(r,'0 0\n'):
 n,k=map(int,e.split())
 E=[[]for _ in[0]*-~n]
 for _ in[0]*k:
  f=r()
  if'0'==f[0]:print(g(*map(int,f[2:].split())))
  else:
   c,d,e=map(int,f[2:].split())
   E[c]+=[(e,d)];E[d]+=[(e,c)]


Measured memory_bytes: 6284
#include <iostream>
#include <algorithm>
#include <string>
#include <sstream>
#include <vector>
#include <math.h>
#include <cstdlib>
#include <cctype>
#include <random>
#include <math.h>

using namespace std;


int main() {
    int n ,d;
    cin >> n >> d;
    double x[n][d];
    for (int i=0; i<n; i++) {
        for (int j=0; j<d; j++) {
            cin >> x[i][j];
        }
    }

    int min_x, min_y;

    double dis = 0;
    int count = 0;
    for (int i=0; i<n; i++) {

        for (int k=i+1; k<n; k++) {
            double dis = 0;
            for (int j=0; j<d; j++) {
                dis += pow(x[i][j]-x[k][j], 2);
            }

            if (sqrt(dis) - (double)((int)sqrt(dis)) == 0.0) count++;

        }
    }    

    cout << count << endl;


  return 0;
}


Measured memory_bytes: 256
program test
implicit none
integer(8) :: n,i
integer(8) :: retsu(2*10**5) = 0, imp=0, number=0

read(*,*) n

do i=1,n
	read(*,*) retsu(i)
enddo

if(retsu(1)>0) then
imp = 1
endif

do i=2,n

		if(retsu(i) - retsu(i-1) > 1) then
			imp = 1
		endif
		
		if(retsu(i)==0) then
			number = number
		else if(retsu(i)==1)then
			number = number + 1
		else if(retsu(i) - retsu(i-1) == 1) then
			number = number + 1
		else if(retsu(i) <= retsu(i-1)) then
			number = number + retsu(i)
		endif
			
enddo

if(imp == 1)then
	write(*,*) -1
else
	write(*,*) number
endif

end program

Measured memory_bytes: 1792
/**
 *   
 *   Date: 01 September 2019
 *   Time: 17:39:46
**/
#include <iostream>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
#include <vector>
#include <cmath>
#include <cstring>
#include<queue>
#include<stack>
#include<climits>
#include<iomanip>
#define endl "\n"
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> pi;
typedef vector<ll> vec;
typedef vector<vector<ll> > matrix;
ll const mod=1000000007;

int main(){
	ios_base::sync_with_stdio(false); 
	cin.tie(NULL);
	ll s,a,b;
	cin>>a>>b;
	if(b == 1)
	{
		cout<<0<<endl;
	}
	else
	{
		s=0;
		for(ll i=1;i<=400;i++)
		{
			if(s+a >= b)
			{
				cout<<i<<endl;
				return 0;
			}
			s+=a-1;

		}
	}

return 0;
}

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

#define _USE_MATH_DEFINES

#include <iostream>
#include <sstream>
#include <iomanip>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <functional>
#include <utility>
#include <tuple>
#include <vector>
#include <string>
#include <list>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <queue>
#include <deque>
#include <stack>
#include <iterator>
#include <bitset>
#include <complex>
#include <limits>
#include <random>


using namespace std;

#define rep(i,a,b) for(int i=(a), i##_len=(b);i<i##_len;i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)

#define int ll
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<double, double> pdd;
typedef vector< vector<int> > mat;

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

const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;

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

	int A, B, C;
	cin >> A >> B >> C;
	int K;
	cin >> K;

	bool ok = false;
	rep(i, 0, K + 1)rep(j, 0, K + 1 - i)rep(k, 0, K + 1 - i - j)
	{
		vector<int> V(3);
		V[0] = A, V[1] = B, V[2] = C;
		rep(d, 0, i)V[0] *= 2;
		rep(d, 0, j)V[1] *= 2;
		rep(d, 0, k)V[2] *= 2;
		if (V[0] < V[1] && V[1] < V[2])
		{
			ok = true;
		}
	}

	if (ok)
	{
		cout << "Yes" << endl;
	}
	else
	{
		cout << "No" << endl;
	}

	return 0;
}

Measured memory_bytes: 3512
N,X = map(int,input().split())
A = list(map(int,input().split()))
ans = 0
for i in range(N-1):
  if i == 0:
    if A[i] > X:
      ans += A[i] - X
      A[i] = X
  if A[i] + A[i+1] > X:
    ans += A[i] + A[i+1] - X
    A[i+1] -= A[i] + A[i+1] - X
print(ans)
  

Measured memory_bytes: 14060
/*   _/                _/                 _/_/_/   _/
  _/_/_/_/   _/_/   _/_/_/_/   _/_/    _/       _/_/
   _/     _/    _/   _/     _/    _/  _/_/_/     _/
  _/     _/    _/   _/     _/    _/  _/    _/   _/
   _/_/   _/_/       _/_/   _/_/      _/_/     _/ */
#include<iostream>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<set>
#include<map>
#include<queue>
#include<vector>
using namespace std;
using ll=long long;
const int MOD=1e9+7;
const double pi=3.14159265358979323846;
const int inf=1e9;
const ll INF=1e18;
using P=pair<int,int>;
int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};
int main() {
  cin.tie(0),cout.tie(0);
  ios::sync_with_stdio(false);
  int n,a[100005]={},ans=0;
  cin >> n;
  for(int i=0; i<n; i++) {
    cin >> a[i];
  }
  for(int i=0; i<n; i++) {
    if(a[i]==i+1) {
      ans++;
      i++;
    }
  }
  cout << ans << "\n";
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long
int main(){
    string a,b;
    cin >> a >> b;
    if(a == b) cout <<"EQUAL" << endl;
    else if(a.size()>b.size()) cout << "GREATER" <<endl;
    else if(a.size()<b.size()) cout << "LESS" << endl;
    else{
        if(a>b){
            cout << "GREATER" << endl;
        }
        else if(a<b){
            cout << "LESS" << endl;
        }
        else{
            cout << "EQUAL" << endl;
        }
    }
    return(0);
}

Measured memory_bytes: 256
#include <stdlib.h>
#include <stdio.h>
int main (){
int a,b,c,d,e,f,g;
 scanf ("%d%d%d%d",&a,&b,&c,&d);
e=abs(a-b);
f=abs(b-c);
g=abs(a-c);
  if (g<d+1){
  printf ("Yes");
  }  
  else if (e<d+1 & f<d+1){
  printf ("Yes");
  }
  else{
  printf ("No");
  }
return 0;
}

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

#include <iostream>
#include <iomanip>
#include <sstream>
#include <fstream>
#include <stdint.h>
#include <string.h>

#define _USE_MATH_DEFINES
#include <math.h>

#include <vector>
#include <list>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <stack>
#include <deque>
#include <string>

#include <algorithm>
#include <functional>
#include <bitset>
#include <functional>
#include <chrono>
#include <random>

#define sqr(x) (x) * (x)

typedef unsigned int u32;
typedef int i32;
typedef unsigned long long int u64;
typedef long long int i64;
typedef uint16_t u16;
typedef int16_t i16;
typedef uint8_t u8;
typedef int8_t i8;

using namespace std;
using namespace std::chrono;

const i64 mod = 1'000'000'000ll + 7;
//const i64 smod = 998244353ll;
//const i64 inf = 1'000'000'000'000'000'000ll + 7;
//const i64 inf = 1'000'000'007;

const double inf = 1e12;

const long double eps = 1e-8;

const i64 MAXN = 3'000 + 5;

i64 rows, cols, k;

vector<map<i64, i64>> z;
i64 dp[MAXN][MAXN][5];

inline i64 sum(set<pair<i64, i64>>& q) {
    i64 R = 0;
    for (auto t : q) {
        R -= t.first;
    }
    return R;
}

inline pair<i64, i64> sum3(set<pair<i64, i64>>& q) {
    i64 R = 0;
    i64 cnt = 0;
    i64 last = 0;
    for (auto t : q) {
        R -= t.first;
        last = max(last, t.second);
        cnt += 1;
        if (cnt == 3) {
            break;
        }
    }
    return{ R, last };
}

int main(int argc, char* argv[]) {
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); cout.precision(15); cout.setf(ios::fixed); cerr.precision(15); cerr.setf(ios::fixed);

    cin >> rows >> cols >> k;

    z.resize(rows);

    for (i64 i = 0; i < k; i++) {
        i64 r, c, v;
        cin >> r >> c >> v;
        r -= 1;
        c -= 1;
        z[r][c] = v;
    }

    for (i64 r = rows - 1; r >= 0; r--) {
        for (i64 c = cols - 1; c >= 0; c--) {
            dp[r][c][0] = dp[r + 1][c][3];
            dp[r][c][1] = max(dp[r][c][0], dp[r][c + 1][1]);
            if (z[r].count(c)) {
                dp[r][c][1] = max(dp[r][c][1], dp[r + 1][c][3] + z[r][c]);
            }

            for (i64 k = 2; k <= 3; k++) {
                dp[r][c][k] = max(dp[r][c][k - 1], max(dp[r][c + 1][k], dp[r][c + 1][k - 1] + (z[r].count(c) ? z[r][c] : 0)));
            }
        }
    }

    cout << dp[0][0][3] << endl;

    return 0;
}

Measured memory_bytes: 368180
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <list>
#include <random>
#include <iomanip>
#include <map>

using namespace std;

typedef long long ll;

int N;
ll X;

ll dfs(int N, ll X, vector<ll>l, vector<ll>p) {
    ll pans = 0;
    if (N == 0) {
        pans = 1;
    } else {
        if (X == 1) pans = 0;
        else if (X == 2 + l.at(N - 1)) pans = p.at(N - 1) + 1;
        else if (X == 3 + 2 * l.at(N - 1)) pans = 2 * p.at(N - 1) + 1;
        else if (X <= 1 + l.at(N - 1)) pans = dfs(N - 1, X - 1, l, p);
        else if (X <= 2 + 2 * l.at(N - 1)) pans = p.at(N - 1) + 1 + dfs(N - 1, X - l.at(N - 1) - 2, l, p);
    }
    
    return pans;
}

int main() {
    cin >> N >> X;
    
    vector<ll> l = {1};
    vector<ll> p = {1};
    for(int i = 1; i <= N; i++) {
        l.push_back(2 * l.at(i - 1) + 3);
        p.push_back(2 * p.at(i - 1) + 1);
    }
    ll ans = dfs(N, X, l, p);
    
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <functional>
#include <queue>
#include <iostream>
#include <string.h>
#include <iomanip>
#include <algorithm>
#include <functional>
#include <cstdint>
#include <climits>
#include <unordered_set>
#include <sstream>

using namespace std;

#define ll long long int
#define pii pair<int,int>
#define ti3 tuple<ll,ll,ll>

struct BIT
{
    std::vector<int> bit;
    
    BIT(int size) : bit(size, 0){ }
    
    void add(int k, int x) {
        while (k < bit.size()) {
            bit[k] += x;
            k += k &-k;
        }
    }
    int sum(int k) {
        int res = 0;
        while (k > 0) {
            res += bit[k];
            k -= k&-k;
        }
        return res;
    }
};

struct UnionFind {
    vector<int> data;
    
    UnionFind(int size) : data(size, -1) { }
    
    bool 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;
        }
        return x != y;
    }
    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)];
    }
};

int main(void)
{
    int a, b;
    cin >> a >> b;
    if(a == b)
    {
        cout << "Draw" << endl;
        return 0;
    }
    if(a == 1)
    {
        a += 13;
    }
    if(b == 1)
    {
        b += 13;
    }
    if(a > b)
    {
        cout << "Alice" << endl;
        return 0;
    }
    cout << "Bob" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h> 
using namespace std; 
typedef long long int ll;
#define m 1000000007  


  
int main() 
{ 
    ios_base::sync_with_stdio(false); 
    cin.tie(NULL);
   ll n;cin>>n;ll a[n]{};ll v[n]{};
   
   for(ll i=0;i<n;i++)cin>>a[i];
   
    for(ll i=n-2;i>=0;i--)
    {
        v[i]=(v[i+1]+a[i+1])%m;
    }
    ll sum=0;
   for(ll i=0;i<n;i++)
   {
       ll k1=((a[i]*v[i])%m);
       sum+=k1;
       sum=(sum%m);
   }
   cout<<(sum%m)<<endl;
     
   
   
    return 0; 
} 

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

int main() {
  int N;
  cin >> N;
  
  vector<int> vec(N);
  for (int i = 0; i < N; i++) {
    cin >> vec.at(i);
  }
  
  vector<int> mochi(1);
  mochi.at(0) = vec.at(0);
    
  for (int j= 0; j < N; j++) {
    int p = 0;
    
    for (int k = 0; k < j; k++) {
      if (vec.at(j) == vec.at(k)) {
        p++;
      }
    }
    
    if (p == 0) {
      mochi.push_back(vec.at(j));
    }
  }
  cout << mochi.size()-1 << endl;
        
}

Measured memory_bytes: 256