akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>

int A[100000];

int GCD(int N, int m, int c){
  int i, j;
  if(m % 2 != c) m--; 
  for(i = m;i > 1;i -= 2){
    if(m % i != 0) continue;
    for(j = 0;j < N;j++) if(A[j] % i != 0) break;
    if(j == N) return i;
  }
  return 1;
}

void Do(int N){
  int i, m, c;
  m = 1e9;
  c = 0;
  for(i = 0;i < N;i++){
    scanf("%d", &A[i]);
    if(A[i] % 2 != 0) c = 1;
    if(m > A[i]) m = A[i];
  }
  printf("%d\n", GCD(N, m, c));
}

int main(void){
  int N;
  scanf("%d", &N);
  Do(N);
  return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define rep(i, s, e) for (int i = s; i < e; ++i)
#define sort_(a) stable_sort(a.begin(), a.end())
#define rsort(a) stable_sort(a.rbegin(), a.rend())
#define sum(a) accumulate(a.begin(), a.end(), 0LL)
#define join(a, d) accumulate(a.begin() + 1, a.end(), a[0], [](string s, string t) {return s + d + t;})
#define all(a) a.begin(), a.end()
#define __lcm(a, b) std::__detail::__lcm(a, b)
typedef long long ll;
const long mod = 1e9 + 7;

int main(void) {
#ifdef DEBUG
  freopen("input.txt", "r", stdin);
#endif

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

  int N;
  cin >> N;
  vector<int> H(N, 0);
  rep(i, 0, N) {
    cin >> H[i];
  }

  vector<int> high = H;
  sort_(high);
  vector<int> d = high;
  rep(i, 1, N) {
    d[i] = high[i] - high[i-1];
  }

  int ans = 0;
  int n = 0;
  for (auto i : d) {
    rep(j, 0, N) {
      if (not i) continue;
      if (H[j] > 0) {
        H[j] -= i;
        n = i;
      } else {
        ans += n;
        n = 0;
      }
    }
    ans += n;
    n = 0;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <functional>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <bitset>
#include <cassert>
#include <exception>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<string> vs;
typedef vector<P> vp;
#define rep(i,a,n) for(ll i = (a);i < (n);i++)
#define per(i,a,n) for(ll i = (a);i > (n);i--)
#define lep(i,a,n) for(ll i = (a);i <= (n);i++)
#define pel(i,a,n) for(ll i = (a);i >= (n);i--)
#define clr(a,b) memset((a),(b),sizeof(a))
#define pb push_back
#define mp make_pair
#define all(c) (c).begin(),(c).end()
#define sz size()
#define print(X) cout << (X) << endl
const ll INF = 1e+9+7;
int n,m,l;
string s,t;
ll d[200010],dp[500][500];

class UnionFind{
private:
  int par[200000],rank[200000];

public:
  void init(int x){
    for(int i = 0;i < x;i++){
      par[i] = i;
      rank[i] = 0;
    }
  }

  int find(int x){
    if(par[x] == x)return x;
    return par[x] = find(par[x]);
  }

  void unite(int x,int y){
    x = find(x);
    y = find(y);
    if(x == y)return;
    if(rank[x] < rank[y])par[x] = y;
    else{
      par[y] = x;
      if(rank[x] == rank[y])rank[x]++;
    }
    return;
  }

  bool same(int x,int y){
    return find(x) == find(y);
  }
};

P pr[200000];

int main(){
  int x,y;
  UnionFind a,b;
  cin >> n >> m >> l;
  a.init(n);
  b.init(n);
  rep(i,0,m){
    cin >> x >> y;
    a.unite(x-1,y-1);
  }
  rep(i,0,l){
    cin >> x >> y;
    b.unite(x-1,y-1);
  }
  rep(i,0,n)pr[i] = mp(a.find(i),b.find(i));
  sort(pr,pr+n);
  rep(i,0,n){
    P ans = mp(a.find(i),b.find(i));
    cout << upper_bound(pr,pr+n,ans) - lower_bound(pr,pr+n,ans);
    if(i == n - 1)break;
    cout << " ";
  }
  puts("");
  return 0;
}

Measured memory_bytes: 5376
//sorted arrays

#include<iostream>
#include<deque>

using namespace std;

int main(){
    int N;
    cin>>N;
    deque<long> so;

    for(int i=0;i<N;i++){
        long x;
        cin>>x;
        if(!so.empty()&&so[so.size()-1]!=x||so.empty()){ 
            so.emplace_back(x);
        }
    }
/*
for(auto &x:so){
    cin>>x;
}
*/

    if(N==1){
        cout<<1<<endl;
        return 0;
    }

    int pre=0;
    bool cresc=true;
    bool newer=true;
    long ans=0;
    bool last=true;


    for(int i=1;i<so.size();++i){
        
        if(newer){
            if(so[i]<so[i-1]){
                cresc=false;
            }else{
                cresc=true;
            }
            newer=false;
        }
        if(cresc&&so[i]<so[i-1]){
            ans++;
            pre=i;
            newer=true;
            if(newer&&i==so.size()-1){
                ans++;
            }
        }else if(!cresc&&so[i]>so[i-1]){
            ans++;
            pre=i;
            newer=true;
            if(newer&&i==N-1){
                ans++;
            }
        }

    }

    if(pre!=N-1)ans++;

    cout<<ans<<endl;

}

Measured memory_bytes: 1024
#include<stdio.h>
int main(void){

int a,b,i,n;

while(1){
scanf("%d %d",&a,&b);
if(a == 0 && b == 0)break;
for(i = 1;i<=a;i++){
for(n=1;n<=b;n++){
if(1<i && i<a && n<b && 1<n)
    printf(".");
else printf("#");
}
    printf("\n");
}
  printf("\n");
}
return 0;
}



Measured memory_bytes: 2104
from fractions import gcd


def main():
    n, k = map(int, input().split())
    a = list(map(int, input().split()))

    g = a[0]
    for i in range(1, n):
        g = gcd(g, a[i])

    mx = max(a)

    if k > mx:
        bl = False

    else:
        if k % g == 0:
            bl = True
        else:
            bl = False

    print("POSSIBLE" if bl else "IMPOSSIBLE")


if __name__ == "__main__":
    main()


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

int max = 510000;
const int mod = 1000000007;
struct mint
{
    ll x; // typedef long long ll;
    mint(ll x = 0) : x((x % mod + mod) % mod) {}
    mint &operator+=(const mint a)
    {
        if ((x += a.x) >= mod)
            x -= mod;
        return *this;
    }
    mint &operator-=(const mint a)
    {
        if ((x += mod - a.x) >= mod)
            x -= mod;
        return *this;
    }
    mint &operator*=(const mint a)
    {
        (x *= a.x) %= mod;
        return *this;
    }
    mint operator+(const mint a) const
    {
        mint res(*this);
        return res += a;
    }
    mint operator-(const mint a) const
    {
        mint res(*this);
        return res -= a;
    }
    mint operator*(const mint a) const
    {
        mint res(*this);
        return res *= a;
    }
    mint pow(ll t) const
    {
        if (!t)
            return 1;
        mint a = pow(t >> 1);
        a *= a;
        if (t & 1)
            a *= *this;
        return a;
    }

    // for prime mod
    mint inv() const
    {
        return pow(mod - 2);
    }
    mint &operator/=(const mint a)
    {
        return (*this) *= a.inv();
    }
    mint operator/(const mint a) const
    {
        mint res(*this);
        return res /= a;
    }
};

struct combination
{
    vector<mint> fact, ifact;
    combination(int n) : fact(n + 1), ifact(n + 1)
    {
        assert(n < mod);
        fact[0] = 1;
        for (int i = 1; i <= n; ++i)
            fact[i] = fact[i - 1] * i;
        ifact[n] = fact[n].inv();
        for (int i = n; i >= 1; --i)
            ifact[i - 1] = ifact[i] * i;
    }
    mint operator()(int n, int k)
    {
        if (k < 0 || k > n)
            return 0;
        return fact[n] * ifact[k] * ifact[n - k];
    }
} comb(100005);

int main()
{

    long long N, K;
    cin >> N >> K;
    vector<long long> A(N, 0);
    rep(i, N)
    {
        cin >> A[i];
    }
    sort(A.begin(), A.end());
    mint ans = 0;
    rep(i, N - 1)
    {
        // cout << N - (i + 1) << "C" << K - 1 << "=" << COM(N - (i + 1), K - 1) << endl;
        mint num = A[N - 1 - i] - A[i];
        num *= comb(N - (i + 1), K - 1);
        ans += num;
    }
    cout << ans.x << endl;
    return 0;
}

Measured memory_bytes: 2560
#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif

using namespace std;

#define rep(i, n) for(ll i = 0; i < n; i++)
#define revrep(i, n) for(ll i = n-1; i >= 0; i--)
typedef long long ll;
typedef pair<int,int> Pint;
typedef pair<ll, ll> P;
typedef vector<ll> vec;
typedef vector<vec> mat;
//typedef pair<int, pair<int, int>> P;
//typedef tuple<int,int,int> T;
ll INFL = 1000000000000000010;//10^18 = 2^60
int INF = 1000000000;//10^9
ll MOD  = 1000000007;
//vector<int> dy = {0,0,1,-1};
//vector<int> dx = {1,-1,0,0};

int main(void){
  string S;
  cin >> S;
  int sl = S.size();
  ll ans = sl;
  rep(i, sl-1){
    if(S[i] != S[i+1]){
      ans = min(ans, max(i+1, sl-i-1));
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 512
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
typedef long long ll;
typedef pair<int,int> pint;
typedef pair<ll,int> pli;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;

int main(){
    int n;
    cin>>n;
    map<vector<int>,int> mp;
    rep(i,n){
        int w;
        cin>>w;
        vector<int> a={0,1,2};
        rep(j,w){
            int x;
            cin>>x;
            if(x)swap(a[1],a[2]);
            else swap(a[1],a[0]);
        }
        mp[a]++;
    }
    bool ok=false;
    if(mp[{0,1,2}])ok=true;
    if(mp[{0,2,1}]>=2)ok=true;
    if(mp[{1,0,2}]>=2)ok=true;
    if(mp[{2,1,0}]>=2)ok=true;
    if(mp[{1,2,0}]>=3)ok=true;
    if(mp[{2,0,1}]>=3)ok=true;
    if(mp[{1,2,0}]>=1&&mp[{2,0,1}]>=1)ok=true;
    if(mp[{0,2,1}]&&mp[{1,0,2}]&&mp[{1,2,0}])ok=true;
    if(mp[{0,2,1}]&&mp[{1,0,2}]&&mp[{2,0,1}])ok=true;
    if(mp[{2,1,0}]&&mp[{1,0,2}]&&mp[{1,2,0}])ok=true;
    if(mp[{2,1,0}]&&mp[{1,0,2}]&&mp[{2,0,1}])ok=true;
    if(mp[{0,2,1}]&&mp[{2,1,0}]&&mp[{1,2,0}])ok=true;
    if(mp[{0,2,1}]&&mp[{2,1,0}]&&mp[{2,0,1}])ok=true;
    if(ok)cout<<"yes"<<endl;
    else cout<<"no"<<endl;
    return 0;
}


Measured memory_bytes: 3120
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007

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

  vector<vector<long long>> num(S+1,vector<long long>(S+1));
  for(int i = 3;i <= S;i++) num[0][i] = 1;

  for(int i = 0;i < S;i++) {

    for(int j = 3*(i+1);j <= S-3;j++) num[i+1][j+3] += num[i][j];

    for(int j = 0;j < S;j++) {
      num[i+1][j+1] += num[i+1][j];
      num[i+1][j+1] %= MOD;
    }
  }

  long long ans = 0;
  for(int i = 0;i < S/3;i++) ans = (ans+num[i][S]) %MOD;
  cout << ans << endl;
}


Measured memory_bytes: 34456
t = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
k = input()

print(t[int(k) - 1])



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

using namespace std;

int main() {
    int A,B,K;
    cin >> A >> B >> K;
    int flag = 0;
    for(int i = min(A,B); i >= 0; --i){
        if(A%i == 0 && B%i == 0 ){
            ++flag;
            if(flag == K){
                cout << i;
                return 0;
            }
        }
    } 

}

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(1 << 25)
read = sys.stdin.readline
ra = range
enu = enumerate


def read_ints():
    return list(map(int, read().split()))


def read_a_int():
    return int(read())


def read_tuple(H):
    '''
    H is number of rows
    '''
    ret = []
    for _ in range(H):
        ret.append(tuple(map(int, read().split())))
    return ret


def read_col(H):
    '''
    H is number of rows
    A列、B列が与えられるようなとき
    ex1)A,B=read_col(H)    ex2) A,=read_col(H) #一列の場合
    '''
    ret = []
    for _ in range(H):
        ret.append(list(map(int, read().split())))
    return tuple(map(list, zip(*ret)))


def read_matrix(H):
    '''
    H is number of rows
    '''
    ret = []
    for _ in range(H):
        ret.append(list(map(int, read().split())))
    return ret
    # return [list(map(int, read().split())) for _ in range(H)] # 内包表記はpypyでは遅いため


MOD = 10**9 + 7
INF = 2**31  # 2147483648 > 10**9
# default import
from collections import defaultdict, Counter, deque
from operator import itemgetter
from itertools import product, permutations, combinations
from bisect import bisect_left, bisect_right  # , insort_left, insort_right
from math import gcd

print("ABC" if input() == 'ARC' else "ARC")


Measured memory_bytes: 84864
import java.util.Scanner;

public class Main{

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int n = Integer.parseInt(sc.next());
		
		int m = Integer.parseInt(sc.next());
		
		int sum = 0;
		
		for(int i = 0 ; i < m ;i++) {
			int a = Integer.parseInt(sc.next());
			sum  += a;
		}
		
		if(sum > n) {
			System.out.println(-1);
		}
		else {
			System.out.println(n - sum);
		}

	}

}


Measured memory_bytes: 34956
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 * @author GYSHGX868
 */
public class Main {
  public static void main(String[] args) {
    InputStream inputStream = System.in;
    OutputStream outputStream = System.out;
    InputReader in = new InputReader(inputStream);
    OutputWriter out = new OutputWriter(outputStream);
    TaskA solver = new TaskA();
    solver.solve(1, in, out);
    out.close();
  }

  static class TaskA {
    public void solve(int testNumber, InputReader in, OutputWriter out) {
      int a = in.nextInt();
      int b = in.nextInt();
      int c = in.nextInt();
      int d = in.nextInt();
      out.printLine(Math.max(a * b, c * d));
    }

  }

  static class OutputWriter {
    private final PrintWriter writer;

    public OutputWriter(OutputStream outputStream) {
      writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
    }

    public OutputWriter(Writer writer) {
      this.writer = new PrintWriter(writer);
    }

    public void close() {
      writer.close();
    }

    public void printLine(int i) {
      writer.println(i);
    }

  }

  static class InputReader {
    private InputStream stream;
    private byte[] buf = new byte[1024];
    private int curChar;
    private int numChars;
    private InputReader.SpaceCharFilter filter;

    public InputReader(InputStream stream) {
      this.stream = stream;
    }

    public int read() {
      if (numChars == -1) {
        throw new InputMismatchException();
      }
      if (curChar >= numChars) {
        curChar = 0;
        try {
          numChars = stream.read(buf);
        } catch (IOException e) {
          throw new InputMismatchException();
        }
        if (numChars <= 0) {
          return -1;
        }
      }
      return buf[curChar++];
    }

    public int nextInt() {
      int c = read();
      while (isSpaceChar(c)) {
        c = read();
      }
      int sgn = 1;
      if (c == '-') {
        sgn = -1;
        c = read();
      }
      int res = 0;
      do {
        if (c < '0' || c > '9') {
          throw new InputMismatchException();
        }
        res *= 10;
        res += c - '0';
        c = read();
      } while (!isSpaceChar(c));
      return res * sgn;
    }

    public boolean isSpaceChar(int c) {
      if (filter != null) {
        return filter.isSpaceChar(c);
      }
      return isWhitespace(c);
    }

    public static boolean isWhitespace(int c) {
      return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
    }

    public interface SpaceCharFilter {
      boolean isSpaceChar(int ch);

    }

  }
}



Measured memory_bytes: 21460
#include<queue>
#include<stack>
#include<math.h>
#include<cmath>
#include<bitset>
#include<stdio.h>
#include<string>
#include<map>
#include<algorithm>
#include<vector>
#include<iostream>
#include<utility>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
const ll MAX = 400010;
const ll mod = 998244353;
const ll MOD = 998244353;
long long fac[MAX], finv[MAX], inv[MAX];
// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
// 二項係数計算
long long COM(ll n, ll k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res*=a;
  }
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const {
    return pow(mod-2);
  }
  mint& operator/=(const mint a) {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const {
    mint res(*this);
    return res/=a;
  }
};
int main(){
  ll i,n,m,k;
  mint ans=0;
  COMinit();
  scanf("%lld %lld %lld\n",&n,&m,&k);
  for(i=0;i<=k;i++){
    ans+=m*modpow(m-1,n-i-1,mod)%mod*COM(n-1,i)%mod;
  }
  printf("%lld\n",ans);
  return 0;
}

Measured memory_bytes: 13192
#include <iostream>

using namespace std;

long long f(long long a) {
    switch (a % 4) {
        case 0: return a * 1LL;
        case 1: return 1LL;
        case 2: return a * 1LL + 1LL;
        case 3 : return 0LL;
        default: break;
    }
}

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

    long long a, b;
    cin >> a >> b;
    cout << (f(b * 1LL) ^ f(a * 1LL - 1LL)) << '\n';

    return 0;
}


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

typedef long double dbl;

const int maxv = 3005;

dbl cmp(pair<int, int> a)
{
	if(a.first && a.second) return (dbl(a.second*100)/(a.first+a.second));
	else return -1;
}

int main(void)
{
	int a, b, c, d, e, f;
	scanf("%d%d%d%d%d%d", &a, &b, &c, &d, &e, &f);

	vector<int> poss;
	for(int i = 0;i < maxv;i++)
	{
		for(int j = 0;j < maxv;j++) poss.push_back(-(i*c+j*d));
	}

	sort(poss.begin(), poss.end());
	poss.resize(int(unique(poss.begin(), poss.end())-poss.begin()));

	pair<int, int> cur = {0, 0};
	for(int i = 0;i < maxv;i++)
	{
		for(int j = 0;j < maxv;j++)
		{
			int w = (i*a+j*b)*100;
			if(w > f) continue;
			int maxd = min(f-w, e*(w/100));
			int r = (-*lower_bound(poss.begin(), poss.end(), -maxd));
			if(cmp(cur) <= cmp({w, r})) cur = {w, r};
		}
	}
	printf("%d %d\n", cur.first+cur.second, cur.second);
}

Measured memory_bytes: 67936
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for(int i = int(a); i < int(b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
#define all(x) (x).begin(), (x).end()

const long long INFLL = 1LL << 60;
const int INFINT = 1 << 30;
const long long MOD = 1e9 + 7;

template <class T> void vecout(T V) {
    auto t = V.begin();
    while(t != V.end()) {
        cout << *t++;
        if(t != V.end()) cout << " ";
    }
    cout << endl;
};

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, m, x;
    cin >> n;
    set<int> a, b, c;
    rep(i, n) {
        cin >> x;
        a.insert(x);
    }
    cin >> m;
    rep(i, m) {
        cin >> x;
        b.insert(x);
    }
    set_union(all(a), all(b), inserter(c, end(c)));
    for(auto e : c) {
        cout << e << "\n";
    }
}


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

using namespace std;
using int64 = long long;

constexpr int DEBUG = 0;

constexpr int64 P = 1000000007;

struct FiniteField {
 private:
  int64 x;
  static inline int64 Normalize(int64 x) {
    if (0 <= x && x < P) return x; x %= P; if (x < 0) x += P; return x;
  }
 public:
  FiniteField(int64 x) : x(Normalize(x)) {}
  FiniteField() : x(0) {}
  int64 Value() const { return x; }
  inline FiniteField operator+(FiniteField o) const {
    FiniteField r(*this); r += o; return r;
  }
  inline FiniteField operator-(FiniteField o) const {
    FiniteField r(*this); r -= o; return r;
  }
  inline FiniteField operator* (FiniteField o) const {
    FiniteField r(*this); r *= o; return r;
  }
  inline FiniteField operator/ (FiniteField o) const {
    FiniteField r(*this); r /= o; return r;
  }
  inline void operator+= (FiniteField o) { x = (x + o.x) % P; }
  inline void operator-= (FiniteField o) { x = (x + P - o.x) % P; }
  inline void operator*= (FiniteField o) { x = (x * o.x) % P; }
  void operator/=(FiniteField o) {
    int64 p = P - 2; while (p) { if (p % 2) { *this *= o; } o *= o; p /= 2; }
  }
};

ostream& operator<<(ostream& s, const FiniteField& v) { s << v.Value(); return s; }

tuple<vector<FiniteField>, vector<FiniteField>> MakeFactorialTables(int n) {
  vector<FiniteField> factorials(n + 1);
  vector<FiniteField> inverse_factorials(n + 1);
  factorials[0] = 1;
  for (int i = 1; i <= n; i++) {
    factorials[i] = factorials[i - 1] * i;
  }
  inverse_factorials[n] = FiniteField(1) / factorials[n];
  for (int i = n; i >= 1; i--) {
    inverse_factorials[i - 1] = inverse_factorials[i] * i;
  }
  return make_tuple(factorials, inverse_factorials);
}

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

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

  if (k == 1) {
    cout << static_cast<int64>(n) * static_cast<int64>(n - 1) << endl;
    return 0;
  }

  vector<FiniteField> fs, i_fs;
  tie(fs, i_fs) = MakeFactorialTables(n + 1);
  auto c_fn = [&](int a, int b) -> FiniteField {
    if (a < b) return 0;
    return fs[a] * i_fs[b] * i_fs[a - b];
  };

  FiniteField ans = 0;
  for (int a = 0; a <= min(n - 1, k); a++) {
    ans += c_fn(n, a) * c_fn(n - 1, a);
    // cout << ans << endl;
  }
  cout << ans << endl;
}

Measured memory_bytes: 6528
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using static System.Console;
using static System.Math;

namespace AtTest.ABC_133
{
    class E
    {
        static void Main(string[] args)
        {
            Method(args);
        }

        static void Method(string[] args)
        {
            int[] nk = ReadInts();
            long n = nk[0];
            long k = nk[1];

            List<int>[] graph = new List<int>[n];
            for (int i = 0; i < n; i++) graph[i] = new List<int>();
            for(int i = 0; i < n-1; i++)
            {
                int[] ab = ReadInts();
                int a = ab[0]-1;
                int b = ab[1]-1;
                graph[a].Add(b);
                graph[b].Add(a);
            }

            long mask = 1000000000 + 7;
            Queue<long[]> que = new Queue<long[]>();
            que.Enqueue(new long[2] { 0, -1 });
            long[] vals = new long[n];
            for (int i = 0; i < n; i++) vals[i] = 0;
            vals[0] = k;
            while (que.Count > 0)
            {
                long[] val = que.Dequeue();
                long index = val[0];
                long parent = val[1];
                long cnt = parent >= 0 ? k - 2 : k - 1;
                for(int i = 0; i < graph[index].Count; i++)
                {
                    if (parent == graph[index][i]) continue;

                    vals[graph[index][i]] = cnt;
                    cnt--;
                    que.Enqueue(new long[2] { graph[index][i], index });
                }
            }

            long res = 1;
            for(int i = 0; i < n; i++)
            {
                res *= vals[i];
                res %= mask;
            }
            WriteLine(res);
        }

        private static string Read() { return ReadLine(); }
        private static char[] ReadChars() { return Array.ConvertAll(Read().Split(), a => a[0]); }
        private static int ReadInt() { return int.Parse(Read()); }
        private static long ReadLong() { return long.Parse(Read()); }
        private static double ReadDouble() { return double.Parse(Read()); }
        private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
        private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
        private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }
    }
}


Measured memory_bytes: 35208
#include <iostream>


int main()
{
    long long n,m,l=0,r=0;
    std::cin>>n>>m;
    std::cin>>l>>r;
    for (int i=1; i<m; i++)
    {
        long long li,ri;
        std::cin>>li>>ri;
        if (li>l) l=li;
        if (ri<r) r=ri;
    }
    if (l>r) std::cout<<0;
    else std::cout<<r+1-l;
    return 0;
}


Measured memory_bytes: 3596
#include <cstdio>

int main()
{
	int n;

	int i;
	int res = 0;
	scanf("%d", &n);
	for (i = 0; i < n; i++) {
		int a;
		scanf("%d", &a);
		if (i % 2 == 0 && a % 2 == 1)
			res++;
	}
	printf("%d\n", res);

	return 0;
}

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

int main(){
    while (1){
        int a, b;
        cin >> a >> b;
        if (a == 0 && b == 0) break;
        else{ 
            for (int i= 0; i<a; i++){
                for (int j=0; j<b; j++){
                    cout << '#';
                }
            cout << endl;
            }
            cout << endl;
        }
    }
}


Measured memory_bytes: 3064
#include<cstdio>
#include<iostream>
using namespace std;
int a[10000001],maxn=0,flag;
long long sum=0;
int Max(int a,int b){
	return a>b?a:b;
}
int main(){
	int n;
	cin>>n;
	for(int i=1;i<=n;i++){
		cin>>a[i];
		if(maxn<a[i])
		flag=i,maxn=a[i];
	} 
	for(int i=1;i<=n;i++){
		if(i!=flag)
		sum+=a[i];
		else
		sum+=(a[i]/2);
	}
	cout<<sum<<endl;
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main{
    public static void main(String arg[]){
        String ans="";
        Scanner sc=new Scanner(System.in);
        while(sc.hasNext()){
            if(!(ans.isEmpty()))System.out.printf(" ");
            String str=sc.next();
            int N=str.length();
            ans="";
            for(int i=0;i<N;i++){
                if(str.charAt(i)!=str.substring(i,i+1).toUpperCase().charAt(0))ans+=str.substring(i,i+1).toUpperCase();
                else if(str.charAt(i)!=str.substring(i,i+1).toLowerCase().charAt(0))ans+=str.substring(i,i+1).toLowerCase();
                else ans+=str.substring(i,i+1);
            }
            System.out.printf("%s",ans);
        }
        System.out.println();
        sc.close();
    }
}


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

#define pb push_back
#define mp make_pair
#define fst first
#define snd second

#define fr(i,n) 	for(int i=0;i<n;i++)
#define frr(i,n)	for(int i=1;i<=n;i++)
#define pv(x, n)    fr(iii, n) printf("%d%c", x[iii], " \n"[iii==n-1])
#define pvv(x, n)    frr(iii, n) printf("%d%c", x[iii], " \n"[iii==n])
#define vp(v)        pv(v, v.size()) 


#define ms(x,i)	memset(x,i,sizeof(x))
#define dbg(x)	cout << #x << " = " << x << endl
#define all(x)	x.begin(),x.end()
#define otp(x) cout << x << endl;
#define rvr(x) int x; scanf("%d", &x)
#define gnl cout << endl
#define olar cout << "olar" << endl
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL)

typedef long long int ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<pii> vii;
typedef vector<ll> vll;
typedef pair<ll,ll> pll;

const int INF = 0x3f3f3f3f;
const ll llINF = 0x3f3f3f3f3f3f3f;
const int N = 2e3 + 1;

vi adj[N];
int dist[N][N], ans[N];

int main(){
    ms(dist, -1);
    rvr(n);
    int x, y; scanf("%d%d", &x, &y);
    adj[x].pb(y);
    adj[y].pb(x);
    frr(i, n-1){
        adj[i].pb(i+1);
        adj[i+1].pb(i);
    }
    queue<int> q;
    frr(i, n){
        dist[i][i] = 0;
        q.push(i);
        while(!q.empty()){
            int v = q.front();
            q.pop();
            for(auto u: adj[v]){
                if(dist[u][i] == -1){
                    dist[u][i] = dist[v][i] + 1;
                    q.push(u);
                    ans[dist[u][i]]++;
                }
            }
        }
    }
    frr(i, n-1){
        printf("%d\n", ans[i]/2);
    }
}


Measured memory_bytes: 16000
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#define IO(i, o) freopen(i, "r", stdin), freopen(o, "w", stdout)

using namespace std;
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
mt19937 rng((uint32_t)chrono::steady_clock::now().time_since_epoch().count());

int r;

int main(){
	//IO("input.txt", "output.txt");
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cin >> r;
	cout << (r * 2 * 3.14) << "\n";
	return 0;
}

Measured memory_bytes: 3788
use std::io;

fn main() {
    loop {
        let mut input = String::new();
        io::stdin().read_line(&mut input).ok();

        let mut iter = input.split_whitespace();
        let a = iter.next().unwrap().parse::<i32>().unwrap();
        let op = iter.next().unwrap();
        let b = iter.next().unwrap().parse::<i32>().unwrap();

        match op {
            "+" => println!("{}", a + b),
            "-" => println!("{}", a - b),
            "*" => println!("{}", a * b),
            "/" => println!("{}", a / b),
            _   => break,
        }
    }
}



Measured memory_bytes: 5024
#include <iostream>
#include <vector>
#include <cmath>
#include <cstring>
#include <algorithm>
#include <iomanip>
#include <map>
#include <set>
#include <string>
#include <queue>

using namespace std;
typedef long long ll;
typedef long double ld;

int main()
{
	int a, b;
	cin >> a >> b;
	cout << a * b - (a + b - 1);
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0; i<(n); i++)
int main(){
    ll n,m;
    cin>>n>>m;
    ll mod=1000000007;
    vector<bool> a(n+1,true);
    vector<ll> dp(n+1,0);
    rep(i,m){ll aa; cin>>aa; a.at(aa)=false;}
    if(a.at(0)) dp.at(0)=1;
    if(a.at(1)) dp.at(1)=1;
    for(int i=2;i<=n;i++){
        if(a.at(i)) dp.at(i)=dp.at(i-1)+dp.at(i-2);
        dp.at(i)%=mod;
    }
    cout<<dp.at(n)<<endl;
}

Measured memory_bytes: 1024
#include <stdio.h>
#define NMAX 100
#define AMAX 4
#define MOD 10007
#define MIN(a, b) ((a) < (b) ? (a) : (b))
int main(void)
{
  int i, j, k, l, m, J, K, L, M, x, n, a, prea = 0, s = 0;
  int binom[NMAX*AMAX+1][NMAX*AMAX+1] = {0}, dp[NMAX+1][NMAX*AMAX+1][AMAX*2][AMAX] = {0};
  for (i = 0; i <= NMAX * AMAX; i++) {
    binom[i][0] = binom[i][i] = 1;
    for (j = 1; j < i; j++) {
      binom[i][j] = (binom[i-1][j] + binom[i-1][j-1]) % MOD;
    }
  }
  scanf("%d", &n);
  dp[0][0][0][0] = 1;
  for (i = 0; i < n; i++) {
    scanf("%d", &a);
    long long dupli = 1;
    for (j = 1; j <= a; j++) dupli *= j;
    for (j = 0; j <= s + 1; j++) {
      for (k = 0; k <= 7; k++) {
	for (l = 0; l <= 3; l++) {
	  for (x = 1; x <= MIN(s + 1, a); x++) {
	    if (dp[i][j][k][l]) {
	      m = 2 * (prea - l) - k;
	      for(J = 0; J <= MIN(x, j); J++) {
		for(K = 0; K <= MIN(x - J, k); K++) {
		  for(L = 0; L <= MIN(x - J - K, l); L++) {
		    for(M = 0; M <= MIN(x - J - K - L, m); M++) {
		      dp[i+1][j+k+l-J-K-L][K+2*L+M][a-x] = (dp[i+1][j+k+l-J-K-L][K+2*L+M][a-x] + dupli * binom[a-1][x-1] * binom[j][J] * binom[k][K] * binom[l][L] * binom[m][M] * binom[s-j-k-l-m+1][x-J-K-L-M] * dp[i][j][k][l]) % MOD;
		    }
		  }
		}
	      }
	    }
	  }
	}
      }
    }
    s += a;
    prea = a;
  }
  printf("%d\n", dp[n][0][0][0]);
}


Measured memory_bytes: 7540
#include <iostream>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <map>
#include <queue>

static const int MOD = 1000000007;
using ll = long long;
using u32 = unsigned;
using namespace std;

template<class T>
constexpr T INF = ::numeric_limits<T>::max() / 32 * 15 + 208;

int main() {
    string s;
    cin >> s;
    if(s.length() == 3) reverse(s.begin(), s.end());
    cout << s << "\n";
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int Y = sc.nextInt();
		for (int i=0;i<=N&&i*10000<=Y;i++ ) {
			int now = Y -i *10000;
			for (int j=0;j+i<=N &&j*5000<=now;j++) {
				int temp = now -j *5000;
				if (temp %1000==0 &&j+i+temp/1000==N) {
					System.out.println(i+" "+j+" "+temp/1000);
					return ;
				}
			}
		}
		System.out.println("-1 -1 -1");
	}
}

Measured memory_bytes: 39508
#include <bits/stdc++.h>
#include <boost/range/adaptor/indexed.hpp>
using namespace std;

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

template <typename T>
std::ostream &operator<<(std::ostream &ostr, const std::vector<T> &v) {
  for (const auto &i : v | boost::adaptors::indexed())
    ostr << (i.index() > 0 ? " " : "") << i.value();
  return ostr;
}

inline void Main() {
  // code
  string s;
  cin >> s;

  int goukei = (int)(s.at(0)-'0');
  string result;result.push_back(s.at(0));
  rep(bit, 1<<3) {
    rep(i, 3) {
      if(bit&(1<<i)) {
        goukei+=(int)(s.at(i+1)-'0');
        result.push_back('+');
        result.push_back(s.at(i+1));
      } else {
        goukei-=(int)(s.at(i+1)-'0');
        result.push_back('-');
        result.push_back(s.at(i+1));
      }
    }
    if(goukei==7) {
      cout << result << "=7" << endl;
      return;
    }
    goukei = (int)(s.at(0)-'0');
    result.clear();result.push_back(s.at(0));
  }
}

int main() {
  std::cin.tie(0);
  std::ios::sync_with_stdio(false);
  std::cout << std::fixed << std::setprecision(20);
  Main();
  return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<iostream>
#include<algorithm>
#include<queue>
#include<stack>
#include<map>

using namespace std;
typedef long long ll;
const int maxx = 1e5 + 5;

int main(){
	string s;
	while(cin >> s){
		int a = (s[0] - '0') * 1000 + (s[1] - '0') * 100 + (s[2] - '0') * 10 + (s[3] - '0');
		int b = (s[5] - '0') * 10 + (s[6] - '0');
		int c = (s[8] - '0') * 10 + (s[9] - '0');
		int n = a * 10000 + b * 100 + c;
		if(n <= 20190430) cout << "Heisei" << endl;
		else cout << "TBD" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include<iostream>

int main(void){
    long long n, d;
    std::cin >> n >> d;
    long long d2 = d * d;
    int cnt = 0;
    long long x, y;
    for(int i = 0; i < n; i++){
        std::cin >> x >> y;
        if(x * x + y * y <= d2) cnt++;
    }
    std::cout << cnt << std::endl;
    return 0;
}

Measured memory_bytes: 3540
from collections import Counter

total = 0
n = int(input())
word_list = ["".join(sorted(input())) for _ in range(n)]
count_words = dict(Counter(word_list))
for item in count_words:
    ans = 0
    tmp = count_words[item] - 1
    ans = 1/2 * tmp * (tmp + 1)
    total += ans
print(int(total))

Measured memory_bytes: 22824
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

import numpy as np

N,T = map(int,readline().split())
m = map(int,read().split())
AB = sorted(zip(m,m))

can_add = [0] * N
for n in range(N-1,0,-1):
    x = can_add[n]
    y = AB[n][1]
    can_add[n-1] = x if x > y else y

dp = np.zeros(T,np.int64)

answer = 0
for i,(a,b) in enumerate(AB):
    np.maximum(dp[a:], dp[:-a] + b, out = dp[a:])
    x = dp.max() + can_add[i]
    if answer < x:
        answer = x

print(answer)


Measured memory_bytes: 12648
/*input
*/
#include <bits/stdc++.h>
#define fastIo ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define fi first
#define se second
#define sz size
#define pb push_back
#define mp make_pair
using namespace std;

//#define LOCAL
#ifdef LOCAL
	#define DEBUG(x) do { cout << #x << ": " << x << '\n'; } while (0)
#else
	#define DEBUG(x) 
#endif

const double EPS = 1e-9;
const double PI = 3.141592653589793238462;

const int dr[] = {1, 1, 0, -1, -1, -1, 0, 1};
const int dc[] = {0, 1, 1, 1, 0, -1, -1, -1};

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

int main(){
	fastIo;

	char a, b;
	cin >> a >> b;

	if(a == b) cout << "H\n";
	else cout << "D\n";

	return 0;
}

Measured memory_bytes: 256
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/*
 * AtCoder Beginner Contest 106 A "Garden"
 *   https://abc106.contest.atcoder.jp/tasks/ghi_q/
 */
public class Main {

	public static void main(String[] args) {

		InputScanner in = new InputScanner(System.in);
		PrintWriter out = new PrintWriter(System.out);

		Task task = new Task();
		task.run(in, out);

		in.close();
		out.close();
	}

	static class Task {

		public void run(InputScanner in, PrintWriter out) {

			int A = in.nextInt();
			int B = in.nextInt();

			int ans = A * B - A - B + 1;
			out.println(ans);
		}
	}

	/*
	 * extends java.util.Scanner
	 */
	static class InputScanner {

		Scanner scanner;

		public InputScanner(InputStream inputStream) {
			this.scanner = new Scanner(inputStream);
		}

		public boolean hasNext() {
			return scanner.hasNext();
		}

		public int nextInt() {
			return Integer.parseInt(scanner.next());
		}

		public long nextLong() {
			return Long.parseLong(scanner.next());
		}

		public double nextDouble() {
			return Double.parseDouble(scanner.next());
		}
		public String next() {
			return scanner.next();
		}

		public int[] nextIntArray(int n) {
			int[] ret = new int[n];
			for (int i = 0; i < n; i++) {
				ret[i] = scanner.nextInt();
			}
			return ret;
		}

		public int[][] nextIntArray(int h, int w) {
			int[][] ret = new int[h][w];
			for (int i = 0; i < h; i++) {
				for (int j = 0; j < w; j++) {
					ret[i][j] = scanner.nextInt();
				}
			}
			return ret;
		}

		public long[] nextLongArray(int n) {
			long[] ret = new long[n];
			for (int i = 0; i < n; i++) {
				ret[i] = scanner.nextLong();
			}
			return ret;
		}

		public long[][] nextlongArray(int h, int w) {
			long[][] ret = new long[h][w];
			for (int i = 0; i < h; i++) {
				for (int j = 0; j < w; j++) {
					ret[i][j] = scanner.nextLong();
				}
			}
			return ret;
		}

		public double[] nextDoubleArray(int n) {
			double[] ret = new double[n];
			for (int i = 0; i < n; i++) {
				ret[i] = scanner.nextDouble();
			}
			return ret;
		}

		public double[][] nextDoubleArray(int h, int w) {
			double[][] ret = new double[h][w];
			for (int i = 0; i < h; i++) {
				for (int j = 0; j < w; j++) {
					ret[i][j] = scanner.nextLong();
				}
			}
			return ret;
		}

		public String[] nextStringArray(int n) {
			String[] ret = new String[n];
			for (int i = 0; i < n; i++) {
				ret[i] = scanner.next();
			}
			return ret;
		}

		public String[] nextStringArray(String split) {
			String[] ret = scanner.next().split(split);
			return ret;
		}

		public String[][] nextStringArray(int h, int w) {
			String[][] ret = new String[h][w];
			for (int i = 0; i < h; i++) {
				for (int j = 0; j < w; j++) {
					ret[i][j] = scanner.next();
				}
			}
			return ret;
		}

		public String[][] nextStringArray(int h, String split) {
			String[][] ret = new String[h][];
			for (int i = 0; i < h; i++) {
				ret[i] = scanner.next().split(split);
			}
			return ret;
		}

		public void close() {
			scanner.close();
		}

	}

}


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

#define CEIL(a,b) ((a) / (b) + ((a) % (b) == 0 ? 0 : 1))

using namespace std;
using ll = long long;
using pii = pair<int, int>;

constexpr int MOD = int(1e9 + 7);
constexpr int INF = int(1e9 + 1);
constexpr ll LLINF = ll(4 * 1e18 + 1);
// constexpr int INF = 2147483647; // 2 * 1e9
// constexpr ll LLINF = 9223372036854775807; // 9 * 1e18

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

int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(10);
    int a, b, c;
    cin >> a >> b >> c;
    if(a == b && b == c) cout << "Yes\n";
    else cout << "No\n";
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#define A 100

int sw=0;

void bubblesort(int *a, int n){
  int tmp,flag=1,i;

  while(flag==1){
    flag=0;

    for(i=n-1;i>0;i--){
      if(a[i]<a[i-1]){
        tmp=a[i];
        a[i]=a[i-1];
        a[i-1]=tmp;
        flag=1;
        sw++;
      }
    }
  }
}

void print(int *a, int n){
  int i;

  for(i=0;i<n-1;i++) printf("%d ",a[i]);
  printf("%d\n%d\n",a[i],sw);
}

int main(){
  int tmp,flag=1,i,a[A],n,sw=0;

  scanf("%d",&n);
  for(i=0;i<n;i++) scanf("%d",&a[i]);

  bubblesort(a,n);
  print(a,n);

  return 0;
}




Measured memory_bytes: 2108
n = int(input())
p = [int(line) for line in input().split()]

count = 0
for i in range(1,n-1):
    if (p[i-1]<p[i] and p[i]<p[i+1]) or (p[i+1]<p[i] and p[i]<p[i-1]):
        count += 1
print(count)

Measured memory_bytes: 38384
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
using ll = long long;
using P = pair<int,int>;
int main()
{
    int n;
    cin >> n;
    vector<ll> a(n),b(n),c(n);
    rep(i,n)cin >> a[i];
    rep(i,n)cin >> b[i];
    rep(i,n)cin >> c[i];
    sort(a.begin(),a.end());
    sort(b.begin(),b.end());
    sort(c.begin(),c.end());
    ll ans = 0;
    rep(i,n){
        ll x = b[i];
        ll cind = upper_bound(c.begin(),c.end(),x)- c.begin();
        ll aind = lower_bound(a.begin(),a.end(),x)- a.begin();
        ans += (n-cind)*aind;
    

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

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

#define FOR(i,a,b) for(int i=(a);i<(b);i++)

int main() {
  int n,m;
  cin >> n >> m;
  char a[n][n], b[m][m];
  FOR(i,0,n)FOR(j,0,n)cin >> a[i][j];
  FOR(i,0,m)FOR(j,0,m)cin >> b[i][j];

  FOR(i,0,n-m+1)FOR(j,0,n-m+1){
    int count = 0;
    FOR(k,0,m)FOR(l,0,m){
      if(a[i+k][j+l] == b[k][l])count++;
      else {
        count = 0;
        break;
      }
    }
    if(count == m*m) {
       cout << "Yes" << endl;
       return 0;
    }
  }
  cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int maxx = 2e3 + 7;
int n, m, ans;
char s[maxx][maxx];
int res[maxx][maxx];
vector <int> vec1[maxx]; //每行#坐标
vector <int> vec2[maxx]; //每列#坐标

int main() {
	scanf("%d %d", &n, &m);
	for(int i = 0; i <= n + 1; i++) { //目的是把边界都初始化成#
		for(int j = 0; j <= m + 1; j++) s[i][j] = '#';
	}
	for(int i = 1; i <= n; i++) {
		for(int j = 1; j <= m; j++) scanf(" %c", &s[i][j]);
	}
	for(int i = 0; i <= n + 1; i++) {
		for(int j = 0; j <= m + 1; j++) {
			if(s[i][j] == '#') {
				vec1[i].push_back(j);
				vec2[j].push_back(i);
			}
		}
	}
	int pos = 0;
	for(int i = 1; i <= n; i++) {
		pos = 0;
		for(int j = 1; j <= m; j++) {
			if(s[i][j] == '.') {
				res[i][j] += vec1[i][pos + 1] - vec1[i][pos] - 1; //相邻两个#之间.的个数
			}
			else pos++;
		}
	}
	pos = 0;
	for(int j = 1; j <= m; j++) {
		pos = 0;
		for(int i = 1; i <= n; i++) {
			if(s[i][j] == '.') {
				res[i][j] += vec2[j][pos + 1] - vec2[j][pos] - 1; //相邻两个#之间.的个数
			}
			else pos++;
		}
	}
	for(int i = 1; i <= n; i++) {
		for(int j = 1; j <= m; j++) ans = max(ans, res[i][j] - 1); //(i, j)位置的点算了两次
	}
	printf("%d\n", ans);
	return 0;
}

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

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

  char c;
  while(cin >> c) {
    char cc = (c - 'A') - 3;
    if(cc < 0) {
      cc += 26;
    }
    cc += 'A';
    cout << cc;
  }
  cout << endl;
}

Measured memory_bytes: 1172
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pll = pair<ll, ll>;
using vl = vector<ll>;

/* short */
#define pb push_back
#define mp make_pair
#define Fi first
#define Se second
#define ALL(v) begin(v), end(v)
#define RALL(v) rbegin(v), rend(v)

/* REPmacro */
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define FORR(i, a, b) for(int i = (a); i >= (b); i--)
#define REP(i, n) for(int i = 0; i < (n); i++)
#define FOREACH(x, a) for(auto x : a)

/* exchange */
#define CHMIN(a, b) (a) = min((ll)(a), (ll)(b))
#define CHMAX(a, b) (a) = max((ll)(a), (ll)(b))

/* function */
#define IN(x) cin >> x
#define DEBUG(x) cerr << (x) << " "
#define LN() cerr << "\n"
#define PRINT(x) cout << (x) << endl
#define BR cout << endl

/* const */
const int ARRAY = 100005;
const int INF = 1001001001; // 10^9
const ll LINF = 1001001001001001001; // 10^18
const int MOD = 1e9 + 7;

ll N = 0;
ll K = 0;
ll ret = 0;
string s;
bool table[ARRAY];

int main(void){
  
  IN(N);
  IN(K);
  REP(i, K+1) {
    table[i] = false;
  }
  vl a(N);
  REP(i, N) {
    IN(a[i]);
    table[a[i]] = true;
  }
  table[0] = 0;
  FOR(i, 1, K+1) {
    for (ll x : a) {
      if (i + x <= K) table[i + x] |= !table[i];
    }
  }
  // REP(i, K+1) {
  //   DEBUG(table[i]?"First":"Second");
  // }
  PRINT(table[K]?"First":"Second");



}


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

#define int long long 
#define boost ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

const int N = 100000 + 10;

int memo[N][2] , n , a[N];

int go(int pos , int inv){
	
	if(pos == n)
		return 0;

	if(memo[pos][inv] != -1)
		return memo[pos][inv];

	int ans;

	if(inv){
		if(pos == n-1){
			ans = -a[pos] + go(pos+1 , 0);
		}
		else{
			ans = max(-a[pos] + go(pos+1,0) , a[pos] + go(pos+1,1));
		}
	}
	else{
		if(pos == n-1)
			ans = a[pos] + go(pos+1,0);
		else{
			ans = max(a[pos]+go(pos+1,0) , -a[pos] + go(pos+1,1));
		}
	}

	return memo[pos][inv] = ans;	
}

int32_t main(){

	boost;
	cin >> n;

	for(int i = 0 ; i < n ; ++i){
		cin >> a[i];
	}

	memset(memo , -1 , sizeof(memo));

	cout << go(0,0);
	return 0;
}

Measured memory_bytes: 7296
N = int(input())
A = list(map(int,input().split()))

r = 0
ans = 0
s = x = 0
for l in range(N):
    r = max(l,r)
    while r < N and (s+A[r]) == (x^A[r]):
        s += A[r]
        x ^= A[r]
        r += 1
    s -= A[l]
    x ^= A[l]
    ans += r - l
print(ans)

Measured memory_bytes: 24712
#!/usr/bin/env python

H,W=list( int(i) for i in input().split() )
a=[]
for i in range(0, H):
    a.append(input())

def line():
    for i in range(0, W+2):
        print("#", end="")
    print()

line()

for i in range(0, H):
    print("#"+a[i]+"#")

line()

Measured memory_bytes: 3060