akhauriyash/Code-Regression huggingface dataset:
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<functional>
#include<iomanip>
#include<iostream>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<string>
#include<utility>
#include<vector>

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const ll MOD = 1000000007;
#define rep(i,n) for(int i=0;i<n;i++)
#define repl(i,s,e) for(int i=s;i<e;i++)
#define reple(i,s,e) for(int i=s;i<=e;i++)
#define revrep(i,n) for(int i=n-1;i>=0;i--)
#define all(x) (x).begin(),(x).end()

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


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

	ll ans = 0;
	vector<ll> d;
	rep(i, N)
	{
		ll a, b;
		cin >> a >> b;
		d.push_back(a + b);
		ans -= b;
	}
	
	sort(all(d), greater<ll>());
	
	rep(i, N)
	{
		if (i % 2 != 0) continue;
		ans += d[i];
	}

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

Measured memory_bytes: 1400
n, a, b, c, d = map(int, input().split())
s = input()
for i in range(a, max(c, d)):
  if s[i-1: i+1] == "##":
    print("No")
    exit()

if c < d:
  print("Yes")
  exit()
for i in range(b-1, d):
  if s[i-1:i+2] == "...":
    print("Yes")
    exit()
print("No")

Measured memory_bytes: 3572
#include<iostream>
using namespace std;
unsigned long long int totalSum=0;


void recur(unsigned long long int residual,unsigned long long int result,unsigned long long int index,string s){
    if(index==s.size()){
        totalSum+=result+residual;
        return;
    }
    recur(s[index]-'0',result+residual,index+1,s);
    recur(residual*10+(s[index]-'0'),result,index+1,s);
}
 int main(){
    string s;
    cin>>s;
    recur(s[0]-'0',0,1,s);
    cout<<totalSum;
}

Measured memory_bytes: 3660
R, G, B, N = map(int, input().split())
cnt = 0

for i in range(N//R+1):
    for j in range(N//G+1):
        b = N - R*i - G*j
        if(b < 0):
            break
        if(b%B == 0):
            cnt += 1
print(cnt)

Measured memory_bytes: 3060
/*
g++ -std=c++11 -Wall -O2 -o main.exe main.cpp
./main.exe
*/

#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <functional>
#include <algorithm>
#include <complex>
#include <numeric>
//最大公約数: gcd()
//最小公倍数: lcm()

#define ll long long int

using namespace std;

template <typename T>
void sortasc(vector<T> &v){ //vectorを昇順にソート
    sort(v.begin(), v.end(), std::greater<T>());
    return;
}

template <typename T>
void sortdesc(vector<T> &v){ //vectorを降順にソート
    sort(v.begin(), v.end(), std::less<T>());
    return;
}

//------------------------------------------------------------------------------

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

    for(int i = 0; 4 * i <= n; i++){
        if((n - 4 * i) % 7 == 0){
            cout << "Yes" << endl;
            return 0;
        }
    }

    cout << "No" << endl;
    return 0;
}


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

int main()
{
	string s, t, u;
	int a = 0, b = 0;
	cin >> s >> t >> a >> b >> u;
	if (s == u)
	{
		a -= 1;
	}
	else if (t == u)
	{
		b -= 1;
	}
	cout << a << " " << b;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using Int = long long;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}


template<typename T> void drop(const T &x){cout<<x<<endl;exit(0);}

//INSERT ABOVE HERE
signed main(){
  Int n;
  cin>>n;
  vector<Int> as(n);
  for(Int i=0;i<n;i++) cin>>as[i];

  map<Int, Int> cnt;
  for(Int a:as) cnt[a]++;

  if(cnt.size()>3u) drop("No");

  vector<Int> vs;
  for(auto p:cnt)
    vs.emplace_back(p.first);

  for(Int x:vs){
    for(Int y:vs){
      auto check=cnt;
      vector<Int> zs(n+2);
      zs[0]=x;check[zs[0]]--;
      zs[1]=y;check[zs[1]]--;
      for(Int i=2;i<n;i++){
        zs[i]=zs[i-1]^zs[i-2];
        check[zs[i]]--;
      }
      zs[n+0]=x;
      zs[n+1]=y;

      Int ok=1;
      for(auto p:check)
        ok&=p.second==0;

      for(Int i=1;i<=n;i++)
        ok&=zs[i]==(zs[i-1]^zs[i+1]);

      if(ok) drop("Yes");
    }
  }

  drop("No");
  return 0;
}


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

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

    int year = (S[0] - '0') * 1000 + (S[1] - '0') * 100 + (S[2] - '0') * 10 + (S[3] - '0');
    int month = (S[5] - '0') * 10 + (S[6] - '0');
    int day = (S[8] - '0') * 10 + (S[9] - '0');

    if(year <= 2019 && month <= 4 && day <= 30)
    {
        cout << "Heisei" << endl;
    }

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

    return 0;
}

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

int main(){
  int N;
  cin >> N;
  int sum = 0;
  int tmpmax = 0;
  for(int i = 0; i < N; i++){
    int tmp;
    cin >> tmp;
    if(tmp > tmpmax){
      tmpmax = tmp;
    }
    sum += tmp;
  }
  cout << sum - tmpmax/2 << endl;


}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pb push_back
#define ll long long
#define mod 1000000007
using namespace std;
ll i,j,k,n,m,dp[3007][3007];
string s[3007];
int main()
{
    cin>>n>>m;
    for(i=0;i<n;i++)
        cin>>s[i];
    dp[0][0]=1;
    for(i=0;i<n;i++)
    {
        for(j=0;j<m;j++)
        {
            if(s[i][j]=='#') continue;
            if(i-1>=0)
                dp[i][j]+=dp[i-1][j];
            if(j-1>=0)
                dp[i][j]+=dp[i][j-1];
            dp[i][j] %= mod;
        }
    }
    cout<<dp[n-1][m-1]<<endl;
    return 0;
}


Measured memory_bytes: 24832
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
#define fi first
#define se second
typedef pair<ll,ll> P;
using VP = vector<P>; using VVP = vector<VP>;
using VI = vector<ll>; using VVI = vector<VI>; using VVVI = vector<VVI>;
const int inf=1e9+7;
const ll INF=1LL<<61;
const ll mod=1e9+7;

int main(){
  int i,j;
  int n;
  cin>>n;
  int m=n+1;
  int cnt=0;
  for(i=0;i<n;i++){
    int x;
    cin>>x;
    if(m>=x) cnt++;
    m=min(x,m);
  }
  cout<<cnt<<endl;

  return 0;
}


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

int main()
{
    int N, H;
    scanf("%d %d", &N, &H);
    std::vector<std::pair<int, bool> > damage(2*N); // (damage, is_throwing)
    for(int i=0; i<2*N; i++){
        scanf(" %d", &(damage[i].first)); damage[i].second = (i % 2 != 0);
    }
    std::sort(damage.begin(), damage.end(), std::greater<std::pair<int, bool> >());
    int count = 0;
    for(auto &&itr = damage.begin(); itr != damage.end(); itr++){
        if(itr->second == true){
            H -= itr->first; count++;
            if(H <= 0) break;
        }
        else{
            count += (H-1) / (itr->first) + 1; break;
        }
    }
    std::cout << count << std::endl;
}

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

#define ll long long int

using namespace std;


bool solve(){
	
	int x,y;
	cin>>x>>y;
	
	for(int i=0; i<=x; i++){
		int p = i;
		int q = x-i;
		if (p*4 + q*2 == y){
			return true;
			}
		}
	
	return false;
	}


int main(){
	

	bool k = solve();
	
	if (k)
		cout<<"Yes"<<endl;
	else
		cout<<"No"<<endl;
	
	return 0;
}


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

int main() {
  int n; cin>>n;
  vector<vector<int>> combi_Digit(10,vector<int>(10,0));
  int ans=0;
  for(int i=1; i<=n; i++) {
    // 最小桁
    int min=i%10;
    int max=i;
    while(max>9) max/=10;
    combi_Digit[max][min]++;
  }
  for(int i=1; i<=9; i++) {
    for(int j=1; j<=9; j++) {
      if(i!=j) ans+=combi_Digit[i][j]*combi_Digit[j][i];
      else ans+=combi_Digit[i][j]*(combi_Digit[j][i]-1)+combi_Digit[i][j];
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 3656
while True:
    h, w = map(int, input().split())
    
    if h==0 and w==0: break
    
    for i in range(h):
        for j in range(w):
            if (i+j)%2==0:
                print("#", end="")
            else:
                print(".", end="")
        print()
    print()


Measured memory_bytes: 7000
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <tuple>
#include <utility>
#include <vector>
#define ll long long
#define itn int
#define endl '\n'
#define co(ans) cout<<ans<<endl
#define COYE cout<<"YES"<<endl
#define COYe cout<<"Yes"<<endl
#define COye cout<<"yes"<<endl
#define CONO cout<<"NO"<<endl
#define CONo cout<<"No"<<endl
#define COno cout<<"no"<<endl
#define FORE(i,a) for(auto &i:a)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define FFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n)  FFOR(i,1,n)
#define PB push_back
#define MP make_pair
#define ALL(V) (V).begin(),(V).end()
#define SORT(V) sort((V).begin(),(V).end())
#define REVERSE(V) reverse((V).begin(),(V).end())
#define EACH(V,i) for(typeof((V).begin()) i=(V).begin();i!=(V).end();++i)
#define equals(a,b) (fabs((a)-(b))<EPS)
#define INF ((1LL<<62)-(1LL<<31))
#define EPS 1e-10
#define PI 3.141592653589793238
#define MOD 1000000007
#define MMOD 998244353
#define MAX 2010101
using namespace std;
using Edge=pair<ll,ll>;
using Graph=vector<vector<int>>;
inline int toInt(string s){int v;istringstream sin(s);sin>>v;return v;}
template<class T>inline string toString(T x){ostringstream sout;sout<<x;return sout.str();}
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T>bool chmin(T &a,const T &b){if(b<a){a=b;return 1;}return 0;}
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int,int> PII;
typedef pair<ll,ll> PLL;
typedef long long LL;
const int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}

int main(){
  ll N,T;
  cin>>N>>T;
  
  ll A[N+1],B[N+1],MN[N+1];
  cin>>A[1];
  MN[1]=A[1];
  for(int i=2; i<=N; ++i){
    cin>>A[i];
    MN[i]=min(A[i],MN[i-1]);
    B[i]=A[i]-MN[i-1];
  }
  
  B[1]=0;
  ll mx=0;
  RREP(i,N) chmax(mx,B[i]);
  
  ll ans=0;
  RREP(i,N) if(B[i]==mx) ans++;
  cout<<ans<<endl;
  return 0;
}

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

int main() {
  int H[305], W[305];
  for (int i = 0; i < 300; i++) {
    cin >> H[i] >> W[i];
    if (H[i] == 0 && W[i] == 0) break;
  }

  for (int i = 0; i < 300; i++) {
    if (H[i] == 0 && W[i] == 0) break;
    for (int j = 0; j < H[i]; j++) {
      for (int k = 0; k < W[i]; k++) {
        cout << '#';
      }
      cout << endl;
    }
    cout << endl;
  }
}



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

int main(){
  int n;
  cin >> n;
  map<string,int> M;
  vector<string> s(n);
  vector<string> v;
  int mx = 0;
  for(int i = 0; i < n; i++)
  {
    cin >> s.at(i);
    M[s.at(i)]++;
    mx = max(mx,M[s.at(i)]);
  }
  for(int i = 0; i < n; i++)
  {
    if(M[s.at(i)]==mx)
    {
      v.push_back(s.at(i));
      M[s.at(i)] = -1;
    }
  }
  sort(v.begin(), v.end());
  for(int i = 0; i < v.size(); i++)
  {
    cout << v.at(i) << endl;
  }
  return 0;

}

Measured memory_bytes: 33360
#include <bits/stdc++.h>
// #include <boost/multiprecision/cpp_int.hpp>
using namespace std;
// namespace boost::multiprecision;
// using Bint = cpp_int;
#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##_len = (b); i < i##_len; ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
#define _repr(i, n) repri(i, n, 0)
#define repri(i, a, b) for(int i = int(a), i##_len = (b); i >= i##_len; --i)
/* 閉区間で定義しているので注意！repr(i,n,m)でn〜mまで */
#define repr(...) _overload3(__VA_ARGS__, repri, _repr, )(__VA_ARGS__)
/* 逆回しのループ。両閉区間であることに注意 */
#define all(x) (x).begin(), (x).end()
#define debug(x) cerr << #x << ": " << (x) << '\n'
typedef long long lint;
#define int lint
#define endl '\n'
const int INF = (int)1145141919;
int MOD = (int)1e9 + 7;
const double EPS = 1e-9;
const lint LINF = (lint)1e18;
typedef vector<int> vint;
typedef pair<int, int> pint;
template <class T> bool chmax(T &a, const T &b) {
    if(a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T> bool chmin(T &a, const T &b) {
    if(a > b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T, class U>
std::ostream &operator<<(std::ostream &os, const std::pair<T, U> p) {
    os << "(" << p.first << "," << p.second << ")";
    return os;
}
template <typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &p) {
    os << p.first << " " << p.second;
    return os;
}

template <typename T1, typename T2>
istream &operator>>(istream &is, pair<T1, T2> &p) {
    is >> p.first >> p.second;
    return is;
}

template <typename T> ostream &operator<<(ostream &os, const vector<T> &v) {
    os << "[";
    for(int i = 0; i < (int)v.size(); i++) {
        os << v[i] << (i + 1 != v.size() ? ", " : "");
    }
    os << "]";
    return os;
}

template <typename T> istream &operator>>(istream &is, vector<T> &v) {
    for(T &in : v)
        is >> in;
    return is;
}

template <typename T = lint> vector<T> make_v(size_t a) { return vector<T>(a); }

template <typename T, typename... Ts> auto make_v(size_t a, Ts... ts) {
    return vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...));
}

template <typename T, typename V>
typename enable_if<is_class<T>::value == 0>::type fill_v(T &t, const V &v) {
    t = v;
}

template <typename T, typename V>
typename enable_if<is_class<T>::value != 0>::type fill_v(T &t, const V &v) {
    for(auto &e : t)
        fill_v(e, v);
}

/* templates */ /* templates */ /* templates */ /* templates */ /* templates */
/* make directory: atcoder-tools gen コンテスト略称(ex.agc033) */
/* テストコード：atcoder-tools test */
/* 提出：atcoder-tools submit -u */

signed main() {
#ifdef LOCAL
    // ifstream in("in_2.txt");
    // cin.rdbuf(in.rdbuf());
#else
    cin.tie(0);
    ios::sync_with_stdio(false);
#endif

    /* input part */
    std::string b;
    std::cin >> b;

    /* write your code!*/
    if(b == "A") {
        cout << "T" << endl;
    } else if(b == "T") {
        cout << "A" << endl;
    } else if(b == "G") {
        cout << "C" << endl;
    } else if(b == "C") {
        cout << "G" << endl;
    }
}


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

using namespace std;
 
#define rep2(x,fr,to) for(int (x)=(fr);(x)<(to);(x)++)
#define rep(x,to) for(int (x)=0;(x)<(to);(x)++)
#define repr(x,fr,to) for(int (x)=(fr);(x)>=(to);(x)--)
#define all(c) (c).begin(),(c).end()
#define sz(v) (int)(v).size()

typedef int64_t ll; typedef vector<int> VI; typedef pair<int,int> pii;
const int MD = 1e9+7; typedef vector<ll> VL;
void dbg(){ cerr << "\n"; }  template <typename T,typename ...T2>
void dbg(const T& fst, const T2&...rst){ cerr << fst << ": "; dbg(rst...); }


int main(){
	cin.tie(0); ios_base::sync_with_stdio(false);
	string s;
	cin >>s;
	int n=sz(s);
	
	vector<VL> dp(n+3, VL(13));
	dp[0][0] =1;
	rep(i, n){
		rep(j, 13){
			if(isdigit(s[i])){
				int d = s[i] -'0';
				(dp[i+1][(j*10 + d) %13] += dp[i][j]) %=MD;
			}else{
				rep(p, 10) (dp[i+1][(j*10 + p) %13] += dp[i][j]) %=MD;
			}
		}
	}
	
	cout << dp[n][5] % MD <<"\n";
}



Measured memory_bytes: 13648
//
//  atcoder.cpp
//
//
///
#include <bits/stdc++.h>
#include <boost/optional.hpp>
#include <boost/range/irange.hpp>
#include <boost/range/algorithm.hpp>
#include <boost/range/numeric.hpp>
#include <boost/bimap/bimap.hpp>
#include <boost/bimap/multiset_of.hpp>
#include <boost/multi_array.hpp>
#include <boost/integer/common_factor_rt.hpp>
#include <boost/algorithm/string.hpp>
#include <boost/icl/interval_map.hpp>

#define REP(i, N) for(int i=0; i<(N); i++)
#define REC(f, ...) (void)0; const auto f = [&](const auto f, __VA_ARGS__)
using namespace std;
using namespace boost::integer;

using ll = long long;
namespace bst = boost;
namespace icl = boost::icl;
template<typename T> class in {
    T value;
public:
    in() { cin >> value; }
    operator const T&() const { return value; }
    operator T&() { return value; }
    in& operator=(T source) { value = source; return *this; }
};
template<> class in<string> : public string {
public:
    in() { cin >> *this; }
};
template<class T> class inseq : public T {
public:
    template<typename... Arg> inseq(Arg... arg) : T(forward<Arg>(arg)...) { for (auto&& i : *this) cin >> i; }
};
template<class T> using invec = inseq<vector<T>>;

auto solve() {
  in<ll> D;

  invec<int> c(26);
  vector<vector<int>> s(D, vector<int>(26));
  for (auto&& i : s)
    for (auto&& j : i)
      cin >> j;
  vector<int> t(D);
  int last[26] = {0};
  int r = 0, cost = 0;

  constexpr int BEAM = 8;
  using node = tuple<int, int>;
  REP(i, 26)
    cost += c[i];
  const int tier = cost;
  REP(i, D) {
    pair<int, int> cand = {0, 0};
    
    REP(j, 26)
      cand = max(cand, make_pair(r + s[i][j], j));
    t[i] = cand.second + 1;
    
    const int plan = t[i] - 1;
    r += s[i][plan];
    cost -= c[plan] * (i + 1 - last[plan]);
    last[plan] = i + 1;
    r -= cost;
    cost += tier;
    cout << t[i] << endl;
  }
}

template<typename T> void plot(const T& func) { cout << setprecision(9) << func() << endl; }
template<> void plot<void()>(void(&func)()) { func(); }

int main() {
  plot(solve);

  return 0;
}



Measured memory_bytes: 3676
def main():
    d = 0
    for i in range(M):
        if N%4 == 0 and reverse[i] - order[i] == N//2:
            d = 1
        if N%2 == 0 and i == (N//2-1) //2:
            d = 1
        print(order[i+d], reverse[i])

N, M = map(int, input().split())
order = [i for i in range(2, N+1)]
reverse = order[::-1]
main()

Measured memory_bytes: 80352
#include <iostream>
#include <cstdio>
#include <cstdlib>
using namespace std;

struct Node{
  int key;
  Node *prev, *next;
};

Node *nil;

void init(){
  nil = (Node *)malloc(sizeof(Node));
  nil->next = nil;
  nil->prev = nil;
}

void insert(int key){
  Node *x = (Node *)malloc(sizeof(Node));
  x->key = key;
  x->next = nil->next;
  nil->next->prev = x;
  nil->next = x;
  x->prev = nil;
}

Node* listSearch(int key){
  Node *cur = nil->next;
  while(cur != nil && cur-> key != key){
    cur = cur->next;
  }
  return cur;
}

void deleteNode(Node *t){
  if(t == nil) return;
  t->prev->next = t->next;
  t->next->prev = t->prev;
  free(t);
}

void deleteFirst(){
  deleteNode(nil->next);
}

void deleteLast(){
  deleteNode(nil->prev);
}

void deleteKey(int key){
  deleteNode(listSearch(key));
}

void printList(){
  Node *cur = nil->next;
  while(cur != nil){
    cout << cur->key;
    if(cur->next != nil) cout << " ";
    cur = cur->next;
  }
  cout << endl;
}

int main(void){
  int n, key;
  char command[20];

  init();

  scanf("%d", &n);
  for(int i = 0; i < n; i++){
    scanf("%s", command);
    if(command[0] == 'i'){
      scanf("%d", &key);
      insert(key);
    }else if(command[0] == 'd' && command[6] == '\0'){
      scanf("%d", &key);
      deleteKey(key);
    }else if(command[0] == 'd' && command[6] == 'F'){
      deleteFirst();
    }else if(command[0] == 'd' && command[6] == 'L'){
      deleteLast();
    }
  }

  printList();
  return 0;
}

Measured memory_bytes: 32360
from collections import defaultdict
from collections import deque
n,q = map(int,input().split())
d = defaultdict(list)
dp = [0] * n
ep = [0] * n
for i in range(n-1):
    ta,tb = map(int,input().split())
    d[ta-1].append(tb-1)
    d[tb-1].append(ta-1)
for i in range(q):
    ta,tb = map(int,input().split())
    dp[ta-1] +=tb
ep[0]+=1
l = deque()
l.append(0)
used = [False] * n
while l:
    t = l.pop()
    used[t] = True
    for i in d[t]:
        if not used[i]:
            dp[i] += dp[t]
            l.append(i)
print(*dp)

Measured memory_bytes: 74784
/*
g++ -std=c++14 -O2 -Wall a.cpp -o a && a
*/

//  io
#include <iostream>
//#include <fstream> //http://www.cplusplus.com/reference/fstream/fstream/
//#include <cstdio>
#include <iomanip> //http://www.cplusplus.com/reference/iomanip/
#include <limits>
//  util
#include <string>
#include <cstring>
#include <algorithm>
//#include <utility>
//#include <functional> //http://www.cplusplus.com/reference/functional/
//#include <cstdlib>
#include <cmath>
//#include <complex>
//#include <random>
//#include <bitset>
//  containers https://en.cppreference.com/w/cpp/container
#include <vector>
//#include <queue>
#include <set>
//#include <map>
//#include <unordered_set>
//#include <unordered_map>
//  time
//#include <ctime>
//#include <chrono>
//                  https://en.cppreference.com/w/cpp/header/chrono
//                  http://www.cplusplus.com/reference/chrono/

using namespace std;
typedef vector<int> arri;
typedef vector<float> arrf;
typedef pair<int, int> pairi;
typedef long long ll;
typedef long double ld;
const int mod = 1e9 + 7;
const ll inf = 0x7fffffffffffffff;
const ll infneg = -0x7fffffffffffffff;

//file input routed to stdinout
/*
std::ifstream inFile("input.txt");
std::ofstream outFile("output.txt");
std::cin.rdbuf(inFile.rdbuf());
std::cout.rdbuf(outFile.rdbuf());
*/

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

    string in;
    cin >> in;

    if (in == "Sunny")
    {
        cout << "Cloudy";
    }
    else if (in == "Cloudy")
    {
        cout << "Rainy";
    }
    else if (in == "Rainy")
    {
        cout << "Sunny";
    }
}

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

int main(){
long long N,ans;
cin>>N;    
int rtN=sqrt(N);
  for(int i=1;i<=rtN;i++){
  if(N%i==0){
  ans=N/i;
   }
  }
int digit=0;
//AとBのうち
  while(ans>0){
ans=ans/10;
  digit++;
}
 
cout<<digit<<endl;
}


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

#define INF 1.1e9
#define LINF 1.1e18
#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(), (v).end()
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define BIT(x,n) bitset<n>(x)

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

struct edge {
	int to,cost;
	edge(int t,ll c):to(t),cost(c) {}
};

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

//-----------------------------------------------------------------------------


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

	string s; cin>>s;
	int a=s[0]-'0',b=s[1]-'0',c=s[2]-'0',d=s[3]-'0';

	if(a+b+c+d==7) cout<<a<<'+'<<b<<'+'<<c<<'+'<<d<<"=7"<<endl;
	else if(a+b+c-d==7) cout<<a<<'+'<<b<<'+'<<c<<'-'<<d<<"=7"<<endl;
	else if(a+b-c+d==7) cout<<a<<'+'<<b<<'-'<<c<<'+'<<d<<"=7"<<endl;
	else if(a-b+c+d==7) cout<<a<<'-'<<b<<'+'<<c<<'+'<<d<<"=7"<<endl;
	else if(a+b-c-d==7) cout<<a<<'+'<<b<<'-'<<c<<'-'<<d<<"=7"<<endl;
	else if(a-b-c+d==7) cout<<a<<'-'<<b<<'-'<<c<<'+'<<d<<"=7"<<endl;
	else if(a-b+c-d==7) cout<<a<<'-'<<b<<'+'<<c<<'-'<<d<<"=7"<<endl;
	else if(a-b-c-d==7) cout<<a<<'-'<<b<<'-'<<c<<'-'<<d<<"=7"<<endl;

	return 0;
}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-
import sys
import copy
import collections
from bisect import bisect_left
from bisect import bisect_right
from collections import defaultdict
from heapq import heappop, heappush
import numpy as np

def main():
	S = list(input())
	T = list(input())
	
	for i in range(len(S)):
		tmp = S.pop(-1)
		S.insert(0, tmp)
		if S == T:
			print("Yes")
			sys.exit()
		
	print("No")
	
if __name__ == "__main__":
	main()


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

int main() {
    int n;
    cin >> n;
    for(int i = 1; i <= 9; i++){
        for(int j = 1; j <=9; j++){
            if( i * j == n){
                cout << "Yes" << endl;
                exit(0);
            }
        }
    }
    cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int a[110], b[110], c[110];

int main(){
    int n;
    scanf("%d", &n);
    for(int i = 0; i < n; i++){
        scanf("%d", &a[i]); a[i]--;
    }
    for(int i = 0; i < n; i++){
        scanf("%d", &b[i]);
    }
    for(int i = 0; i < n - 1; i++){
        scanf("%d", &c[i]);
    }

    int ans = 0;
    for(int i = 0; i < n; i++){
        ans += b[a[i]];
        if(i > 0 && a[i] == a[i - 1] + 1) ans += c[a[i - 1]];
    }
    printf("%d\n", ans);
}

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


int Q[1000];
int top=0;

void push(int);

int pop();


int main(){
  int s1,s2;
  char s[100];
  while( scanf(" %s", s) != EOF ){
    if(s[0]=='+'){
      s1=pop();
      s2=pop();
      push(s1+s2);
    }else if(s[0]=='-'){
      s2=pop();
      s1=pop();
      push(s1-s2);
    }else if(s[0]=='*'){
      s1=pop();
      s2=pop();
      push(s1*s2);
    }else {
      push(atoi(s));
    }
  }
  printf("%d\n",pop());
  return 0;
}

void push(int x){
  top++;
  Q[top]=x;
}

int pop(){
  top--;
  return Q[top+1];
}

Measured memory_bytes: 548
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, N) for (int i = 0; i < (int)N; i++)
#define all(a) (a).begin(), (a).end()

int N;
set<int> s;

int main () {
  cin >> N;
  rep(i,N) {
    int d;
    cin >> d;
    s.insert(d);
  }

  cout << s.size() << endl;
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<iomanip>
#include<utility>
#include<iomanip>
#include<map>
#include<queue>
#include<cmath>
#include<cstdio>

#define rep(i,n) for(int i=0; i<(n); ++i)
#define pai 3.1415926535897932384

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

char c[200000];

int main(int argc, const char * argv[]) {
    
    int N;
    cin >> N;
    cin >> c;
    
    int w=0;
    int count=0;
    for(int i=N-1; i>0; i--){
        if(c[i] == 'R'){
            while(w<N&&i>w){
                if(c[w]=='W'){
                    c[w] = c[i];
                    c[i] = 'W';
                    count++;
                    break;
                }
                w++;
            }
        }
    }
    
    cout << count << endl;
    
    return 0;
}


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

int main(){
  int A, B;
  string s;
  int count = 0;
  cin >> A >> B;
  for(int i = A; i <= B; i++){
    s = std::to_string(i);
    if(s[0] == s[4] && s[1] == s[3]){
      count++;
    }
  }
  cout << count << endl;
}

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

int main() {
  	string n;
  	cin >> n;
  	int sum=0;
	rep(i, n.size()) sum += (int)n.at(i)-48;
  	if(sum%9==0) cout << "Yes" << endl;
  	else cout << "No" << endl;
  	return 0;  
}


Measured memory_bytes: 3732
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,s,n) for(int i=s;i<n;i++)
#define all(in) in.begin(), in.end()
#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,s,n) for(int i=s;i<n;i++)
#define all(in) in.begin(), in.end()
#define MP make_pair
#define INF (sizeof(int) == 4 ? 1e9:1e18)
#define EPS 0.0000000001
using namespace std;
template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; }
template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; }
template<typename Head, typename Value> auto vectors(const Head &head, const Value &v) { return vector<Value>(head, v); }
template<typename Head, typename... Tail> auto vectors(Head x, Tail... tail) { auto inner = vectors(tail...); return vector<decltype(inner)>(x, inner); }
template<class T> void join(T a){int b=0;for(auto itr :a){if(b++!=0)cout << " "; cout << itr;} }
using ll  = long long;
using ld  = long double;
using pii = pair<int,int>;
using piii = pair<int,pii>;
int W,H;
int dx[]={0,0,1,-1}, dy[]={1,-1,0,0};
bool valid(int x,int y){return (0<=x&&x<W)&&(0<=y&&y<H);}
struct Edge{int to,cap,rev;};
class Dinic{//max flow
public:
    int n;
    vector<vector<Edge> >G;
    vector<int> level,iter;
    Dinic(int size): n(size),G(vector<vector<Edge>>(n)){};
    void add_Edge(int from, int to, int cap){
        //rev は逆辺にアクセスできる
        //e = G[from][index]
        //G[e.to][e.rev].to = from,.rev = index
        Edge q={to,cap,int(G[to].size())};
        G[from].emplace_back(q);
        q={from,0,int(G[from].size()-1)};
        G[to].emplace_back(q);
    }
    void bfs(int s){
        level=vector<int>(n,-1);
        queue<int>q;
        level[s]=0;
        q.push(s);
        while(!q.empty()){
            int v=q.front();q.pop();
            for(int i=0;i<G[v].size();i++){
                Edge &e=G[v][i];
                if(e.cap>0&&level[e.to]<0){
                    level[e.to]=level[v]+1;
                    q.push(e.to);
                }
            }
        }
    }
    int dfs(int v,int t, int f) {
        if(v==t)return f;
        for(int &i=iter[v];i<G[v].size();i++){
            Edge &e=G[v][i];
            if(level[v]>=level[e.to]||e.cap<=0) continue;
            int d =dfs(e.to,t,min(f,e.cap));
            if(d>0){
                e.cap-=d;
                G[e.to][e.rev].cap+=d;
                return d;
            }
        }
        return 0;
    }
    int max_flow(int s,int t) {//from s to t,ford_fulkerson
        int flow=0;
        while(1){
            bfs(s);
            if(level[t]<0)return flow;
            iter=vector<int>(n);
            int f;
            while((f=dfs(s,t,INF))>0)flow+=f;
        }
    }
};
signed main(){
    int v,e;
    cin>>v>>e;
    Dinic yebi(v+1);
    rep(i,e){
        int a,b,c;cin>>a>>b>>c;
        yebi.add_Edge(a,b,c);
    }
    cout<<yebi.max_flow(0, v-1)<<endl;
}



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

using namespace std;

using ull = unsigned long long;

int main() {
	ull n;
	string ret = "";
	cin >> n;
	while (n != 0) {
		n--;
		string s = string(1,'a'+(n%26));
		ret = s + ret;
		n = n/26;
	}
	cout << ret;
	return 0;
}


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

using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=0;i<n;i++)

typedef long long ll;
typedef vector<ll> vl;
typedef long double ld;
typedef vector<ld> vd;
typedef bool bl;
typedef vector<bl> vb;

const ll e5 = 1 << 20;
const ll mod = 998244353;
const ll e3 = 1 << 13;
const ll INF = 1ll << 60;

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

  ll max_cnt = ceil(log2(k));
  ll bunbo = n;
  rep(i, max_cnt) {
    bunbo *= 2;
  }

  ll bunshi = 0;
  for(int i = 1; i <= n; i++) {
    int val = 1;
    ll cnt = ceil(log2(k/(ld)i));
    ll diff_cnt;
    if (cnt <= 0) {
      diff_cnt = max_cnt;
    } else {
      diff_cnt = max_cnt - cnt;
    } 
    rep(j, diff_cnt) {
      val *= 2;
    }
    // cout << "val: " << val << endl;
    bunshi += val;
  }

  // cout << "bunshi: " << bunshi << endl;
  // cout << "bunbo: " << bunbo << endl;
  ld result = (ld)bunshi / (ld)bunbo;
  cout << std::setprecision(15) << result << endl;

  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<long long> vll;
typedef vector<pair<int, int>> vpi;
typedef vector<pair<long long, long long>> vpl;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
#define INF (int)(1e9)
#define MAXX 1.1529215e+18
#define inf 999999
#define EPS (1e-7)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, n) for (int i = 1; i <= (int)(n); i++)
#define FOR(i, k, n) for (int i = (k); i < (int)(n); i++)
#define ALL(a) a.begin(), a.end()
#define RALL(a) a.begin(), a.end(), greater<int>()
#define ROT(a) a.begin(), a.begin() + 1, a.end()
#define RROT(a) a.begin(), a.end() - 1, a.end()
#define PB push_back
#define MP make_pair
#define PI acos(-1.0)
#define sz(a) a.size()
const ll MOD = 1e9 + 7;
const int MAX = 10000000;
template <typename T1, typename T2>
inline bool chmin(T1& a, T2 b)
{
    if (a > b) {
        a = b;
        return 1;
    }
    return 0;
}
template <typename T1, typename T2>
inline bool chmax(T1& a, T2 b)
{
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <typename T>
T gcd(T a, T b)
{
    if (b == 0)
        return a;
    return gcd(b, a % b);
}
//cout << 'H' << endl;
/*--------------------------------------------*/

int N, M;
vector<vector<int>> G;
vector<int> seen;
void dfs(int v, int ct)
{
    if (ct == 1) {
        return;
    }

    seen[v]++;

    for (auto i : G[v]) {
        dfs(i, ct + 1);
    }
}

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

    cin >> N >> M;

    G.resize(N);
    seen.assign(N, 0);

    rep(i, M)
    {
        int a, b;
        cin >> a >> b;
        --a;
        --b;

        G[a].PB(b);
        G[b].PB(a);
    }


    dfs(0, -1);
    dfs(N - 1, -1);

    rep(i, N)
    {
        if (seen[i] == 2) {
            cout << "POSSIBLE" << endl;
            return 0;
        }
    }

    cout << "IMPOSSIBLE" << endl;
}


Measured memory_bytes: 12784
word_list = list("ABCDEFGHIJKLMNOPQRSTUVWXYZ")
word_list.extend(word_list)
N = int(input())
S = input()
ans = ""
for i in range(len(S)):
    for j in range(len(word_list)):
        if S[i] == word_list[j]:
            ans += word_list[j+N]
            break
print(ans)


Measured memory_bytes: 3060
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.List;
import java.util.Scanner;
import java.util.Collections;
import java.util.ArrayList;

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

    static class equeue {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int n = in.nextInt();
            int k = in.nextInt();
            int[] v = new int[n];

            for (int i = 0; i < n; i++) {
                v[i] = in.nextInt();
            }

            long result = 0;

            for (int r = 0; r <= Math.min(n, k); r++) {
                for (int l = 0; r + l <= Math.min(n, k); l++) {

                    long score = 0;
                    List<Integer> having = new ArrayList<>();
                    for (int i = 0; i < l; i++) {
                        having.add(v[i]);
                        score += v[i];
                    }
                    for (int i = 0; i < r; i++) {
                        having.add(v[n - 1 - i]);
                        score += v[n - 1 - i];
                    }
                    Collections.sort(having);

                    for (int i = 0; i < Math.min(k - (r + l), having.size()); i++) {
                        if (having.get(i) < 0) {
                            score -= having.get(i);
                        }
                    }

                    result = Math.max(result, score);
                }
            }
            out.print(result);
        }

    }
}



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

#define rep(X,N) for(ll X = 0; X < (N); X++)
#define PI (acos(-1.0))
#define pback push_back
#define mpair make_pair
#define MODN 1000000007
#define ALL(V) (V).begin(),(V).end()
#define INT_MAX_HALF (INT_MAX / 2)
#define EPS (1e-10)

using namespace std;
typedef long long ll;

int main(){

    int size;
    cin >> size;
    string s;
    cin >> s;
    
    vector<ll> count(3, 0);

    rep(i, size){
        if(s[i] == 'R'){
            count[0]++;
        }else if(s[i] == 'G'){
            count[1]++;
        }else{
            count[2]++;
        }
    }

    ll ans = count[0] * count[1] * count[2];

    for(int i = 0; i < size; i++){
        for(int j = 1; i + j + j < size; j++){
            if(s[i] != s[i + j] && s[i] != s[i + j + j] && s[i + j] != s[i + j + j]){
                ans--;
            }
        }
    }

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


Measured memory_bytes: 3632
/// kAAzuki Hoshino
/*
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
*/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define int long long
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int,int> pi;
typedef vector<pi> vpi;
#define inf 1000000000
#define mod 1000000007
#define rep(i,a,b) for (int i = a; i <= b; i++)
#define rep1(i, a, b) for(int i =a; i >=b; i--)
#define dmp(x) cerr<<"line "<<__LINE__<<" "<<#x<<":"<<x<<endl
#define fs first
#define sc second
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define mt make_tuple

int a,b;

int f(int x){
 if(x<0)return 0;
 if(x%4==0)return x;
 if(x%4==1)return 1;
 if(x%4==2)return x+1;
 return 0;
}

signed main(){
ios::sync_with_stdio(0);
cin.tie(0);
//freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdout);

cin >> a >> b;
cout << (f(a-1)^f(b)) << endl;

return 0;
}
///....


Measured memory_bytes: 256
N = int(input())
h = list(map(int, input().split()))
dp = [float('inf') for _ in range(N)]
dp[0] = 0
dp[1] = dp[0]+abs(h[0]-h[1])
for i in range(2, N):
    dp[i] = min(dp[i-1]+abs(h[i]-h[i-1]), dp[i-2]+abs(h[i]-h[i-2]))
print(dp[-1])

Measured memory_bytes: 13928
import sys

def gcd(x, y):
	if y == 0:
		return x
	else:
		return gcd(y, x % y) #再帰定義
	
input = sys.stdin.readline
'''
allinputs = iter(input().splitlines())
input = lambda : next(allinputs)
#'''

N = int(input())
A = list(map(int, input().split()))

L = [0] * N
R = [0] * N
ans = 0
L[0] = 0
R[0] = 0

for i in range(1, N):
	L[i] = gcd(L[i - 1], A[i - 1])
	R[i] = gcd(R[i - 1], A[N - i])

for i in range(N):
	tmp = gcd(L[i], R[N - 1 - i])
	if tmp > ans:
		ans = tmp
		
print(ans)


Measured memory_bytes: 60012
#[allow(unused_imports)]
use std::cmp::{max, min, Ordering};
#[allow(unused_imports)]
use std::collections::{HashMap, HashSet, BinaryHeap};

mod util {
    use std::io::stdin;
    use std::str::FromStr;
    use std::fmt::Debug;

    #[allow(dead_code)]
    pub fn line() -> String {
        let mut line: String = String::new();
        stdin().read_line(&mut line).unwrap();
        line.trim().to_string()
    }

    #[allow(dead_code)]
    pub fn get<T: FromStr>() -> T
    where
        <T as FromStr>::Err: Debug,
    {
        let mut line: String = String::new();
        stdin().read_line(&mut line).unwrap();
        line.trim().parse().unwrap()
    }

    #[allow(dead_code)]
    pub fn gets<T: FromStr>() -> Vec<T>
    where
        <T as FromStr>::Err: Debug,
    {
        let mut line: String = String::new();
        stdin().read_line(&mut line).unwrap();
        line.split_whitespace()
            .map(|t| t.parse().unwrap())
            .collect()
    }

    #[allow(dead_code)]
    pub fn get2<T: FromStr, U: FromStr>() -> (T, U)
    where
        <T as FromStr>::Err: Debug,
        <U as FromStr>::Err: Debug,
    {
        let mut line: String = String::new();
        stdin().read_line(&mut line).unwrap();
        let mut iter = line.split_whitespace();
        (
            iter.next().unwrap().parse().unwrap(),
            iter.next().unwrap().parse().unwrap(),
        )
    }

    #[allow(dead_code)]
    pub fn get3<S: FromStr, T: FromStr, U: FromStr>() -> (S, T, U)
    where
        <S as FromStr>::Err: Debug,
        <T as FromStr>::Err: Debug,
        <U as FromStr>::Err: Debug,
    {
        let mut line: String = String::new();
        stdin().read_line(&mut line).unwrap();
        let mut iter = line.split_whitespace();
        (
            iter.next().unwrap().parse().unwrap(),
            iter.next().unwrap().parse().unwrap(),
            iter.next().unwrap().parse().unwrap(),
        )
    }
}

#[allow(unused_macros)]
macro_rules! debug {
    ($x: expr) => {
        println!("{}: {:?}", stringify!($x), $x)
    }
}

#[derive(Eq, PartialEq, Clone, Debug)]
struct Rev<T>(pub T);

impl<T: PartialOrd> PartialOrd for Rev<T> {
    fn partial_cmp(&self, other: &Rev<T>) -> Option<Ordering> {
        other.0.partial_cmp(&self.0)
    }
}

impl<T: Ord> Ord for Rev<T> {
    fn cmp(&self, other: &Rev<T>) -> Ordering {
        other.0.cmp(&self.0)
    }
}

fn main() {
    let (n, m): (usize, usize) = util::get2();
    let ab: Vec<(usize, usize)> = (0..m)
        .map(|_| {
            let (a, b): (usize, usize) = util::get2();
            (a - 1, b - 1)
        })
        .collect();

    let mut rank = vec![0; n];

    for &(a, b) in &ab {
        rank[a] += 1;
        rank[b] += 1;
    }

    if rank.iter().all(|&r| r % 2 == 0) {
        println!("YES");
    } else {
        println!("NO");
    }
}


Measured memory_bytes: 6396
#include<iostream>
    #include<algorithm>
    #include<cstdio>
    #include<cstring>
    #include<cmath>
     
    using namespace std;
    const int N = 2e5 + 5;
     
    int n , q[N] , hd , tl;
     
    int main(){
    	long long ans = 0;
    	int temp , last , sum = 0;
    	hd = tl = 1;
    	q[hd] = 0;
    	scanf("%d",&n);
    	for(int i = 1 ; i <= n ; i++){
    		scanf("%d",&temp);
    		last = 0;
    		while(hd < tl && temp & sum){
    			ans += tl - hd;
    			sum ^= q[hd++];
			}
    		q[tl++] = temp;
    		sum ^= temp;
    	}
    	while(hd < tl){
    		ans += tl - hd;
    		hd++;
    	}
    	printf("%lld\n",ans);
    }

Measured memory_bytes: 1024
#include <iostream>
#include <utility>
#include <queue>
#include <vector>
#include <stack>
#include <list>
#include <map>
#include <set>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cstdint>
#include <cstring>
#include <cmath>

using namespace std;

typedef long long ll;

int main() {
	int X, Y, E;
	cin >> X >> Y >> E;
	int c[202][202] = { {0} };
	for (int i = 0; i < E; i++) {
		int x, y;
		cin >> x >> y;
		c[x + 1][y + 101] = 1;
	}
	for (int i = 0; i < X; i++) c[0][i + 1] = 1;
	for (int i = 0; i < Y; i++) c[i + 101][201] = 1;
	int frm[202];
	queue<int> q;
	int r = 0;
	while (true) {
		for (auto& e : frm)e = -1;
		frm[0] = 0;
		q.push(0);
		while (!q.empty()) {
			int f = q.front();
			q.pop();
			for (int i = 0; i < 202; i++) {
				if (c[f][i] > 0 && frm[i] == -1){
					frm[i] = f;
					q.push(i);
				}
			}
		}
		if (frm[201] == -1)break;
		int z = INT32_MAX / 2,s = 201,t;
		while (s != 0) {
			t = frm[s];
			z = min(z, c[t][s]);
			s = t;
		}
		r += z;
		s = 201;
		while (s != 0) {
			t = frm[s];
			c[t][s] -= z;
			c[s][t] += z;
			s = t;
		}
	}
	cout << r << endl;
}



Measured memory_bytes: 3312
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<map>
#include<set>
#include<vector>
#include<queue>
#include<list>
#include<stack>
//#include<unordered_map>
using namespace std;
#define ll long long
#define dd cout<<endl
const long long int inf = 1e18+7;
const int mod = 998244353;

using namespace std;

inline ll int max(ll int a,ll int b) { return a>b?a:b; }
inline ll int min(ll int a,ll int b) { return a<b?a:b; }

//const int maxn=

int main()
{
	ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
	
	char ch;
	
	while(cin>>ch)
	{
		if( ch >= 'a' && ch <= 'z')
			cout<<'a'<<endl;
		else
			cout<<'A'<<endl;
	}
	
	return 0;
}

Measured memory_bytes: 3576
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<queue>
#include<functional>
#define LL long long
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPA(i,n) for(int i=1;i<(n);++i)
#define PII pair<int,int>
#define PLI pair<long long, int>
#define MOD ((int)1e9 + 7)
#define INF ((int)1e9)
#define INFLL ((LL)1e18)
#define ALL(x) (x).begin(),(x).end()
#define ctoi(x) (x - 'a') 
#define CTOI(x) (x - 'A')
using namespace std;

int main(){
    LL A,B,N;
    cin >> A >> B >> N;
    LL ans = INFLL;
    REPA(i,N+1){
        if(B%i)continue;
        LL d = B / i;
        REPA(j,N+1){
            ans = min(ans,abs(A - d*j));
        }
    }
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 3108
#include <iostream>
#include <vector>
#include <bits/stdc++.h>
#include <algorithm>
#include <iomanip>
#include <cstring>

using namespace std;
#define pb push_back
#define mp make_pair
#define rep(i, n) for (int i = 0; i < n; i++)
int v[26];
int main()
{   int n;
    cin >> n;
    vector<int> v;
    int x;
    rep(i, n)
    {
        cin >> x;
        v.pb(x);
    }
    sort(v.begin(), v.end());
    cout << v[n / 2] - v[n / 2 - 1];
    return 0;
}


Measured memory_bytes: 892
N,M = map(int,input().split())

List = []
ans = [0  for i in range(N+1)]
WA = [0  for i in range(N+1)]

for i in range(M):
  p,S = input().split()
  p = int(p)
  
  if ans[p] == 0:
    if S == "AC":
      ans[p] = 1
    else:
      WA[p] += 1
      
A = sum(ans)

W= 0

for i in range(N+1):
  W += ans[i] * WA[i]

print(A,W)


Measured memory_bytes: 4760
#include<stdio.h>
int main()
{
	int n,m,k;
	while(~scanf("%d%d%d",&n,&m,&k))
	{
		if((n==m&&m!=k)||(n==k&&n!=m)||(m==k&&k!=n))
			printf("Yes\n");
		else
			printf("No\n");
	}
}

Measured memory_bytes: 128
package main
 
import (
  "fmt"
  "strconv"
  "unicode/utf8"
)
 
func main() {
 
  var n int
  fmt.Scan(&n)
  
  c := 0
  var s string
  
  for i := 1; i <= n; i++ {
    s = strconv.Itoa(i)
    if utf8.RuneCountInString(s) % 2 == 1 {
      c++
    }
  }
  
  fmt.Println(c)
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i, n) for(int i=0; i < n; i++)
#define reps(i, n) for(int i=1; i <= n; i++)
#define INF 1e9
#define ALL(v) v.begin(), v.end()

using namespace std;
using ll=long long;

int N;
int h[101010];

int dp[101010];

int main(){
  cin >> N;
  rep(i,N) {cin >> h[i];}

  dp[0]=0;
  dp[1]=abs(h[0]-h[1]);

  for(int i=2;i<N;i++)
    {dp[i]=min((dp[i-2]+abs(h[i-2]-h[i])),(dp[i-1]+abs(h[i-1]-h[i])));}
  cout << dp[N-1] << endl;
}

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

using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
#define a first
#define b second
#define sz(x) (ll)((x).size())
#define pb push_back 
#define bg begin()
#define ed end()
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep1(i,n) for(ll i=1;i<=n;i++)
#define mp(x,y) make_pair(x,y)

int main(){
	ll N,K; cin>>N>>K;
	vector<P> sushi(N);//おいしさ、種類
	rep(i,N){
		ll A,B; cin>>A>>B;
		sushi[i]=mp(B,A);
	}
	sort(sushi.bg,sushi.ed,greater<P>());

	set<ll> se;//種類
	priority_queue<ll,vector<ll>,greater<ll>> que;
	ll point=0;

	rep(i,K){
		point+=sushi[i].a;
		ll S=sz(se);
		se.insert(sushi[i].b);
		if(sz(se)==S) que.push(sushi[i].a);
	}
	ll ans=point+sz(se)*sz(se);
	ll i=K;
	while(i<N){
		while(i<N && se.find(sushi[i].b)!=se.ed){
			i++;
		}
		if(que.empty() || i==N) break;
		point-=que.top(); que.pop();
		point+=sushi[i].a;
		se.insert(sushi[i].b);
		ans=max(ans,point+sz(se)*sz(se));
	}
	cout<<ans;
}


Measured memory_bytes: 5116
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);

        String line = sc.nextLine();
        String answer = "";

        for (int i = 0; i < line.length(); i++) {
            char c = line.charAt(i);
            if (Character.isLowerCase(c) == true) {
                c = Character.toUpperCase(c);
                answer += c;
            } else {
                c = Character.toLowerCase(c);
                answer += c;
            }
        }

        System.out.println(answer);

        sc.close();
    }
}



Measured memory_bytes: 31520
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int sx,sy,tx,ty,i,j,k,n,m;
    cin>>sx>>sy>>tx>>ty;
    for(i=0;i<(tx-sx);i++)
    {
        cout<<"R";
    }
    for(i=0;i<(ty-sy);i++)
    {
        cout<<"U";
    }
    for(i=0;i<(tx-sx);i++)
    {
        cout<<"L";
    }
    for(i=0;i<(ty-sy);i++)
    {
        cout<<"D";
    }
    cout<<"D";
    for(i=0;i<(tx-sx+1);i++)
    {
        cout<<"R";
    }
    for(i=0;i<(ty-sy+1);i++)
    cout<<"U";
    cout<<"L";
    cout<<"U";
    for(i=0;i<(tx-sx+1);i++)
    {
        cout<<"L";
    }
    for(i=0;i<(ty-sy+1);i++)
    cout<<"D";
    cout<<"R";
    
    
    
}

Measured memory_bytes: 256