akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin >> n;
  vector<int> a(n),b(100010);
  for(int i=0; i<n; i++){
    cin >> a[i];
    b.at(a[i])++;
    if(a[i]!=0)b.at(a[i]-1)++;
    b.at(a[i]+1)++;
  }
  sort(b.begin(),b.end());
  reverse(b.begin(),b.end());
  cout << b[0] << endl;
}

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

#define NDEBUG
#include <cassert>


typedef long long ll;
typedef long double Double;
typedef unsigned long long ull;
typedef pair<int,int> ii;
typedef pair<ll,ll> llll;
typedef pair<double,double> dd;

typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<ii> vii;
typedef vector<vector<ii>> vvii;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef vector<llll> vllll;
typedef vector<bool> vb;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<long double> vD;

#define sz(a)  int((a).size())
#define pb  push_back
#define eb  emplace_back
#define FOR(var,from,to) for(int var=(from);var<=(to);++var)
#define rep(var,n)  for(int var=0;var<(n);++var)
#define rep1(var,n)  for(int var=1;var<=(n);++var)
#define repC2(vari,varj,n)  for(int vari=0;vari<(n)-1;++vari)for(int varj=vari+1;varj<(n);++varj)
#define repC3(vari,varj,vark,n)  for(int vari=0;vari<(n)-2;++vari)for(int varj=vari+1;varj<(n)-1;++varj)for(int vark=varj+1;vark<(n);++vark)
#define ALL(c)  (c).begin(),(c).end()
#define RALL(c)  (c).rbegin(),(c).rend()
#define tr(i,c)  for(auto i=(c).begin(); i!=(c).end(); ++i)
#define found(s,e)  ((s).find(e)!=(s).end())
#define mset(arr,val)  memset(arr,val,sizeof(arr))
#define mid(x,y) ((x)+((y)-(x))/2)
#define IN(x,a,b) ((a)<=(x)&&(x)<=(b))
#define cons make_pair
#define clamp(v,lo,hi) min(max(v,lo),hi)
#define ABS(x) max((x),-(x))

int main()
{
    int N, M;
    int S[N], T[M];


    map<string, int> x;
    string s;

    cin >> N;
    rep(i, N){
        cin >> s;
        if (x.find(s) != x.end()){
            x[s] += 1;
        } else {
            x[s] = 1;
        }
    }

    cin >> M;
    rep(j, M){
        cin >> s;
        if (x.find(s) != x.end()){
            x[s] -= 1;
        } else {
            x[s] = -1;
        }
    }
    int ans = 0;
    for(auto itr = x.begin(); itr != x.end(); ++itr) {
        if (itr->second > ans){
            ans = itr->second;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <vector>

// Acknowledgement: Special thanks to kyomukyomupurin, who developed this
// template.
template <class T, class U>
std::ostream& operator<<(std::ostream& os, const std::pair<T, U>& p) {
  return os << '(' << p.first << ", " << p.second << ')';
}

template <class T>
std::ostream& operator<<(std::ostream& os, const std::vector<T>& vec) {
  int n = 0;
  for (auto e : vec) os << (n++ ? ", " : "{") << e;
  return os << (n ? "}" : "{}");
}

template <class T>
std::ostream& operator<<(std::ostream& os, const std::set<T>& st) {
  int n = 0;
  for (auto e : st) os << (n++ ? ", " : "{") << e;
  return os << (n ? "}" : "{}");
}

template <class T, class U>
std::ostream& operator<<(std::ostream& os, const std::map<T, U>& mp) {
  int n = 0;
  for (auto e : mp) os << (n++ ? ", " : "{") << e;
  return os << (n ? "}" : "{}");
}

template <class T>
std::istream& operator>>(std::istream& is, std::vector<T>& vec) {
  for (T& e : vec) is >> e;
  return is;
}

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

void debug_out() { std::cerr << '\n'; }

template <class Head, class... Tail>
void debug_out(Head&& head, Tail&&... tail) {
  std::cerr << head;
  if (sizeof...(Tail) != 0) std::cerr << ", ";
  debug_out(std::forward<Tail>(tail)...);
}
using namespace std;
using int64 = long long;

int main() {
  int N, M;
  cin >> N >> M;
  vector<int64> A(N);
  cin >> A;
  sort(A.begin(), A.end());
  vector<pair<int64, int64>> p(M);
  for (int i = 0; i < M; i++) {
    cin >> p[i].first >> p[i].second;
  }
  sort(p.begin(), p.end(), [](const auto& x, const auto& y) {
    if (x.second == y.second)
      return x.first > y.first;
    else
      return x.second > y.second;
  });
  debug(p);
  int idx = 0;
  int64 ans = 0;
  for (int i = 0; i < M; i++) {
    int b = p[i].first;
    while (b != 0 && A[idx] < p[i].second && idx < N) {
      idx++;
      b--;
      ans += p[i].second;
    }
    debug(ans);
  }
  for (int i = idx; i < N; i++) {
    ans += A[i];
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 5612
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <random>
#include <chrono>
#include <queue>
#include <ctime>
#include <cassert>
using namespace std;
typedef long long ll;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;
#define fs first
#define sc second
#define INF 1000000000
#define MOD 1000000007
#define EPS 0.00000001


int main() {
//    ios::sync_with_stdio(false);
//    cin.tie(0);
    int N; cin >> N;
    int A[1010][1010];
    for(int i=0; i<N; i++){
        for(int j=0; j<N-1; j++){
            int a; cin >> a;
            a--;
            A[i][j] = a;
        }
    }
    
    vector<int> cur(N);

    
    int cnt = 0;
    while(1){
        
        
        bool nopair = true;

        bool used[1010] = {};

        for(int i=0; i<N; i++){
            if(cur[i]==N-1) continue;
            int aite = A[i][cur[i]];
            
            if(used[i] || used[aite]) continue;
            if(i==A[aite][cur[aite]]){
                cur[i]++;
                cur[aite]++;
                used[i] = true;
                used[aite] = true;
                nopair = false;
            }
        }
        
        
        if(nopair){
            cout << -1 << endl;
            return 0;
        }
        
        cnt++;
        
        bool allend = true;
        for(int i=0; i<N; i++){
            if(cur[i]!=N-1) allend = false;
        }
        
        
        if(allend){
            cout << cnt << endl;
            return 0;
        }
        
    }
    
    return 0;
}



Measured memory_bytes: 4224
#include<bits/stdc++.h>
using namespace std;
#define dump(x) cout << (x) << endl

long long a[100000];
pair<long long ,long long > memo[100000];

int main()
{
        int n,m;
        cin>>n>>m;
        for(int i = 0;i<n;i++)
        {
                scanf("%lld",&a[i]);
        }

        for(int i = 0;i<m;i++)
        {
                scanf("%lld%lld",&memo[i].second,&memo[i].first);
        }
        sort(a,a+n);
        sort(memo,memo+m);


        int ind = 0;
        for(int i = m-1;i>=0;i--)
        {
                long long num = memo[i].second;
                long long val = memo[i].first;
                while(num)
                {
                        if(ind>=n)
                                goto loop_end;

                        if(val > a[ind]){
                                a[ind++] = val;
                                num--;
                        }else{
                                goto loop_end;
                        }
                }
        }
loop_end:;

        long long ans = 0 ;
        for(int i = 0;i<n;i++)
        {
                ans += a[i];
        }
        printf("%lld\n",ans);



}

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

int main() {
    string s;
    string t;
    int correct = 0;
    cin >> s;
    cin >> t;
    for(int i = 0; i < s.length(); i++) {
        if(s[i] == t[i]) {
            correct++;
        }
    }
    cout << correct << endl;
}

Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define ALL(x) (x).begin(), (x).end()
typedef long long ll;
typedef pair<int, int> pii;
const int INF = 1e9;
const int MOD = 1000000007;
const double PI = acos(-1);
int dx[4] = {0,1,0,-1};
int dy[4] = {1,0,-1,0};

void solve() {
  int n, m, c;
  cin >> n >> m >> c;
  vector<int> b(n);
  vector<vector<int>> a(n, vector<int>(m));
  rep(i,m) cin >> b[i];
  rep(i,n) rep(j,m) cin >> a[i][j];
  int ans = 0;
  rep(i,n) {
    int temp = 0;
    rep(j,m) temp += b[j] * a[i][j];
    if (temp + c > 0) ans++;
  }
  cout << ans << endl;
}

int main() {
  solve();
  return 0;
}

Measured memory_bytes: 3572
use std::io::{stdin, Read, StdinLock};
use std::str::FromStr;

struct Scanner<'a> {
    cin: StdinLock<'a>,
}
 
impl<'a> Scanner<'a> {
    fn new(cin: StdinLock<'a>) -> Scanner<'a> {
        Scanner { cin: cin }
    }
 
    fn read1<T: FromStr>(&mut self) -> Option<T> {
        let token = self.cin.by_ref().bytes().map(|c| c.unwrap() as char)
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect::<String>();
        token.parse::<T>().ok()
    }
 
    fn read<T: FromStr>(&mut self) -> T {
        self.read1().unwrap()
    }
}
fn main (){
    let cin = stdin();
    let cin = cin.lock();
    let mut sc = Scanner::new(cin);
    let i1 :i32= sc.read();
    let mut i = 0;
    loop {
        if i * i > i1 {
            break;
        }
         i += 1;
    }
    println!("{}", (i -1) * (i-1));
}


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

using ll = long long int;

const int MAX = (int)(1e1 + 5);
const ll INF = (ll)(1e10 + 5);

int n, m;
vector<vector<int>> graph(MAX);

int ans = 0;

void dfs(int node, set<int> visited) {
  if (visited.size() == n) {
    ans += 1;
    return;
  }

  for (auto next: graph[node]) {
    if (visited.find(next) == visited.end()) {
      set<int> new_visited = visited;
      new_visited.insert(next);
      dfs(next, new_visited);
    }
  }
}

int main(void) {
  // Here your code !
  scanf("%d %d", &n, &m);

  for (int i = 0; i < m; ++i) {
    int a, b;
    scanf("%d %d", &a, &b);
    graph[a].push_back(b);
    graph[b].push_back(a);
  }

  set<int> visited;
  visited.insert(1);

  dfs(1, visited);

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

  return 0;
}


Measured memory_bytes: 256
//↓template↓

#include "bits/stdc++.h"
using namespace std;
#define Would
#define you
#define all(n)  n.begin(),n.end()
const long long INF = 1e18;
const long long MOD = 1e9 + 7;
const double pi = acos(-1);
const int SIZE = 1 << 17;
int dx[] = { 1,0 }, dy[] = { 0,1 }, alp[30];
long long fac[200005], finv[200005], inv[200005];
vector<long long>dij;
struct edge { long long to, cost; };
vector<vector<edge> >G;

long long mod_pow(long long a, long long b) {
	long long res = 1, mul = a;
	for (int i = 0; i < 31; ++i) {
		if (b >> i & 1) {
			res *= mul;
			res %= MOD;
		}
		mul = (mul * mul) % MOD;
	}

	return res;
}

void addedge(int from, int to, int cost) {
	G[from].push_back({ to,cost });
	G[to].push_back({ from,cost });
}

//↑template↑

char out = 'C';
int main() {
	int a, b, c;
	cin >> a >> b >> c;
	int ans = max({ a,b,c });

	if (ans == a) { out = 'A'; }
	else if (ans == b) { out = 'B'; }

	cout << out << endl;
}


Measured memory_bytes: 3104
#include <bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define int long long int
#define pb push_back
#define mk make_pair
#define flp(i, n) for(int i=0; i<n; i++)
#define F first
#define S second

bool compare(int a, int b)
{
	return (a>b);
}
int32_t main(void)
{
	int x, y, n1, n2, n3, score=0;
	cin>>x>>y>>n1>>n2>>n3;
	vector<int> a(n1), b(n2), c(n3);
	
	flp(i, n1) cin>>a[i];
	flp(i, n2) cin>>b[i];
	flp(i, n3) cin>>c[i];

	sort(a.begin(), a.end(), greater<int>());
	sort(b.begin(), b.end(), greater<int>());
	sort(c.begin(), c.end(), greater<int>());
	vector<int> ans;

	flp(i, x) ans.pb(a[i]);
	flp(i, y) ans.pb(b[i]);
	flp(i, n3) ans.pb(c[i]);
	sort(ans.begin(), ans.end(), greater<int>());
	flp(i, x+y) score+=ans[i];
	cout<<score<<"\n";
	return 0;
}

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

int main(){
    string S,T;
    cin >> S >> T;
    int naga=S.length();
    int counta=0;
    int i;
    for(i=0; i<naga; i++){
        if(S[i]!=T[i]){
            counta++;
        }
    }
    cout << counta << endl;
    system("pause");
    return 0;
}

Measured memory_bytes: 3916
#import pysnooper
#import numpy
#import os,re,sys,operator
#from collections import Counter,deque
#from operator import itemgetter
#from itertools import accumulate,combinations,groupby,combinations_with_replacement,permutations
from sys import stdin,setrecursionlimit
#from copy import deepcopy
import heapq
#import math
#import string

setrecursionlimit(10**6)
input=stdin.readline

n,m=map(int,input().split())
a=[-int(i) for i in input().split()]

heapq.heapify(a)
for _ in range(m):
    now=-heapq.heappop(a)
    now//=2
    heapq.heappush(a,-now)
print(-sum(a))

Measured memory_bytes: 14172
#include<stdio.h>
int main(){
	int i,j,n[3],m[3],tmp;
	for(i=0;i<3;i++){
		scanf("%d",&m[i]);
		n[i]=0;
	}
	for(i=0;i<3;i++){
		if(m[i]>n[0]){
			tmp=n[0];
			n[0]=m[i];
			m[i]=tmp;
		}
		if(m[i]>n[1]){
			tmp=n[1];
			n[1]=m[i];
			m[i]=tmp;
		}
		if(m[i]>n[2]){
			tmp=n[2];
			n[2]=m[i];
			m[i]=tmp;
		}
	}
		printf("%d %d %d\n",n[2],n[1],n[0]);
	return 0;
}

Measured memory_bytes: 596
#include<stdio.h>

int main()
{
    long long h[100000],x,temp;
    int i,k,j;
    for(i=1;i<=10;i++)
    {
        scanf("%lld",&h[i]);
    }
    for(j=1;j<=3;j++)
    {
        x=h[j];
        temp =0;
        for(k=j+1;k<=10;k++)
        {
            if(h[k]>x)
            {
               temp=x;
               x=h[k];
               h[k]=temp;
            }
        }
        printf("%lld\n",x);
    }
    return 0;
}

Measured memory_bytes: 604
#include <iostream>
#include <algorithm>
#include <vector>

using namespace std;

int main(){
    int n;
    cin >> n;
    vector<int> height(n);
    for(int i = 0; i < n; i++){
        cin >> height[i];
    }
    
    vector<int> dp(n);
    dp[0] = 0;
    dp[1] = abs(height[0] - height[1]);
    
    for(int j = 2; j < n; j++){
        dp[j] = min(dp[j-1] + abs(height[j-1] - height[j]), dp[j-2] + abs(height[j-2] - height[j]));
    }
    
    cout << dp[n-1];
    
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define rep(i, n) for (ll i = 0; i < n; i++)
#define FOR(i, a, b) for (ll i = a; i < b; i++)
#define is(a, b) a == b
#define len(v) ll(v.size())

//vector書き出し
template <class T>
void cout_vec(const vector<T> &vec1){
  rep(i,len(vec1)){
    cout<<vec1[i]<<' ';
  }
  cout<<'\n';
}

typedef pair<ll,ll> P;
const ll mod=1e9+7;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll x;
    cin>>x;
    vector<ll> sum;
    sum.push_back(1);
    ll cnt=2;
    while(sum.back()<=1e9){
      sum.push_back(cnt+sum.back());
      cnt++;
    }
    cout<<lower_bound(begin(sum),end(sum),x)-begin(sum)+1<<endl;
}

Measured memory_bytes: 892
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define inf 1e15
string st,st2;
ll dp[1003][1003];
ll N,M;
/*ll call(ll pos,ll pos2)
{
    if(pos==N)
    {
        if(M==pos2)
        {
            return 0;
        }
        else
        {
            return inf;
        }
    }
    if(pos2==M)
    {
        return 0;
    }
    if(dp[pos][pos2]!=-1)
    {
        return dp[pos][pos2];
    }

    ll x,y;
    if(st[pos]==st[pos2])
    {
        x=call(pos+1,pos2+1);
    }
    else
    {
        x=call(pos+1,pos2);
        y=1+call(pos+14,pos2+1);
        x=min(x,y);
    }
    return x;
}*/
int main()
{
    ll a,b,c,d,e,i,j,k,l,n,m,x,y,t,p;
    cin>>st;
    cin>>st2;
    n=st.size();
    m=st2.size();
    ll ans=inf;
    for(i=0;i<n;i++)
    {
        if(i+m>n)
        {
            break;
        }
        d=i+m;
        x=0;
        for(j=i;j<d;j++)
        {
            if(st[j]!=st2[j-i])
            {
                x++;
            }
        }
        ///cout<<x<<endl;
        ans=min(x,ans);
    }
    cout<<ans<<endl;
}


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

#define REP(i, n) for(int i = 0; i < (int)(n); ++i)
#define FOR(i, m, n) for(int i = (m); i < (int)(n); ++i)
#define ALL(x) (x).begin(), (x).end()
#define INF 2000000000
//#define int long long int

#ifdef LOCAL
  #define eprintf(...) fprintf(stdout, __VA_ARGS__)
#else
  #define eprintf(...) 0
#endif

using namespace std;

typedef long long LL;
typedef unsigned long long ULL;
typedef unsigned int uint;

int main() {
  int n, t;
  cin >> n >> t;
  ULL ans = 0;
  ULL til = 0; 
  ULL p;
  REP(i, n) {
    scanf("%lld", &p);
    if(p <= til) {
      ans += p - (til - t);
      til += p - (til - t);
    }
    else {
      ans += t;
      til = p + t;
    }
    eprintf("ans,til,p:%lld,%lld,%lld\n", ans, til, p);
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
  int a , b ;
  cin >> a >> b;
  if (a % 2 == 0 || b % 2 == 0){
    cout << "Even" << endl;
  }
  else {
    cout << "Odd" << endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define OP ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define F first
#define S second
#define sz(x) (int)x.size()
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for(int i = 0; i < n; ++i)
#define repr(i,n) for(int i = n - 1; i >= 0; --i)
#define Rep(i, a, n) for(int i = (a); i <=(n); ++i)
#define repst(i, n) for(auto it = n.begin(); it != n.end(); ++it)
#define Repr(i, a, n) for(int i = (n); i >= (a); --i)
typedef long long ll;
typedef std::vector<int> vi;
typedef std::pair<int, int> pii;
const int inf = int(1e9);
const int mod = inf + 7;
const double PI = acos(-1.0);
using namespace std;
const int N = 1e5 + 155;
template<typename T>
inline void read(T&x){
    x=0;int f=1;char ch = getchar();
    while(ch<'0' ||ch>'9'){ if(ch=='-')f=-1;ch=getchar(); }
    while(ch>='0' && ch<='9'){ x=x*10+ch-'0'; ch=getchar(); }
    x*=f;
}
 
 
ll bp(ll a, ll n){
	ll r = 1;
	while(n){
		if(n & 1) r = (r * a) % mod;
		a = (a * a) % mod;
		n >>= 1;
	}
	return r;
}
 
void solve(){
	stack<char> st;
	string s;
	cin >> s;
	for(char c: s) {
		if (c == '0') st.push('0');
		if (c == '1') st.push('1');
		if (c == 'B') {
			if (!st.empty()) st.pop();
		}
	}
	string ans = "";
	while(!st.empty()) {
		ans += st.top();
		st.pop();
	}
	reverse(all(ans));
	cout << ans;
}

int main(){
    OP
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    int t = 1;
	//cin >> t;
    for(int i = 1; i <= t; i++) {
        solve();
    }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int main() {
    int N, M, t;
    vector<int> a;
    cin >> N >> M;
    for (int i = 0; i < 2 * M; i++) {
        cin >> t;
        a.push_back(t);
    }
    for (int i = 1; i <= N; i++) cout << count(a.begin(), a.end(), i) << endl;
}

Measured memory_bytes: 256
from sys import stdin
N, M = [int(_) for _ in stdin.readline().rstrip().split()]
SC = [list(map(int, stdin.readline().rstrip().split())) for _ in range(M)]
ans = -1

def solve(num):
    if len(num) != N:
        return False
    for sc in SC:
        if int(num[sc[0]-1]) != sc[1]:
            return False
    return True
  
for i in range(10**5):
    num = str(i)
    if solve(num):
        ans = num
        break
print(ans)

Measured memory_bytes: 3064
#!/bin/bash
read N
read v
while read line
do
  line=$((line*100000))
  if [[ -n $pre ]]; then
    pre=$(((line+pre)/2))
  else
    pre=$line
  fi
done <<EOF
  `echo $v | xargs -n1 echo | sort -n`
EOF
echo $((pre)) | \
sed -e 's/\(.\{5\}\)$/.\1/'

Measured memory_bytes: 880
n=int(input())
p=list(map(float,input().split(" ")))
mat=[]

for i in range(n):
	temp=[0]*(i+1+1)
	if(i==0):
		temp[0]=1-p[0]
		temp[1]=p[0]
	else:
		prev=mat[-1]

		for j in range(len(prev)):
			temp[j]+=prev[j]*(1-p[i])
			temp[j+1]+=prev[j]*p[i]


	mat.append(temp)
ans=0
temp=mat[-1]
for i in range((n//2)+1,len(temp)):
	ans+=temp[i]
# print(temp)
print(ans)

Measured memory_bytes: 140380
#include <iostream>
#include <algorithm>
#include <math.h>
#include <vector>
#include <string>
#include <queue>
#include <map>
#include <utility>
#include <iomanip>  // std::setprecision()
using namespace std;
using ll = long long;
#define rep(i,a,b) for(int i=(a); i<(b); i++)
#define YES cout << "YES" << endl;
#define NO cout << "NO" << endl;
#define yes cout << "Yes" << endl;
#define no cout << "No" << endl;
#define pai 3.14159265358979323846
ll gcd(ll a, ll b){if (a%b == 0)  return(b);else  return(gcd(b, a%b));}
ll lcm(ll a, ll b){return a * b / gcd(a, b);}
/* map<string,int> */
/* 大文字を小文字に変換 tolower*/
/* 小文字を大文字に変換 toupper*/
/* 辞書順 next_permutation(a.begin(),a.end()) */
 
int main() {
    ll n;
    cin >> n;
    vector <ll> a(n);
    map <ll, bool> b;
    rep(i, 0,n) {
        cin >> a[i];
        auto v = b.find(a[i]);
        if (v != b.end()) {
            b.erase(v);
        } else {
            b[a[i]] = true;
        }
    }
    ll ans = b.size();
    cout << ans << endl;
}

Measured memory_bytes: 9824
#include<bits/stdc++.h> 
using namespace std;
const int mod=1e9+7;
long long fastpow(long long a,long long b)
{
    long long res=1;
    while(b)
	{
        if(b&1)
            res=res*a%mod;
        a=a*a%mod;
        b>>=1;
    }
    return res;
}
int main()
{
	int n;
	cin>>n;
	cout<<((fastpow(10,n)-2*fastpow(9,n)+fastpow(8,n))%mod+mod)%mod<<endl;
	return 0;
}

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

using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define erep(i, n) for (ll i = 0; i <= (ll)(n); ++i)
#define FOR(i,a,b) for (ll i = (a); i < (ll)(b); ++i)
#define EFOR(i,a,b) for (ll i = (a); i <= (ll)(b); ++i)
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } }




int main() {
    ll n,d,a; cin >> n >> d >> a;
    vector<pair<ll,ll>> xh(n);
    rep(i, n) {
        cin >> xh[i].first >> xh[i].second;
    }
    // 位置順でソート
    sort(xh.begin(), xh.end());

    // 現在の位置で与えられるダメージ
    ll total = 0;

    // 爆弾の範囲を管理するキュー
    queue<pair<ll, ll>> q;
    ll ans = 0;

    // 左の敵から順に見ていく
    rep(i, n) {
        ll x = xh[i].first;
        ll h = xh[i].second;

        // 今の位置で過去に打った爆弾の範囲から抜けるなら抜く
        while(!q.empty() && q.front().first < x) {
            total -= q.front().second;
            q.pop();
        }

        // 過去に打たれた爆弾分のダメージを与える
        h -= total;
        // まだ体力が残っていれば爆弾をうつ
        if(h > 0) {
            ll count = (h+(a-1))/a;
            // 爆弾を打った回数を解にたす
            ans += count;
            // 範囲ダメージに加算
            total += count*a;
            // 範囲ダメージを抜ける位置を記録しておく
            q.emplace(x+(2*d), count*a);
        }
    }

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


Measured memory_bytes: 5120
L = str(input())
L = list(L)
N = len(L)
if '0' not in L:
    L = ['0']*(N+1)
    L[0] = '1'
    N += 1
else:
    for i in range(N):
        t = L[N-i-1]
        if t == '0':
            L[N-i-1] = '1'
            break
        else:
            L[N-i-1] = '0'
L = ''.join(L)
dic2 = {}
dic3 = {}
sum = 0
for i in range(N):
    t = L[N-i-1]
    if i == 0:
        dic2[0] = 1
        dic3[0] = 1
    else:
        dic2[i] = (dic2[i-1] * 2)%(10**9+7)
        dic3[i] = (dic3[i-1] * 3)%(10**9+7)
num1 = 0
for i in range(N):
    t = int(L[i])
    if t == 1:
        sum += dic3[N-i-1] * dic2[num1]
        sum = sum % (10**9+7)
        num1 += 1
print(sum)


Measured memory_bytes: 63468
import sys
input = lambda: sys.stdin.readline().rstrip() 
from collections import deque

def resolve():
    n = int(input())
    ukv = [list(map(int, input().split())) for _ in range(n)]

    dist = [-1]*n
    que = deque()

    que.append(0)
    dist[0] = 0
    while len(que)>0:
        v = que.popleft()
        for i in ukv[v][2:]:
            if dist[i-1]==-1:
                que.append(i-1)
                dist[i-1] = dist[v]+1

    for i in range(n):
        print(i+1, dist[i])

if __name__ == '__main__':
    resolve()


Measured memory_bytes: 6032
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;

class Solver {
    Scanner sc = new Scanner();

    public void Solve() {
        var X = sc.nextInt();
        var A = sc.nextInt();
        if (X < A) {
            WriteLine(0);
        } else {
            WriteLine(10);
        }
    }
}

class Combination {
    static int mod = 1000000007;

    public static long Calc(int a, int b) {
        if (b > a - b) return Calc(a, a - b);

        long ansMul = 1;
        long ansDiv = 1;
        for (int i = 0; i < b; i++) {
            ansMul *= (a - i);
            ansDiv *= (i + 1);
            ansMul %= mod;
            ansDiv %= mod;
        }
        return ansMul * ModPow(ansDiv, mod - 2) % mod;
    }

    private static long ModPow(long a, int p) {
        if (p == 0) return 1;
        if (p % 2 == 0) {
            long half = ModPow(a, p / 2);
            return half * half % mod;
        } else {
            return a * ModPow(a, p - 1) % mod;
        }
    }
}

class Scanner {
    string[] s;
    int i;

    char[] cs = new char[] { ' ' };

    public Scanner() {
        s = new string[0];
        i = 0;
    }

    public string next() {
        if (i < s.Length) return s[i++];
        string st = Console.ReadLine();
        while (st == "") st = Console.ReadLine();
        s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        if (s.Length == 0) return next();
        i = 0;
        return s[i++];
    }

    public int nextInt() {
        return int.Parse(next());
    }
    public int[] ArrayInt(int N, int add = 0) {
        int[] Array = new int[N];
        for (int i = 0; i < N; i++) {
            Array[i] = nextInt() + add;
        }
        return Array;
    }

    public long nextLong() {
        return long.Parse(next());
    }

    public long[] ArrayLong(int N, long add = 0) {
        long[] Array = new long[N];
        for (int i = 0; i < N; i++) {
            Array[i] = nextLong() + add;
        }
        return Array;
    }

    public double nextDouble() {
        return double.Parse(next());
    }

    public double[] ArrayDouble(int N, double add = 0) {
        double[] Array = new double[N];
        for (int i = 0; i < N; i++) {
            Array[i] = nextDouble() + add;
        }
        return Array;
    }
}

class Program {
    static void Main(string[] args) {
        Solver s = new Solver();
        s.Solve();
    }
}


Measured memory_bytes: 13140
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <string>
#include <vector>
#include <limits>
// #include <algorithm>
// #include <utility>
// #include <sstream>
// #include <numeric>

#include <map>

using namespace std;

#define repd(i,a,b) for (int i=(a);i<(b);++i)
#define rep(i,n) repd(i,0,n)
typedef long long ll;
typedef pair<int, int> P;

int main(int argc, const char * argv[]) {
  int n, m;
  cin >> n >> m;
  vector<bool> ans(n+1, false);
  int count = 0;
  int pena = 0;
  map<int, int> mp;
  rep(i, m){
    int p;
    string s;
    cin >> p >> s;
    if (s == "AC" && !ans[p]){
      ans[p] = true;
      count++;
    }else if(s == "WA" && !ans[p]){
      mp[p]++;
    }
  }

  rep(i, n){
    if (ans[i+1]) pena += mp[i+1];
  }

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



Measured memory_bytes: 4992
#include <stdio.h>

int main(){
    int i, j, n, temp;
    double v[51];
    scanf("%d", &n);
    for(i=0; i<n; i++) scanf("%lf", &v[i]);
    
    for(i=0; i<n; i++){
        for(j=n-1; j>i; j--){
            if(v[j]<v[j-1]){
                temp=v[j-1];
                v[j-1]=v[j];
                v[j]=temp;
            }
        }
    }
    for(i=0; i<n-1; i++){
        v[i+1] = (v[i]+v[i+1])/2;
    }
    printf("%.5f\n", v[n-1]);
    return 0;
}


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

int main(){
  int n;
  cin >> n;
  
  // カードを取得
  vector<int> cards(n);
  for (int i=0; i<n; i++){
    cin >> cards.at(i);
  }
  // ソート
  sort(cards.begin(), cards.end());
  reverse(cards.begin(), cards.end());
  
  int alice = 0;
  int bob = 0;
  for (int i=0; i<n; i++){
    if (i%2==0){
      // alice
      alice += cards.at(i);
    } else {
      // bob
      bob += cards.at(i);
    }
  }
  cout << alice - bob << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#ifdef TEST
#define getchar_unlocked _getchar_nolock
#endif
#define int long long
#define ins insert
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define pf push_front
#define pp pop
#define ppb pop_back
#define ppf pop_front
#define eb emplace_back
#define g0(a) get<0>(a)
#define g1(a) get<1>(a)
#define g2(a) get<2>(a)
#define g3(a) get<3>(a)
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
typedef double db;
typedef long long ll;
typedef pair<int, int> ii;
typedef tuple<int, int, int> iii;
typedef tree<pair<int, int>, null_type, less<pair<int, int> >, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

int N, tt, A[200005];

main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	map<int, int> cnt;
	cin >> N;
	for (int i = 1; i <= N; i++) cin >> A[i];
	for (int i = 1; i <= N; i++) {
		tt += cnt[A[i] - i];
		cnt[-A[i] - i]++;
	}
	cout << tt << '\n';
}


Measured memory_bytes: 27968
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vint;
typedef pair<int,int> pint;
typedef vector<pint> vpint;
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,n) for(int i=n-1;i>=(0);i--)
#define reps(i,f,n) for(int i=(f);i<(n);i++)
#define each(it,v) for(__typeof((v).begin()) it=(v).begin();it!=(v).end();it++)
#define all(v) (v).begin(),(v).end()
#define eall(v) unique(all(v), v.end())
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
const int MOD = 1e9 + 7;
const int INF = 1e9;
const ll INFF = 1e18;

string a, b, c;
int main(void){
	cin >> a >> b >> c;
	string s;
	s += a[0] - 'a' + 'A';
	s += b[0] - 'a' + 'A';
	s += c[0] - 'a' + 'A';
	cout << s << endl;
 	return 0;
}

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

Measured memory_bytes: 256
import java.util.Scanner;
import java.util.Arrays;
import java.util.ArrayDeque;
import java.util.Queue;
import java.util.LinkedList;

public class Main {

    int N, M;
    boolean graph[][] = new boolean[50][50];
    boolean visited[] = new boolean[50];
    int a[] = new int[50];
    int b[] = new int[50];

    public static void main(String[] args) {
        new Main().solve();
    }

    void dfs(int v) {
        visited[v] = true;
        for (int v2 = 0; v2 < N; v2++) {
            if (graph[v][v2] == false) {
                continue;
            }
            if (visited[v2] == true) {
                continue;
            }
            dfs(v2);
        }
    }

    void solve() {
        Scanner sc = new Scanner(System.in);
        N = sc.nextInt();
        M = sc.nextInt();
        for (int i = 0; i < M; i++) {
            a[i] = sc.nextInt();
            b[i] = sc.nextInt();
            a[i]--;
            b[i]--;
            graph[a[i]][b[i]] =graph[b[i]][a[i]] = true;
        }
        int ans = 0;
        for (int i = 0; i < M; i++) {
            graph[a[i]][b[i]] = graph[b[i]][a[i]] = false;
            for (int j = 0; j < N; j++) {
                visited[j] = false;
            }
            dfs(0);
            boolean judge = false;
            for (int j = 0; j < N; j++) {
                if (visited[j] == false) {
                    judge = true;
                }
            }
            if (judge) {
                ans++;
            }
            graph[a[i]][b[i]] = graph[b[i]][a[i]] = true;
        }
        System.out.println(ans);
    }

}


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


#define li          long long int
#define rep(i,to)   for(li i=0;i<((li)(to));i++)
#define repp(i,start,to)    for(li i=(li)(start);i<((li)(to));i++)
#define pb          push_back
#define sz(v)       ((li)(v).size())
#define bgn(v)      ((v).begin())
#define eend(v)     ((v).end())
#define allof(v)    (v).begin(), (v).end()
#define dodp(v,n)       memset(v,(li)n,sizeof(v))
#define bit(n)      (1ll<<(li)(n))
#define mp(a,b)     make_pair(a,b)
#define rin rep(i,n)
#define EPS 1e-12
#define ETOL 1e-8
#define MOD 1000000007
typedef pair<li, li> PI;

#define INF bit(60)

#define DBGP 1


#define idp if(DBGP)
#define F first
#define S second
#define p2(a,b)     idp cout<<a<<"\t"<<b<<endl
#define p3(a,b,c)       idp cout<<a<<"\t"<<b<<"\t"<<c<<endl
#define p4(a,b,c,d)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<endl
#define p5(a,b,c,d,e)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<endl
#define p6(a,b,c,d,e,f)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<endl
#define p7(a,b,c,d,e,f,g)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<endl
#define p8(a,b,c,d,e,f,g,h)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<endl
#define p9(a,b,c,d,e,f,g,h,i)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<"\t"<<i<<endl
#define p10(a,b,c,d,e,f,g,h,i,j)        idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<"\t"<<i<<"\t"<<j<<endl
#define foreach(it,v)   for(__typeof((v).begin()) it=(v).begin(); it!=(v).end(); ++it)
#define p2p(x)      idp p2((x).F, (x).S)
#define dump(x,n)   idp{rep(i,n){cout<<x[i]<<" ";}puts("");}
#define dump2(x,n)  idp{rep(i,n){cout<<"["<<x[i].F<<" , "<<x[i].S<<"] ";}puts("");}
#define dumpi(x)    idp{foreach(it, x){cout<<(*it)<<" ";}puts("");}
#define dumpi2(x)   idp{foreach(it, x){cout<<"["<<(it)->F<<" , "<<(it)->S<<"] ";}puts("");}

#define read2d(a,w,h)   rep(i,h)rep(j,w)cin>>a[i][j]
#define dump2d(a,w,h)   rep(i,h){rep(j,w)cout<<a[i][j]<<" ";puts("");}

typedef pair<li, li> PI;

#define UF_NUM 505050

li cnt[2];

int main() {
    li a, b, c;
    cin >> a >> b >> c;
    cout << min(c, b / a) << endl;


    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pll;
typedef pair<int,int> pii;
#define F(i,a,b) for(int i=int(a);i<=int(b);i++)
#define endl "\n"
#define ios std::ios::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define out(x) cout<<x<<endl,exit(0);
#define pb push_back
#define all(v) v.begin(),v.end()
#define I first
#define S second

const int N=3005;
int dp[N][N];

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

	F(i,1,s.size()){
		F(j,1,t.size()){
			if(s[i-1]==t[j-1]){
				dp[i][j]=dp[i-1][j-1]+1;
			}
			else dp[i][j]=max(dp[i-1][j],dp[i][j-1]);
		}
	}

	int i=s.size(),j=t.size();
	while(i>0 && j>0){
		if(max(dp[i-1][j],dp[i][j-1])<dp[i][j]){
			ans+=s[i-1];
			i--,j--;
		}
		else{
			if(dp[i][j]==dp[i-1][j]) i--;
			else j--;
		}
	}
	reverse(all(ans));
	cout<<ans;
}

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

// #define int long long
#define rep(i, n) for (long long i = (long long)(0); i < (long long)(n); ++i)
#define reps(i, n) for (long long i = (long long)(1); i <= (long long)(n); ++i)
#define rrep(i, n) for (long long i = ((long long)(n)-1); i >= 0; i--)
#define rreps(i, n) for (long long i = ((long long)(n)); i > 0; i--)
#define irep(i, m, n) for (long long i = (long long)(m); i < (long long)(n); ++i)
#define ireps(i, m, n) for (long long i = (long long)(m); i <= (long long)(n); ++i)
#define SORT(v, n) sort(v, v + n);
#define REVERSE(v, n) reverse(v, v+n);
#define vsort(v) sort(v.begin(), v.end());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
#define PI (acos(-1))
#define FILL(v, n, x) fill(v, v + n, x);
#define sz(x) long long(x.size())

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vs = vector<string>;
using vpll = vector<pair<ll, ll>>;
using vtp = vector<tuple<ll,ll,ll>>;
using vb = vector<bool>;

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

const ll INF = 1e9;
const ll MOD = 1e9+7;
const ll LINF = 1e18;



signed main()
{
  cin.tie( 0 ); ios::sync_with_stdio( false );
  ll n,k; cin>>n>>k;
  
  ll ma=(n-1)*(n-2)/2;
  if(ma<k){
    cout<<-1<<endl;
    return 0;
  }
  
  vpll v;
  rep(i,n-1){
    v.emplace_back(n,i+1);
  }
  
  ll cnt=ma-k;
  if(cnt){
    reps(i,n-2){
      ireps(j,i+1,n-1){
        v.emplace_back(i,j);
        cnt--;
        if(cnt<=0) break;
      }
      if(cnt<=0) break;
    }
  }
  
  cout<<v.size()<<endl;
  rep(i,v.size()){
    cout<<v[i].first<<' '<<v[i].second<<endl;
  }
  
}

Measured memory_bytes: 512
#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>
#include <stdio.h>
#include <iomanip>
#include <limits>
#include <list>
#include <queue>
#include <tuple>
#include <map>
#include <set>
#include <sstream>
using namespace std;
#define MOD (long long int)(1e9+7)
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
#define REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define FOR(i,a,b) for(int i=a; i<(int)(b); i++)
#define ALL(x) (x).begin(),(x).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define SORT(c) sort(ALL(x))
#define CLR(a) memset((a), 0 ,sizeof(a))
#define PB push_back
#define MP make_pair
#define SP << " " <<
const int INF = 1001001001;
const ll LINF = 100100100100100100;
const double EPS = 1e-10;
const double PI  = acos(-1.0);
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;

template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){

    std::fill( (T*)array, (T*)(array+N), val );
}

__attribute__((constructor))
void initial(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(15);
}

signed main(){
  int n; cin>>n;
  VI a(n); rep(i,n) cin>>a[i];
  ll ans = 0;
  rep(i,n-1){
    ans += a[i]/2;
    a[i] -= (a[i]/2)*2;
    ans += min(a[i],a[i+1]);
    a[i+1] -= min(a[i],a[i+1]);
    a[i+1] = max(0,a[i+1]);
  }
  ans += a[n-1]/2;
  cout << ans << endl;
  return 0;
}


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

int n, y;

int main(){
    cin >> n >> y;
    bool check = false;
    for (int i = 0; i <= n; i++)
        for (int j = 0; j <= n; j++){
            if (10000*i + 5000* j + 1000*(n - i - j) == y && n - i - j >= 0){
                cout << i << " " << j <<" "<< n - i - j;
                check = true;
                return 0;
            }
        }
    if (!check) cout << "-1 -1 -1";
}

Measured memory_bytes: 256
from collections import deque

H, W = list(map(int, input().split()))
Ch, Cw = list(map(lambda x: int(x) - 1, input().split()))
Dh, Dw = list(map(lambda x: int(x) - 1, input().split()))
S = [input() for _ in range(H)]
maze = [[-1]*W for _ in range(H)]

def walk(h, w, warp_n):
    ans = []
    if maze[h][w] != -1:
        return []
    else:
        maze[h][w] = warp_n
        ans += [(h, w)]
        
    return ans

queue = deque([(Ch, Cw, 0)])
while queue:
    h, w, warp_n = queue.popleft()
    if maze[h][w] != -1:
        continue
    maze[h][w] = warp_n
    # walk
    for dh, dw in [(-1, 0), (1, 0), (0, -1), (0, 1)]:
            if not (0 <= h+dh < H and 0 <= w+dw < W):
                continue
            if S[h+dh][w+dw] == '#':
                continue
            queue.appendleft((h+dh, w+dw, warp_n))
    # warp
    for dh in range(-2, 3):
        for dw in range(-2, 3):
            if not (0 <= h+dh < H and 0 <= w+dw < W):
                continue
            if S[h+dh][w+dw] == '#':
                continue
            if dh == 0 and dw == 0:
                continue
            queue.append((h+dh, w+dw, warp_n+1))

print(maze[Dh][Dw])

Measured memory_bytes: 255092
#include<iostream>
using namespace std;
int main() {

	int d;
	cin >> d;
	int c[26];
	int i, j;
	for (i = 0; i < 26; i++) {
		cin >> c[i];
	}
	int s[365][26];
	for (i = 0; i < d; i++) {
		for (j = 0; j < 26; j++) {
			cin >> s[i][j];
		}
	}
	int last[26];
	for (i = 0; i < 26; i++) {
		last[i] = 0;
	}
	int jmax, jindex;
	for (i = 1; i <= d; i++) {

		jmax = 0;
		jindex = -1;
		for (j = 0; j < 26; j++) {
			if (c[j] *(i - last[j]) > jmax) {
				jmax = c[j] *(i - last[j]);
				jindex = j;
			}
			else if (c[j] *(i - last[j]) == jmax) {
				if (s[i-1][j] > s[i-1][jindex]) {
					jindex = j;
				}
			}
		}
		last[jindex] = i;
		cout << jindex + 1 << endl;
		


	}
	return 0;


}

Measured memory_bytes: 3692
N = int(input())
H = list(map(int,input().split()))
flag = 0
hmax = H[0]
for i in range(1,N):
    h = H[i]
    if hmax-h>=2:
        flag = 1
        break
    hmax = max(hmax,h)
if flag==0:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 84888
//
//  D - Grid Repainting.cpp
//  AtCoder Beginner Contest 088
//
//  Created by Huang,Zhiqiang on 2018/2/18.
//  Copyright © 2018年 Huang,Zhiqiang. All rights reserved.
//

#include <iostream>
#include <vector>
#include <queue>
using namespace std;
int H, W;

vector<int> dx = {0, 0, -1, 1};
vector<int> dy = {-1, 1, 0, 0};

int main() {
    cin >> H >> W;
    int sum = 0;
    vector<vector<char>> grid(H, vector<char>(W, '.'));
    vector<vector<int>> dist(H, vector<int>(W, INT32_MAX));
    for (int i = 0; i < H; i++) {
        for (int j = 0; j < W; j++) {
            cin >> grid[i][j];
            if (grid[i][j] == '.') {
                sum++;
            }
        }
    }
    dist[0][0] = 0;
    queue<pair<int, int>> q;
    q.push({0, 0});
    while (!q.empty()) {
        pair<int, int> pl = q.front();
        q.pop();
        int x = pl.first;
        int y = pl.second;
        for (int i = 0; i < 4; i++) {
            int new_x = x + dx[i];
            int new_y = y + dy[i];
            if (new_x >= 0 && new_x < H && new_y >= 0 && new_y < W) {
                if (grid[new_x][new_y] == '.' && dist[new_x][new_y] > dist[x][y] + 1) {
                    dist[new_x][new_y] = dist[x][y] + 1;
                    q.push({new_x, new_y});
                }
            }
        }
    }
    if (dist[H - 1][W - 1] == INT32_MAX) {
        cout << -1 << endl;
    } else {
        cout << sum - dist[H - 1][W - 1] - 1 << endl;
    }
}


Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
#define N 100009



struct Num{
    int a;
    int b;
};




int cmp(const void * n1, const void * n2)
{
	if (((Num*)n1)->b > ((Num *)n2)->b)
	{
		return 1;
	}
	else if (((Num*)n1)->b < ((Num*)n2)->b)
	{
		return -1;
	}
	else
	{
		return 0;
	}
}

int main(){
    int n,c;
    cin>>n;
    struct Num num[n];
    for (int i=0; i<n; i++){
        cin>>c;
        num[i].a=i+1;
        num[i].b=c;
    }
    
    int p = sizeof num / sizeof( Num );
    //cout<<p;
    qsort(num,p,sizeof(Num),cmp);
    
    for (int i=0; i<n; i++){
        cout<<num[i].a<<" "<<endl;
    }
}

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

typedef long long LL;

#define FOR(i, a, b) for (LL i = (a), i##_END_ = (b); i <= i##_END_; i++)
#define DNF(i, a, b) for (LL i = (a), i##_END_ = (b); i >= i##_END_; i--)

template <typename Tp> void in(Tp &x) {
	char ch = getchar(), f = 1; x = 0;
	while (ch != '-' && (ch < '0' || ch > '9')) ch = getchar();
	if (ch == '-') ch = getchar(), f = -1;
	while (ch >= '0' && ch <= '9') x = x * 10 + ch - '0', ch = getchar();
	x *= f;
}

template <typename Tp> void out(Tp x) {
	if (x > 9) out(x / 10);
	putchar(x % 10 + '0');
	return;
}

template <typename Tp> Tp Max(const Tp &x, const Tp &y) {return x > y ? x : y;}
template <typename Tp> Tp Min(const Tp &x, const Tp &y) {return x < y ? x : y;}
template <typename Tp> bool chkmax(Tp &x, Tp y) {return x >= y ? 0 : (x=y, 1);}
template <typename Tp> bool chkmin(Tp &x, Tp y) {return x <= y ? 0 : (x=y, 1);}

const LL MAXN = 100010;

LL n, l, t, pos[MAXN], rnk[MAXN], pre[MAXN];

bool cmp(const LL &x, const LL &y)
{
	return pre[x] < pre[y];
}

int main()
{
	in(n); in(l); in(t);

	LL radix = 0;
	
	FOR(i, 1, n) {
		LL x, w; in(x); in(w);
		pre[i] = x;
		if (w == 1) {
			pos[i] = (x + t) % l;
			radix += (x + t) / l;
			radix = (radix % n + n) % n;
		}
		else {
			pos[i] = ((x - t) % l + l) % l;
			if (x - t < 0) radix -= (t - x - 1) / l + 1;
			radix = (radix % n + n) % n;
		}
	}

	FOR(i, 1, n) rnk[i] = i;
	std::sort(rnk + 1, rnk + n + 1, cmp);

	radix %= n;

	std::sort(pos + 1, pos + n + 1);

	FOR(i, 1, n) {
		printf("%lld\n", pos[((rnk[i] + radix - 1) % n + n) % n + 1]);
	}
	
	return 0;
}


Measured memory_bytes: 3584
import sys
stdin = sys.stdin
 
sys.setrecursionlimit(10**6) 
 
def li(): return map(int, stdin.readline().split())
def li_(): return map(lambda x: int(x)-1, stdin.readline().split())
def lf(): return map(float, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())

n,h,w = li()
ans = 0
for _ in range(n):
    a,b = li()
    if a>=h and b>=w:
        ans += 1
        
print(ans)

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

using namespace std;


//repetition
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define euc_dis(x, y) sqrt(x*x + y*y)

#define MOD 1e9+7
#define sp ' '


using ll = long long;


ll mod(ll a, ll b){return (a%b+b)%b;}
ll gcd(ll a, ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b){return a*b/gcd(a,b);}
void Yes(){cout << "Yes" << endl;}
void No(){cout << "No" << endl;}
void Judge(bool b){b?Yes():No();}
void YES(){cout << "YES" << endl;}
void NO(){cout << "NO" << endl;}
void JUDGE(bool b){b?YES():NO();}
ll powMod(ll b, ll e, ll m){ll r=1;while(e>0){if(e&1)r=(r%m)*(b%m)%m;b=(b%m)*(b%m)%m;e>>=1;}return r;}
double distance(ll x1, ll y1, ll x2, ll y2){return sqrt((x1-x2)*(x1-x2) + (y1-y2)*(y1-y2));}

template<typename T>
void ppp(T n){cout << n << endl;}

int main(){

    cin.tie(0);
    ios::sync_with_stdio(false);

    int n, k;
    cin >> n >> k;

    vector<ll> h(n);
    rep(i, n){
        cin >> h[i];
    }

    sort(h.begin(), h.end());
    
    ll ans = LLONG_MAX;
    for(int i = 0; i < n-k+1; ++i){
        ans = min(ans, h[i+k-1] - h[i]);
    }

    ppp(ans);

    return 0;
}


Measured memory_bytes: 1024
import sys
import copy
from collections import deque
import collections
stdin = sys.stdin

mod = 10**9+7

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

s = ns()

if s[0]==s[1]==s[2]=='R':
    print(3)
    exit(0)

if s[0]==s[1]=='R' or s[1]==s[2]=='R':
    print(2)
    exit(0)

if 'R' in s:
    print(1)
    exit(0)

print(0)

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

typedef long long ll;

ll dist(ll a, ll b, ll c) {
	ll ret = (a - b) * (a - b);
	ret += c;
	return ret;
}

int main() {
	// ios::sync_with_stdio(false); cin.tie(NULL);
	int n;
	cin >> n;
	int a[n], b[n], c[n];
	for (int i = 0; i < n; i++)
	{
		cin >> a[i] >> b[i] >> c[i];
	}
	int d[n][3];
	for (int i = 0; i < n; i++)
	{
		if (i == 0) {d[i][0] = a[i]; d[i][1] = b[i]; d[i][2] = c[i];}
		else
		{
			d[i][0] = max(d[i - 1][1], d[i - 1][2]) + a[i];
			d[i][1] = max(d[i - 1][0], d[i - 1][2]) + b[i];
			d[i][2] = max(d[i - 1][0], d[i - 1][1]) + c[i];
		}
	}
	int m = max(d[n - 1][0], max(d[n - 1][1], d[n - 1][2]));
	cout << m << endl;
	return 0;
}


Measured memory_bytes: 5880