akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define int long long
#define rng(i, l, r) for (size_t i = (l); i < (r); ++i)
#define rep(i, n) rng(i, 0, n)
#define gnr(i, l, r) for (size_t i = (r)-1; i >= (l); i--)
#define per(i, b) gnr(i, 0, b)
#define ALL(obj) (obj).begin(), (obj).end()    //1,2,3,...
#define rALL(obj) (obj).rbegin(), (obj).rend() //...,3,2,1

using namespace std;

int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
const double pi = acos(-1);
const int MOD = 1000000007;
const int INF = 1e18;
using Graph = vector<vector<int>>;
int n, m;
Graph G;
int seen[100100];
int path[100100];

void solve()
{

    // remove the bottom 3 lines when you submit this code.
    std::ifstream in("sample.txt");
    std::cin.rdbuf(in.rdbuf());

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

    cin >> n >> m;
    G.resize(n);

    rep(i, m)
    {
        int a, b;
        cin >> a >> b;
        a--;
        b--;
        G[a].push_back(b);
        G[b].push_back(a);
    }

    rep(i, 10010)
    {
        seen[i] = false;
        path[i] = INF;
    }

    queue<int> que;
    que.push(0);
    path[0] = 0;
    seen[0] = true;

    while (!que.empty())
    {
        int now = que.front();
        que.pop();
        seen[now] = true;
        for (auto nv : G[now])
        {
            if (seen[nv])
                continue;
            seen[nv] = true;
            path[nv] = now;
            que.push(nv);
        }
    }

    bool isPossible = true;
    rep(i, n)
    {
        if (seen[i] == false)
            isPossible = false;
    }

    if (isPossible)
    {
        cout << "Yes" << endl;
        rep(i, n - 1) cout << path[i + 1] + 1 << endl;
    }
    else
    {
        cout << "No" << endl;
    }
}

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


Measured memory_bytes: 13864
#include <stdio.h>
 
int prime(int a){
  int i;
  if(a<=1)return 1;
  if(a==2)return 0;
  if(a%2==0)return 1;
 
  for(i=3;i*i<=a;i+=2){
    if(a%i==0)return 1;
  }
 
  return 0;
}
 
int main(void){
  int i,n,a,count=0;
 
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&a);
    if(prime(a)==0)count++;
  }
 
  printf("%d\n",count);
 
  return 0;
}

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

//&Start
#define lng long long
#define lit long double
#define kk(i,n) "\n "[i<n]
const int inf=0x3f3f3f3f;
const lng Inf=1e17;
const int N=60;
int n,m,ans;
vector<int> e[N];

//&Tarjan
int ind,dfn[N],low[N];
void Clear(){
	ind=ans=0;
	memset(dfn,0,sizeof dfn);
	memset(low,0,sizeof low);
	for(int i=1;i<=n;i++) e[i].clear();
}
void Tarjan(int x,int f){
	dfn[x]=low[x]=++ind;
	for(auto to:e[x])
		if(!dfn[to]){
			Tarjan(to,x),low[x]=min(low[x],low[to]);
			if(low[to]>dfn[x]) ans++;
		} else if(to!=f) low[x]=min(low[x],dfn[to]);
}

//&Main
int main(){
	while(~scanf("%d%d",&n,&m)){
		Clear();
		for(int i=1,u,v;i<=m;i++){
			scanf("%d%d",&u,&v);
			e[u].push_back(v);
			e[v].push_back(u);
		}
		for(int i=1;i<=n;i++)if(!dfn[i]) Tarjan(i,0);
		printf("%d\n",ans);
	}
	return 0;
}

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

void rotate_S(int minase_inori[6]) {
	int hayami_saori = minase_inori[0];
	minase_inori[0] = minase_inori[4];
	minase_inori[4] = minase_inori[5];
	minase_inori[5] = minase_inori[1];
	minase_inori[1] = hayami_saori;
}

void rotate_NES(int kugimiya_rie[6]) {
	int kitamura_eri = kugimiya_rie[1];
	kugimiya_rie[1] = kugimiya_rie[3];
	kugimiya_rie[3] = kugimiya_rie[4];
	kugimiya_rie[4] = kugimiya_rie[2];
	kugimiya_rie[2] = kitamura_eri;
}

void check(const int asumi_kana[6], const int iguti_yuka[6]) {
	int sakura_ayane;
	int satou_satomi[6];
	for (sakura_ayane = 0; sakura_ayane < 6; sakura_ayane++) {
		satou_satomi[sakura_ayane] = iguti_yuka[sakura_ayane];
	}
	for (sakura_ayane = 0; sakura_ayane < 4; sakura_ayane++) {
		int tateno_kanako;
		for (tateno_kanako = 0; tateno_kanako < 6; tateno_kanako++) {
			if (asumi_kana[tateno_kanako] != satou_satomi[tateno_kanako]) break;
		}
		if (tateno_kanako >= 6) {
			puts("Yes");
			exit(0);
		}
		rotate_NES(satou_satomi);
	}
}

int main(void) {
	int mizuki_nana[6], fukuenn_misato[6];
	int horie_yui;
	for (horie_yui = 0; horie_yui < 6; horie_yui++) {
		if (scanf("%d", &mizuki_nana[horie_yui]) != 1) return 1;
	}
	for (horie_yui = 0; horie_yui < 6; horie_yui++) {
		if (scanf("%d", &fukuenn_misato[horie_yui]) != 1) return 1;
	}
	check(mizuki_nana, fukuenn_misato);
	for (horie_yui = 0; horie_yui < 4; horie_yui++) {
		rotate_NES(fukuenn_misato);
		rotate_S(fukuenn_misato);
		check(mizuki_nana, fukuenn_misato);
		rotate_S(fukuenn_misato);
		rotate_S(fukuenn_misato);
		rotate_S(fukuenn_misato);
	}
	rotate_S(fukuenn_misato);
	rotate_S(fukuenn_misato);
	check(mizuki_nana, fukuenn_misato);
	puts("No");
	return 0;
}




Measured memory_bytes: 2104
a,b,c,x,y=map(int,input().split())
if x<y:
  min,max=x,y
  a2,b2=a,b
else:
  min,max=y,x
  a2,b2=b,a

if c*2<=a2+b2:
  res=2*min*c
  tmp1=(max-min)*b2
  tmp2=2*(max-min)*c
  if tmp1<tmp2:
    print(res+tmp1)
  else:
    print(res+tmp2)
else:
  if a2>b2:
    a2,b2=b2,a2
    min,max=max,min
  tmp1=a2*min+b2*max
  tmp2=2*max*c
  if min>max:
    tmp2+=(min-max)*a2
  if tmp1<tmp2:
    print(tmp1)
  else:
    print(tmp2)

Measured memory_bytes: 3064
def main():
    MOD = int(1e9 + 7)
    h, w = map(int, input().split())
    grid = [input() for _ in range(h)]

    dp = [[0] * w for _ in range(h)]
    dp[0][0] = 1

    for i in range(h):
        for j in range(w):
            if grid[i][j] != '#':
                if i > 0:
                    dp[i][j] += dp[i-1][j]

                if dp[i][j] > MOD:
                    dp[i][j] -= MOD

                if j > 0:
                    dp[i][j] += dp[i][j-1]

                if dp[i][j] > MOD:
                    dp[i][j] -= MOD

    ans = dp[h-1][w-1]
    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 51824
from collections import defaultdict

n,t=map(int,input().split())
arr=list(map(int,input().split()))
curmax=0
curdiff=0
maxmax=0
dd=defaultdict(int)
for i in range(n):
    curmax=max(arr[n-1-i],curmax)
    curdiff = curmax-arr[n-1-i]
    maxmax=max(maxmax,curdiff)
    if maxmax==curdiff:
        dd[maxmax]+=1
print(dd[maxmax])


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

int main(){

  int A,B,C;

  cin >> A >> B >> C;

  if (A == 5 && B== 5 && C == 7){
    cout << "YES" << endl;
  }

  else if (A == 5 && B== 7 && C == 5){
    cout << "YES" << endl;
  }

  else if (A == 7 && B== 5 && C == 5){
    cout << "YES" << endl;
  }

  else {
    cout << "NO" << endl;
  }
}


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

using namespace std;

typedef long long  ll;

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

    int n;

    cin >> n;
    vector<int> r(n), max_n(n - 1, 1e9 + 1);
    for (int i = 0; i < n; ++i)
        cin >> r[i];

    max_n[n - 2] = r[n - 1];
    for (int i = n - 3; i >= 0; --i)
        max_n[i] = max(r[i + 1], max_n[i + 1]);

    int ans = -1e9 - 1;
    for (int i = 0; i < n - 1; ++i)
        ans = max(ans, max_n[i] - r[i]);

    cout << ans << "\n";

    return 0;
}

Measured memory_bytes: 2580
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#include <bits/stdc++.h>

using namespace std;

typedef long long li;

li n;
li x[2000];
li init[2];

li memo[2][2005];
li rec(li pl, li pos) {
    if (memo[pl][pos] != -1) {
        return memo[pl][pos];
    }
    vector<li> candidates;
    for (int i = pos + 1; i < n; ++i) {
        candidates.push_back(rec(1 - pl, i));
    }
    li op_value = pos ? x[pos - 1] : init[1 - pl];
    candidates.push_back(abs(x[n - 1] - op_value));
    if (pl) {
        return memo[pl][pos] = *min_element(candidates.begin(), candidates.end());
    } else {
        return memo[pl][pos] = *max_element(candidates.begin(), candidates.end());
    }
}

int main() {
    memset(memo, -1, sizeof(memo));

    cin >> n >> init[0] >> init[1];
    for (int i = 0; i < n; ++i) {
        cin >> x[i];
    }
    cout << rec(0, 0) << endl;
    return 0;
}

Measured memory_bytes: 512
#include <cstdlib>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
typedef long long LL;

int main() {
  LL N, A, B; cin >> N >> A >> B;
  LL q = N / (A + B);
  LL r = N % (A + B);
  cout << q * A + min(A, r) << endl;
}


Measured memory_bytes: 256
n, m, c = map(int, input().split())
blis = list(map(int, input().split()))
count = 0
for i in range(n):
  cache = 0
  alis = list(map(int, input().split()))
  for i1 in range(len(blis)):
    cache += blis[i1] * alis[i1]
  cache += c
  if cache > 0:
    count += 1
print(count)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
#define clr(x) memset(x, 0, sizeof(x))
#define sz(x) (int)x.size()

using namespace std;

typedef long long ll;
typedef pair<long , long> pll;

const ll mx = 105;
const ll maxn = 1000001;
const ll mod = 1000000007;

vector<vector<int>> adj;
vector<int> res;
vector<int> ord;

int main(){

   ios_base::sync_with_stdio(false);
   cin.tie(0);
   
   ll n, m, i, j, k, t, q;

    ll x, y, z;

    cin>>x>>y>>z;

    t = x;
    x = y;
    y = t;

    t = x;
    x = z;
    z = t;

    cout<<x<<" "<<y<<" "<<z<<"\n";    
}




Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <string>
#include <sstream>
#include <iomanip>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <bitset>
#include <utility>
#include <numeric>
#include <iterator>

using namespace std;

using ll = long long;
using ull = unsigned long long;

const ll inf = 1ll << 60;
const ll mod = (ll)1e9 + 7;

#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()

#define print(s) cout << s;
#define println(s) cout << s << endl;
#define printd(s, f) cout << fixed << setprecision(f) << s << endl;


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

	vector<bool> a(26);
	for (char it : s)
	{
		a[it - 'a'] = true;
	}

	for (ll i = 0; i < 26; i++)
	{
		if (!a[i])
		{
			println((s + (char)('a' + i)));
			return 0;
		}
	}

	string t = s;
	string res;
	if (!next_permutation(all(t)))
	{
		res = "-1";
	}
	else
	{
		for (ll i = 0; i < s.length(); i++)
		{
			res = res + t[i];
			if (s[i] != t[i])
			{
				break;
			}
		}
	}

	println(res);
}




Measured memory_bytes: 256
#include <stdio.h>
int fibonacci(int);
int f[45];

int fibonacci(int n){
  int i;
  f[0] = 1;
  f[1] = 1;
  if(n > 1){
    for(i = 2;i <= n;i++){
      f[i] = f[i-2] + f[i-1];
    }
    return f[n];
  }
}
int main(int argc,char const*argv[]){
  int n;
  scanf("%d",&n);
  printf("%d\n",fibonacci(n));
  return 0;
}

Measured memory_bytes: 596
import java.util.*;

class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    List<HashMap<Integer, Integer>> issues = 
      new ArrayList<HashMap<Integer, Integer>>();
    int n= sc.nextInt();
    for (int i=0; i<n; i++) {
      HashMap<Integer, Integer> someoneIssue = new HashMap<Integer, Integer>();
      int issueCnt = sc.nextInt();
      for (int j=0; j<issueCnt; j++) {
        int x = sc.nextInt()-1;
        int a = sc.nextInt();
        someoneIssue.put(x, a);
      }
      issues.add(someoneIssue);
    }
    
    int max = 0;
    int doubtChk = 0;
    for (int i=0 ; i<(1<<n); i++) {
      int bitCount = 0;      
      for (int j=0; j<n; j++) {
        if ((1&i>>j)==1) {
          bitCount ++;
          HashMap<Integer, Integer> jsIssue = issues.get(j);
          if (jsIssue.size()>0) {
            for (Integer bitNum : jsIssue.keySet()) {

              if (chkIssue(i, bitNum, jsIssue.get(bitNum))) {
                
              }
              else {
                doubtChk = 1;
              }
            }
          }
        }
      }
      if (doubtChk==0) {
        if (max<bitCount) {
          max = bitCount;
        }
      }
      else {
        doubtChk = 0;
      }
      bitCount = 0;
    }
    
    System.out.println(max);
    
  }
  
  public static boolean chkIssue(int object, int bitNum, int bit) {
    if (bit == 1 ) {
      if ((1&(object>>bitNum))==1) {
        return true;
      }
      return false;
    }
    else {
      if ((1&(object>>bitNum))==0) {
        return true;
      }
    }
    return false;
    
  }
}


Measured memory_bytes: 33824
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
#define IO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
 
using namespace std;
using namespace __gnu_pbds;
using lli = long long int;
 
template<typename key> using ordered_set = tree <key, null_type, less<key>, rb_tree_tag, tree_order_statistics_node_update>;
 
int main () {
   IO;
   int n;
   cin >> n;
   vector<int> ans;
   int freq[200001];
   memset(freq, -1, sizeof freq);
   for(int i = 1; i <= n; i++) {
	  int a;
	  cin >> a;
	  if(a == 1) {
		 if(freq[a] == -1)
			freq[a] = i;
	  }
	  else {
		 if(freq[a - 1] != -1) {
			if(freq[a] == -1)
			   freq[a] = i;
		 }
	  }
   }
   for(int i = 1; i <= n; i++) {
	  if(freq[i] == -1)
		 break;
	  ans.push_back(freq[i]);
   }
   if(!ans.size()) {
	  cout << -1;
	  return 0;
   }
   int sum = 0;
   if(ans.size() == 1) {
	  cout << n - 1;
	  return 0;
   }
   for(int i = 0; i < ans.size(); i++) {
	  if(i == 0) {
		 sum += ans[i] - 1;
		 continue;
	  }
	  if(i == ans.size()) {
		 sum += n - ans[i];
		 sum += ans[i] - ans[i - 1] - 1;
		 break;
	  }
	  sum += ans[i] - ans[i - 1] - 1;
   }
   cout << sum;
   return 0;
}


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

int main() {

  int N;
  cin >> N;
  
  std::vector<int> d(N, 0);
  for(int i = 0; i < N; i++)
  {
   	cin >> d.at(i); 
  }

  sort(d.begin(), d.end());
  auto last = std::unique(d.begin(), d.end());
  d.erase(last, d.end());
  
  cout << d.size() << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <vector>
#include <numeric>
#define PI 3.14159265358979323846
#define MAXINF 1e18L
#define INF 1e9L
#define EPS 1e-9
#define REP(i, n) for(int i=0;i<int(n);++i)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define ALL(v) v.begin(),v.end()
#define FIND(v,x) (binary_search(ALL(v),(x)))
#define SORT(v) sort(ALL(v))
#define RSORT(v) sort(ALL(v));reverse(ALL(v))
#define DEBUG(x) cerr<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cerr<<#v<<":";for(int i=0;i<v.size();i++) cerr<<" "<<v[i]; cerr<<endl
#define Yes(n) cout<<((n)?"Yes":"No")<<endl
#define pb push_back
using namespace std;
template<class A>void pr(A a){cout << (a) << endl;}
template<class A,class B>void pr(A a,B b){cout << a << " "  ;pr(b);}
template<class A,class B,class C>void pr(A a,B b,C c){cout << a << " " ;pr(b,c);}
template<class A,class B,class C,class D>void pr(A a,B b,C c,D d){cout << a << " " ;pr(b,c,d);}
typedef long long ll;
typedef pair<int, int> pii;

int main(void)
{
    int flag = 0;
    REP(i, 3){
        char c;
        cin >> c;
        if(c == 'a') flag |= 0b001;
        if(c == 'b') flag |= 0b010;
        if(c == 'c') flag |= 0b100;
    }
    Yes(flag == 0b111);
}

Measured memory_bytes: 256
//#define _GRIBCXX_DEBUG
#include <algorithm>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iostream>
#include <iomanip>
#include <list>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using namespace std;


// 基本テンプレート
#pragma region MACRO
#define P(x) cout << (x) << endl
#define p(x) cout << (x)
#define PED cout << "\n"
#define rep(i,n) for(int i=0; i<(int)n; ++i)
#define REP(i,x,n) for(int i=x; i<(int)n; ++i)
#define repi(i,n) for(int i=0; i<=(int)n; ++i)
#define REPI(i,x,n) for(int i=x; i<=(int)n; ++i)
#define ILP while(true)
#define FOR(i,c) for(__typeof((c).begin())!=(c).begin(); i!=(c).end(); ++i)
#define ALL(c) (c).begin(), (c).end()
#define mp make_pair
#pragma endregion

// 型
#pragma region TYPE_DEF
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<string, string> pss;
typedef pair<string, int> psi;
typedef pair<int, string> pis;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<long> vl;
typedef vector<long long> vll;
typedef vector<string> vs;
#pragma endregion

// Effective std
#pragma region ESTD
template<typename C, typename T>
constexpr int count(C& c, T t) { return count(ALL(c), t); }
template<typename C, typename F>
constexpr int count_if(C& c, F f) { return count_if(ALL(c), f); }
template<typename C, typename T>
void erase(C& c, T t) { remove(ALL(c), t), c.end(); }
template<typename C>
void remove(vector<C>& c, unsigned int index) { c.erase(c.begin()+index); }
template<typename C, typename T, typename U>
constexpr void replace(C& c, T t, U u) { replace(ALL(c), t, u); }
template<typename C, typename F, typename U>
constexpr void replace_if(C& c, F f, U u) { (ALL(c), f, u); }
template<typename C>
constexpr void reverse(C& c) { reverse(ALL(c)); }
template<typename C>
constexpr void sort(C& c) { sort(ALL(c)); }
template<typename C, typename Pred>
constexpr void sort(C& c, Pred p) { sort(ALL(c), p); }
#pragma endregion

// 定数
#pragma region CONST_VAL
#define PI (2*acos(0.0))
#define EPS (1e-9)
#define MOD (int)(1e9+7)
#pragma endregion


int main()
{
    string s;
    cin >> s;
    rep(i,s.size()-1) {
        if(s[i]==s[i+1]) {
            printf("%d %d\n", i+1, i+2);
            return 0;
        }
        if(s[i]==s[i+2]) {
            printf("%d %d\n", i+1, i+3);
            return 0;
        }
        if(s[i+1]==s[i+2]) {
            printf("%d %d\n", i+2, i+3);
            return 0;
        }
    }
    printf("%d %d\n", -1, -1);
    return 0;
}



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

int main(){
  string s;
  cin >> s;
  int ret=0;
  for(int i=0; i<s.length()/2; i++){
    if(s[i]!=s[s.length()-i-1])ret++;
  }
  cout << ret;
  return 0;
}

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

using namespace std;
using ll = long long;

int main() {
  ll N;
  cin >> N;
  vector<pair<ll,ll>> AB(N);
  bool flag[N];
  for (int i = 0; i < N; ++i) {
    cin >>AB[i].first >> AB[i].second;
    flag[i]=false;
  }
  sort(AB.begin(),AB.end(),[](auto l, auto r){return l.second < r.second;});
  ll sum = 0;
  for (int i = 0; i < N; ++i) {
    sum += AB[i].first;
    if(sum > AB[i].second){
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
}


Measured memory_bytes: 3584
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;

public class Main {
	//C問題

	public static void main(String[] args) throws IOException {

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		Scanner scan = new Scanner(System.in);

		int a, b;

		a = scan.nextInt();
		b = scan.nextInt();

		int ans;
		ans = a - b * 2;

		System.out.println(ans < 0 ? 0 : ans);
	}

}


Measured memory_bytes: 23124
#include <iostream>
#include <algorithm>
#include <string> 
#include <vector>
#include <iomanip>
#include <math.h>
using namespace std;

int main()
{
	string S;
	cin >> S;
	int size = S.size();
	vector<char> ans(0);
	for (int i = 0; i < size; i++) {
		if (i % 2 == 0) {
			ans.push_back(S[i]);
		}
	}
	int anssize = ans.size();
	for (int j = 0; j < anssize; j++) {
		cout << ans[j];
	}
	cout << endl;
}

Measured memory_bytes: 640
// warm heart, wagging tail,and a smile just for you!
//                                                                     ███████████   
//                                                                   ███╬╬╬╬╬╬╬╬╬╬███
//                                                                ███╬╬╬╬╬████╬╬╬╬╬╬███
//                                            ███████████       ██╬╬╬╬╬████╬╬████╬╬╬╬╬██
//                                      █████████╬╬╬╬╬████████████╬╬╬╬╬██╬╬╬╬╬╬███╬╬╬╬╬██
//                               ████████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬█████████╬╬╬╬╬╬██╬╬╬╬╬╬╬██
//                             ████╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬█████████╬╬╬╬╬╬╬╬╬╬╬██
//                           ███╬╬╬█╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬███╬╬╬╬╬╬╬█████
//                         ███╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬████████╬╬╬╬╬██
//                       ███╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬███╬╬╬╬╬╬╬╬╬███
//                     ███╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬█████╬╬╬╬╬╬╬██
//                 ████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬████╬╬╬╬╬████
//     █████████████╬╬╬╬╬╬╬╬██╬╬╬╬╬████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬█████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬███╬╬╬╬██████
//   ████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬██████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██████╬╬╬╬╬╬╬███████████╬╬╬╬╬╬╬╬██╬╬╬██╬╬╬██
// ███╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬████╬╬╬╬╬╬╬╬╬╬╬█╬╬╬╬╬╬╬██╬╬╬╬╬╬╬╬██
// ██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬╬▓▓▓▓▓▓╬╬╬████╬╬████╬╬╬╬╬╬╬▓▓▓▓▓▓▓▓██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬╬╬╬╬███
// ██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██████▓▓▓▓▓▓▓╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬▓▓▓▓▓▓▓██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬╬█████
// ███╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬███╬╬╬╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬█████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬████████
//   ███╬╬╬╬╬╬╬╬╬╬╬╬╬█████╬╬╬╬╬╬╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬███╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██
//       ██████████████  ████╬╬╬╬╬╬███████████████████████████╬╬╬╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬████
//                         ███████                           █████  ███████████████████  
#include "bits/stdc++.h"
using namespace std;
#define MOD 1000000007
const double EPS = 1e-9;
#define INF (1LL<<60)
#define fs first
#define sc second
#define pb push_back
#define int long long
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i = (b-1);i>=a;i--)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define ITR(itr,mp) for(auto itr = (mp).begin(); itr != (mp).end(); ++itr)
#define RITR(itr,mp) for(auto itr = (mp).rbegin(); itr != (mp).rend(); ++itr)
#define range(i,a,b) ((a)<=(i) && (i)<(b))
#define debug(x)  cout << #x << " = " << (x) << endl;
#define SP << " " << 
typedef pair<int,int> P;
typedef vector<vector<P> > Graph;
typedef vector<int> vec;
typedef vector<vector<int>> mat;

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

  char s;
  cin >> s;

  if(s == 'A') cout << "T" << endl;
  if(s == 'T') cout << "A" << endl;
  if(s == 'C') cout << "G" << endl;
  if(s == 'G') cout << "C" << endl;

  return 0;
}

Measured memory_bytes: 256
import sys

# import re
import math
import collections
# import decimal
import bisect
import itertools
import fractions
# import functools
import copy
import heapq
import decimal
# import statistics
import queue
import numpy as np

sys.setrecursionlimit(10000001)
INF = 10 ** 16
MOD = 10 ** 9 + 7

ni = lambda: int(sys.stdin.readline())
ns = lambda: map(int, sys.stdin.readline().split())
na = lambda: list(map(int, sys.stdin.readline().split()))


# ===CODE===


def main():
    n = ni()
    a = na()

    c = collections.Counter(a)

    deleted = 0
    for v in c.values():
        deleted += v - 1

    deleted += deleted % 2
    print(n - deleted)


if __name__ == '__main__':
    main()


Measured memory_bytes: 28000
//ProblemC

//#define USE_STDIO
//#define USE_LOG
//#define FILE_ERR

#ifdef _MYPC
#include "mypc.h"
#endif // _MYPC

#ifndef debug
#define debug(...)
#endif // !LOG

//include
#include <iostream>
#include <string>
#include <vector>
#include <bitset>
#include <list>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <stack>
#include <algorithm>
#include <numeric>
#include <functional>
#include <memory>
#include <complex>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <iomanip>

using namespace std;

//for
#define forn(i, n) for(int i = 0; i < (int)(n); i++)
#define forbe(i, begin, end) for(decltype(begin) i = (begin); i != (end); ++i)
#define forbes(i, begin, end, step) for(decltype(begin) i = (begin); i != (end); i += (step))

//int
using ll = long long;
using ull = unsigned long long;
using uint = unsigned;

//pair
using pii = std::pair<int, int>;
using pll = std::pair<ll, ll>;
#define fi first
#define se second

//vector
template <typename Value>
static inline void fillv(Value& x, const Value& val) { x = val; }
template <typename Vector, typename Value>
static inline void fillv(Vector& v, const Value& val) { for (auto& x : v) fillv(x, val); }

static inline void Solve();

int main(int argc, char* argv[]) {
#ifdef REDIRECT_STDIO
	REDIRECT_STDIO;
#endif // REDIRECT_STDIO

	Solve();
	return 0;
}

//ProblemC
void Solve() {
	int n;
	string s;
	cin >> n >> s;

	int dp = 0;
	for (int i = 1; i < n; i++) if (s[i] == 'E') dp += 1;
	int minp = dp;

	for (int i = 1; i < n; i++) {
		if (s[i - 1] == 'W') dp += 1;
		if (s[i] == 'E') dp -= 1;
		minp = min(dp, minp);
	}
	cout << minp << endl;
}


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

int cmp_int(const void *a, const void *b) {
  return *(int *) a - *(int *) b;
}

int main(void) {
  int n, k;
  scanf("%d %d", &n, &k);
  int price[n];
  for (int i = 0; i < n; i++) {
    scanf(" %d", &price[i]);
  }

  qsort(price, n, sizeof(int), cmp_int);

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

  return 0;
}


Measured memory_bytes: 1744
#include<stdio.h>
#include<algorithm>
using namespace std;
int dice[6];
void rn(){
	int tmp=dice[0];dice[0]=dice[4];dice[4]=dice[5];dice[5]=dice[1];dice[1]=tmp;
}
void rs(){
	int tmp=dice[0];dice[0]=dice[1];dice[1]=dice[5];dice[5]=dice[4];dice[4]=tmp;
}
void re(){
	int tmp=dice[0];dice[0]=dice[2];dice[2]=dice[5];dice[5]=dice[3];dice[3]=tmp;
}
void rw(){
	int tmp=dice[0];dice[0]=dice[3];dice[3]=dice[5];dice[5]=dice[2];dice[2]=tmp;
}
char in[10];
int main(){
	int a;
	while(scanf("%d",&a),a){
		for(int i=0;i<6;i++)dice[i]=i;
		for(int i=0;i<a;i++){
			scanf("%s",in);
			if(in[0]=='n')rn();
			if(in[0]=='e')re();
			if(in[0]=='w')rw();
			if(in[0]=='s')rs();
		}
		printf("%d\n",dice[0]+1);
	}
}

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

#define input_i(x) scanf("%d", &x)
#define input_s(x) scanf("%s", x)

#define BUFSIZE 100001

int main(int argc, char const *argv[]) {
    int M, D, i, j, ans= 0;
    input_i(M);
    input_i(D);
    for(i= 1; i <= M; i++) {
        for(j= 1; j <= D; j++) {
            if((j % 10 >= 2) && (j / 10 >= 2) && ((j % 10) * (j / 10) == i)) ans++;
        }
    }
    printf("%d\n", ans);

    return 0;
}


Measured memory_bytes: 128
N=int(input())
A=list(map(int,input().split()))
cntf=0
cntno=0
for i in A:
  if i%4==0:
    cntf+=1
  if i%2==1:
    cntno+=1

    
if cntf+cntno==N:
  if cntf>=(N//2):
    print('Yes')
  else:
    print('No')
else:
  if cntf>=cntno:
    print('Yes')
  else:
    print('No')

Measured memory_bytes: 14252
#include <bits/stdc++.h>
using namespace std;
 
#define fio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define int long long
// #define double long double
// #define mp make_pair
// #define pb push_back
// Upper case English alphabet to lower case ch |= ' ';
// Lower case English alphabet to upper case ch &= '_’ ;
//__builtin_popcount(x)

int INF=(int)1e9+7,t=-1,till=0;
int gcd(int a, int b) { return b!=0 ? gcd(b, a % b) : a; }
// int digits(int n){return floor(log10(n))+1 ;}
// bool ispoweroftwo (int x) { return x && (!(x&(x-1))); }
//vector<int> vis,parent,ti,tout,dis;
vector<vector<int> > adj;
map<int,int> vis;
// vector<int> row={-1,1,0,0};
// vector<int> col={0,0,-1,1};
// vector<int> dp;
// void dfs(int v){
//     vis[v]=1;
//     for(int x:adj[v]){
//         if(vis[x]==0){
//             cnt++;
//             dfs(x);
//         }
//     }
// }

signed main(){
    fio;
    int n;
    cin>>n;
    vector<double> v(n+1);
    for(int i=1;i<=n;i++) cin>>v[i];
    double ans=0;
    double dp[n+1][n+1];
    //dp[0][0]=1;
    for(int i=0;i<=n;i++){
        for(int j=0;j<=n;j++) dp[i][j]=0;
    }
    dp[0][0]=1;
    for(int i=1;i<=n;i++){
        for(int j=0;j<=i;j++){
            if(j==0){
                dp[i][j]=dp[i-1][j]*(1-v[i]);
                continue;
            }
            if(j!=i) dp[i][j]=dp[i-1][j-1]*v[i]+dp[i-1][j]*(1-v[i]);
            else dp[i][j]=dp[i-1][j-1]*v[i];
            if(i==n && j>n/2) ans+=dp[i][j];
        }
    }

    cout<<fixed<<setprecision(9)<<ans<<endl;

    

    

}


Measured memory_bytes: 70656
s = input()
t = input()
alfa = list('abcdefghijklmnopqrstuvwxyz')
s_count = [0 for i in range(26)]
t_count = [0 for i in range(26)]
for i in range(len(s)):
    x = alfa.index(s[i])
    y = alfa.index(t[i])
    s_count[x] += 1
    t_count[y] += 1
s_count.sort()
t_count.sort()
if s_count == t_count:
    print('Yes')
else:
    print('No')


Measured memory_bytes: 3632
using System;

namespace A___Thumbnail
{
    class Program
    {
        static void Main (string[] args)
        {
            var n = int.Parse (Console.ReadLine ());
            var input = Console.ReadLine ().Split (' ');
            var a = new int[n];
            var total = 0.0;
            for (var i = 0; i < n; i++)
            {
                a[i] = int.Parse (input[i]);
                total += a[i];
            }
            var average = total / n;
            var min = double.MaxValue;
            var index = 0;
            for (var i = 0; i < n; i++)
            {
                if (min > Math.Abs (average - a[i]))
                {
                    min = Math.Abs (average - a[i]);
                    index = i;
                }
            }
            Console.WriteLine (index);
        }
    }
}

Measured memory_bytes: 11092
#include <bits/stdc++.h>
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define rep(i,N) for(long long i = 0; i < (long long)(N); i++)
#define repr(i,N) for(long long i = (long long)(N) - 1; i >= 0; i--)
#define rep1(i,N) for(long long i = 1; i <= (long long)(N) ; i++)
#define repr1(i,N) for(long long i = (N) ; (long long)(i) > 0 ; i--)
#define each(x,v) for(auto& x : v)
#define all(v) (v).begin(),(v).end()
#define sz(v) ((int)(v).size())
#define ini(...) int __VA_ARGS__; in(__VA_ARGS__)
#define inl(...) long long __VA_ARGS__; in(__VA_ARGS__)
#define ins(...) string __VA_ARGS__; in(__VA_ARGS__)
using namespace std; void solve();
using ll = long long; template<class T = ll> using V = vector<T>;
using vi = V<int>; using vl = V<>; using vvi = V< V<int> >;
constexpr int inf = 1001001001; constexpr ll infLL = (1LL << 61) - 1;
struct IoSetupNya {IoSetupNya() { cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); cerr << fixed << setprecision(7);} } iosetupnya;
template<typename T, typename U> inline bool amin(T &x, U y) { return (y < x) ? (x = y, true) : false; }
template<typename T, typename U> inline bool amax(T &x, U y) { return (x < y) ? (x = y, true) : false; }
template<typename T, typename U> ostream& operator <<(ostream& os, const pair<T, U> &p) { os << p.first << " " << p.second; return os; }
template<typename T, typename U> istream& operator >>(istream& is, pair<T, U> &p) { is >> p.first >> p.second; return is; }
template<typename T> ostream& operator <<(ostream& os, const vector<T> &v) { int s = (int)v.size(); rep(i,s) os << (i ? " " : "") << v[i]; return os; }
template<typename T> istream& operator >>(istream& is, vector<T> &v) { for(auto &x : v) is >> x; return is; }
void in(){} template <typename T,class... U> void in(T &t,U &...u){ cin >> t; in(u...);}
void out(){cout << "\n";} template <typename T,class... U> void out(const T &t,const U &...u){ cout << t; if(sizeof...(u)) cout << " "; out(u...);}
template<typename T>void die(T x){out(x); exit(0);}
#ifdef NyaanDebug
  #include "NyaanDebug.h"
  #define trc(...) do { cerr << #__VA_ARGS__ << " = "; dbg_out(__VA_ARGS__);} while(0)
  #define trca(v,N) do { cerr << #v << " = "; array_out(v , N);cout << endl;} while(0)
#else
  #define trc(...)
  #define trca(...)
  int main(){solve();}
#endif
 
#define inc(...) char __VA_ARGS__; in(__VA_ARGS__)
#define in2(N,s,t) rep(i,N){in(s[i] , t[i]);}
#define in3(N,s,t,u) rep(i,N){in(s[i] , t[i] , u[i]);}
using vd = V<double>; using vs = V<string>; using vvl = V< V<> >;
template<typename T>using heap = priority_queue< T , V<T> , greater<T> >;
 
using P = pair<ll,char>; using vp = V<P>;
constexpr int MOD = /**/ 1000000007; //*/ 998244353;
//////////////////

void solve(){
  inl(a,b,c,d,e,f,g);
  ll ans = b;
  if(a != 0 && d != 0 && e != 0){
    int cnt = 0;
    cnt += a & 1; cnt += d & 1; cnt += e & 1;
    if(cnt >= 2){
      ans += 3;
      a--; d--; e--;
    }
  }
  ans += (a / 2 * 2);
  ans += (d / 2 * 2);
  ans += (e / 2 * 2);
  out(ans);
}

Measured memory_bytes: 256
import java.util.*;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int A = sc.nextInt();
		int B = sc.nextInt();
		int dif = Math.abs(A-B);
		int ans;
		
		if(dif%2 == 0) {
			ans = Math.max(A, B)-dif/2;
			System.out.println(ans);
		}else {
			System.out.println("IMPOSSIBLE");
		}
	}
}

Measured memory_bytes: 21844
#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 MOD 1000000007
typedef pair<li, li> PI;

li a[100100];

int main(void) {
	li n, m;
	cin >> n >> m;
	rep(i, n) {
		cin >> a[i];
		a[i] /= 2;
	}
	li g = 1;
	rep(i, n) {
		li gcd = __gcd(g, a[i]);
		g = (g / gcd) * a[i];
		if (g > m) {
			puts("0");
			return 0;
		}
	}

	rep(i, n) {
		if ((g / a[i]) % 2 == 0) {
			puts("0");
			return 0;
		}
	}

	cout << (m - g) / (2 * g) + 1 << endl;


	return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <cmath>
using namespace std;

int main() {
  int n;
  cin >> n;
  vector<int> x(n), y(n), h(n);
  for (int i = 0; i < n; ++i)
    cin >> x[i] >> y[i] >> h[i];

  for (int cx = 0; cx <= 100; ++cx) {
    for (int cy = 0; cy <= 100; ++cy) {
      int H = 1;
      for (int i = 0; i < n; ++i) {
        if (!h[i])
          continue;
        int hp = h[i] + abs(x[i] - cx) + abs(y[i] - cy);

        if (H == 1)
          H = hp;
        else if (H != hp) {
          H = 0;
          break;
        }
      }
      if (H == 0)
        continue;
      for (int i = 0; i < n; ++i) {
        if (h[i])
          continue;
        int hp = std::max(H - abs(x[i] - cx) - abs(y[i] - cy), 0);
        if (hp > 0) {
          H = 0;
          break;
        }
      }

      if (H > 0) {
        cout << cx << " " << cy << " " << H << "\n";
        return 0;
      }
    }
  }

  return 0;
}


Measured memory_bytes: 256
num = list(map(int,input().split()))
num_list = []
min = 0

for i in range(num[0]):
  temp = list(map(int,input().split()))
  num_list.append(temp)
  min = min + temp[0]
  
for i in range(2**num[0]):
  temp = 0
  count = 0
  max = -1
  for j in range(num[0]):
    if((i >> j)&1):
      temp = temp + 100*(j+1)*num_list[j][0] + num_list[j][1]
      count = count + num_list[j][0]
    elif (not ((i >> j)&1)) and j>max:
      max = j
      
  k = 0
  while temp < num[1]:
    temp = temp + 100*(max+1)
    count = count + 1
    k = k + 1
    if k == num_list[max][0]:
      count = -1
      break
  
  if (count>0) and (count<min):
    min = count
    min_j = i
  
print(min)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
 
#define REP(i, s) for (int i = 0; i < s; ++i)
#define ALL(v) (v).begin(), (v).end()
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)
#define DEBUG
#define int long long
#define INF 1e18
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; }
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }
template<class T> ostream& operator << (ostream &s, set<T> P)
{ EACH(it, P) { s << "<" << *it << "> "; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P)
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s << endl; }
template<class T>void show(vector<T>v){for (int i = 0; i < v.size(); i++){cerr<<v[i]<<" ";}cerr<<"\n";}
typedef long long ll;


signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n;
    cin>>n;
    vector<int>x(n),y(n),X(n),Y(n);
    for (int i = 0; i < n; i++)
    {
        cin>>x[i]>>y[i];
        X[i]=x[i]-y[i];
        Y[i]=x[i]+y[i];
    }
    int max0=-INF;
    int min0=INF;
    int max1=-INF;
    int min1=INF;
    
    for (int i = 0; i < n; i++)
    {
        chmax(max0,X[i]);
        chmax(max1,Y[i]);
        chmin(min0,X[i]);
        chmin(min1,Y[i]);

    }
    cout<<max(max0 - min0 , max1-min1)<<endl;
    



  
    return 0;
}

Measured memory_bytes: 9528
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define USE_LLONG_AS_INT
#ifdef USE_LLONG_AS_INT
#define int long long
#define inf (1ll<<60)
#else
#define inf (1<<30)
#endif
#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,a,b) for(int i=a;i<b;i++)
#define REP(i,a,b) for(int i=a;i<=b;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define vi vector<int>
#define vvi vector<vi>
#define pb push_back
#define pi pair<int,int>
#define vp vector<pair<int,int>>
#define mp make_pair
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define MEMSET(a) memset(a,0,sizeof(a))
#define Yes(f) cout<<(f?"Yes":"No")<<endl
#define yes(f) cout<<(f?"yes":"no")<<endl
#define YES(f) cout<<(f?"YES":"NO")<<endl
#define SORT(v) sort(all(v))
#define RSORT(v) sort(all(v), greater<int>())

using namespace std;

const int mod=1e9+7;
const string sp=" ";

void run();

void init() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout<<fixed<<setprecision(12);
}

signed main(){
    init();
    run();
    return 0;
}

class Combination {
    private:
    vector<int> x, y;
    
    int modpow(int x, int n, int mod = (int)1e9 + 7) {
        int ret = 1;
        while (n > 0) {
            if ((n & 1)) {
                ret = ret * x % mod;
            }
            x = x * x % mod;
            n >>= 1;
        }
        return ret;
    }
    
    public:
    Combination(int n) {
        x.resize(n+1);
        y.resize(n+1);        
        x[0]=y[0]=1;
        for (int i = 1; i <= n; i++) {
            x[i]=(x[i-1]*i)%mod;
            y[i]=modpow(x[i],mod-2);
        }
    }
    
    int get(int n, int r) {
        if (n < r) return 0;
        return x[n] * y[n - r] % mod * y[r] % mod;
    }
    
};

void run(){
    int x,y;
    cin>>x>>y;
    if((x+y)%3){
        cout<<0<<endl;
        return;
    }
    int n=(2*y-x)/3,m=(2*x-y)/3;
    if(n<0||m<0){
        cout<<0<<endl;
        return;
    }
    Combination c(n+m);
    cout<<c.get(n+m,m)<<endl;
}

Measured memory_bytes: 10624
#include <bits/stdc++.h>
#define x first
#define y second
#define int int long long // 2e9 & 9e18
using namespace std; const int inf = numeric_limits<int>::max();
struct __io{__io(){ios_base::Init i; ios_base::sync_with_stdio(0); cin.tie(0);}} __io; // fast I/O
#ifdef LOCAL // setting up print debugging (yes lol)
template<class K, class V>ostream& operator<<(ostream&s,const pair<K,V>&p){s<<'<'<<p.x<<", "<<p.y<<'>';return s;}
template<class T, class=typename T::value_type, class=typename enable_if<!is_same<T,string>::value>::type>
ostream& operator<<(ostream&s,const T&v){s<<'[';for(auto&x:v){s<<x<<", ";}if(!v.empty()){s<<"\b\b";}s<<']';return s;}
void __prnt(){cerr<<endl;} template<class T, class...Ts>void __prnt(T&&a,Ts&&...etc){cerr<<a<<' ';__prnt(etc...);}
#define print(...) __prnt(__VA_ARGS__)
#else
#define print(...)
#endif

signed main() {
    int n, m, x;
    cin >> n >> m >> x;
    vector<int> c(n);
    vector<vector<int>> a(n, vector<int>(m));
    for (int i = 0; i < n; ++i) {
        cin >> c[i];
        for (int j = 0; j < m; ++j) {
            cin >> a[i][j];
        }
    }
    int best = inf;
    for (int state = 0; state < (1<<n); ++state) {
        int cost = 0;
        vector<int> algo(m, x);
        for (int i = 0; i < n; ++i) {
            if (state & (1<<i)) {
                cost += c[i];
                for (int j = 0; j < m; ++j) {
                    algo[j] -= a[i][j];
                }
            }
        }
        bool ok = true;
        for (int j = 0; j < m; ++j) {
            if (algo[j] > 0) {
                ok = false;
                break;
            }
        }
        if (ok && best > cost) {
            best = cost;
        }
    }
    if (best == inf) {
        cout << -1 << endl;
    } else {
        cout << best << endl;
    }
}


Measured memory_bytes: 3660
def resolve():
	n=int(input())
	w=[input() for i in range(n)]
	if len(list(set(w)))<n:
		print('No')
	else:
		for i in range(1,n):
			if w[i-1][-1]!=w[i][0]:
				
				print('No')
				break
		else:
				print('Yes')
		
resolve()

Measured memory_bytes: 38256
#include<bits/stdc++.h>
#define ll long long
using namespace std;

int main()
{
	int n, resp = INT_MAX;
	cin >> n;
	vector<int> vec(n);
	for(auto &x: vec) cin >> x;
		
	for(int i = -100; i<= 100; i++)
	{
		int acc = 0;
		for(auto a: vec)
			acc += (a - i)*(a - i);
		resp = min(acc, resp);
	}
	cout << resp << '\n';
	return 0;
}

Measured memory_bytes: 256
n = int(input())
red = []
blue = []
for i in range(n):
    red.append(list(map(int, input().split())))
for i in range(n):
    blue.append(list(map(int, input().split())))
#xの昇順のソート
red.sort(key=lambda x:x[0])
blue.sort(key=lambda x:x[0])
ans = 0
delete_value = set([-1])
for b in range(n):
    maxY = -1
    for r in range(n):
        if blue[b][0] < red[r][0]:
            break
        else:
            if blue[b][1] > red[r][1] and red[r][1] not in delete_value:
                maxY = max(maxY, red[r][1])
    delete_value.add(maxY)
print(len(delete_value)-1)    



Measured memory_bytes: 3064
use proconio::input;
use proconio::marker::{Chars, Usize1};
use std::iter::Iterator;
use std::collections::*;
use std::cmp::*;
use itertools::Itertools;

#[allow(unused_macros)]
macro_rules! max {
    ($x:expr) => {
      $x
    };
    ($x:expr, $($xs:tt)+) => {
      max($x,max!($($xs)+))
    };
  }
  
  #[allow(unused_macros)]
  macro_rules! min {
    ($x:expr) => {
      $x
    };
    ($x:expr, $($xs:tt)+) => {
      min($x,min!($($xs)+))
    };
  }

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        eprintln!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
    }
}

fn main() {
    input! {
    n: usize,
    mut h: [i64; n],
    }

    let mut maxh = h[0];
    let mut cnt = 0;
    for i in 1..n {
      if h[i] >= maxh {
        cnt +=1;
        maxh = h[i];
      }
    }
     println!("{}", cnt + 1);
}


Measured memory_bytes: 2132
// AtCoder Beginner Contest 125 - Problem C: GCD on Blackboard (https://atcoder.jp/contests/abc125/tasks/abc125_c)
#include <bits/stdc++.h>

using namespace std;
using ii = pair<int, int>;

int eval(int d, const vector<int>& as)
{
    vector<ii> xs;

    for (auto a : as)
    {
        auto x = __gcd(d, a);

        if (x < d)
            xs.push_back(ii(x, a));
    } 

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

    for (size_t i = 1; i < xs.size(); ++i)
        d = __gcd(d, xs[i].second);

    return d;
}

int solve(const vector<int>& as)
{
    int N = as.size();

    if (N == 1)
        return as.front();

    if (N == 2)
        return max(as.front(), as.back());

    auto d1 = __gcd(as[0], as[1]);
    auto ans = eval(d1, as);

    auto d2 = __gcd(as[0], as[2]);
    ans = max(ans, eval(d2, as)); 

    auto d3 = __gcd(as[1], as[2]);
    ans = max(ans, eval(d3, as)); 

#ifdef DEBUG
cout << "d1 = " << d1 << ", eval = " << eval(d1, as) << '\n';
cout << "d2 = " << d2 << ", eval = " << eval(d2, as) << '\n';
cout << "d3 = " << d3 << ", eval = " << eval(d3, as) << '\n';
#endif
    return ans;
}

int main()
{
    ios::sync_with_stdio(false);

    int N;
    cin >> N;

    vector<int> as(N);

    for (int i = 0; i < N; ++i)
    {
        int x;
        cin >> x;

        as[i] = abs(x);
    }

#ifdef DEBUG
    cout << "as = ";
    for (int i = 0; i < N; ++i)
        cout << as[i] << ' ';
    cout << '\n';
#endif 

    auto ans = solve(as);

    cout << ans << '\n';

    return 0;
}


Measured memory_bytes: 2436
import "dart:io";

main(List<String> args) {
  List NAB = stdin.readLineSync().split(" ").map((x) => int.parse(x)).toList();
  int N = NAB[0];
  int A = NAB[1];
  int B = NAB[2];
  int ans = 0;
  for (var i = 1; i <= N; i++) {
    int tmp = i;
    int sum = 0;
    while (tmp > 0) {
      sum += tmp % 10;
      tmp ~/= 10;
    }
    if (sum >= A && sum <= B) ans += i;
  }
  print(ans);
}

Measured memory_bytes: 13192
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,a,b)  for(int i=(a),i##formax=(b);i< i##formax;i++)
#define FORR(i,a,b) for(int i=(a),i##formin=(b);i>=i##formin;i--)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define pcnt __builtin_popcount
#define sz(x) (int)(x).size()
#define maxs(x,y) x=max((x),(y))
#define mins(x,y) x=min((x),(y))
#define show(x) cout<<#x<<" = "<<(x)<<endl;
#define all(a) ((a).begin()),((a).end())
#define each(i,c) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();i++)
#define bit(n) (1LL<<(n))
typedef long long ll;
typedef __int128_t lll;
template<class T>using V=vector<T>;
template<class T>using VV=V<V<T>>;
template<class T,class Y>using P=pair<T,Y>;
template<class T,class Y>ostream& operator<<(ostream&o,P<T,Y>&p){return o<<"("<<p.fi<<","<<p.se<<")";}
template<class T>ostream& operator<<(ostream&o,V<T>&v){for(T&t:v)o<<t<<",";return o<<endl;}
template<class T>void uniq(V<T>&v){sort(all(v));v.erase(unique(all(v)), v.end());}

lll gcd(lll a,lll b,lll&x,lll&y){if(!b){x=1;y=0;return a;}lll d=gcd(b,a%b,y,x);y-=a/b*x;return d;}
ll modInv(ll a,ll m){lll x,y;gcd(a,m,x,y);return(x%m+m)%m;}
ll modPow(lll a,lll n,ll m){lll p=1;for(;n;n>>=1,a=a*a%m)if(n&1)p=p*a%m;return p;}
//V<ll>F,R;void setF(int n,int mod){F=R=V<ll>(++n);F[0]=1;FOR(i,1,n)F[i]=F[i-1]*i%mod;R[n-1]=modInv(F[n-1],mod);FORR(i,n-1,1)R[i-1]=R[i]*i%mod;}
//ll comb(int a,int b,int m){return a<b||b<0?0:F[a]*R[b]%m*R[a-b]%m;}

const int IINF = 1e9+6;
const ll LINF = 1e18;
const int MOD = 1e9+7; //998244353;
ll n, a, b;
main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> n >> a >> b;
  ll ans = (b-a)/2;
  if((b-a)%2) ans += min(a, n-b+1);
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  
  long n;
  cin >>n;
  vector<long> h(100100,1100000000);
  for(int i=1; i<=n; i++) cin >> h[i];
  
  long count=0,sum=0;
  for(int i=1; i<=n; i++){
  	if(h[i]>=h[i+1]) count++;
    else{ sum=max(sum,count); count=0;}
  }

  
  cout << sum << endl;
}

Measured memory_bytes: 1152