akhauriyash/Code-Regression huggingface dataset:
// G++ MACRO.CPP -STD=C++17
#include <bits/stdc++.h>
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;
using namespace std;

#define dump(x)  cout << #x << " = " << (x) << endl;
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define POSSIBLE(n) cout << ((n) ? "POSSIBLE" : "IMPOSSIBLE"  ) << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible"  ) << endl
#define possible(n) cout << ((n) ? "possible" : "impossible"  ) << endl

#define SANKOU(n,a,b) cout << ((n) ? (#a) : (#b) ) << endl

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)

#define FOREACH(x,a) for(auto& (x) : (a) )

#define WFA(d,v) REP(k,v)REP(i,v)REP(j,v)d[i][j]=min(d[i][j],d[i][k]+d[k][j])

#define SCOUT(x) cout<<(x)<<" "
#define ENDL cout<<endl

#define VECCIN(x) for(auto&youso_: (x) )cin>>youso_
#define VECIN2(x,y) REP(i,x.size())cin>>x[i]>>y[i]
#define VECCOUT(x) if(1){for(auto tt=x.begin();tt!=x.end();tt++){if(tt!=x.begin())cout<<" ";cout<<(*tt);}cout<<endl;}

#define ALL(obj) (obj).begin(),(obj).end()

#define EXIST(n,x) (find(ALL(n),x)!=n.end())
#define UNIQUE(obj) sort(ALL( obj )); obj.erase(unique(ALL(obj)),obj.end())
#define EN(x) if(1){cout<<#x<<endl;return 0;}
#define COUT(x) cout<<(x)<<endl
void CINT(){}
template <class Head,class... Tail>
void CINT(Head&& head,Tail&&... tail){
    cin>>head;
    CINT(move(tail)...);
}
#define CIN(...) int __VA_ARGS__;CINT(__VA_ARGS__)
#define LCIN(...) ll __VA_ARGS__;CINT(__VA_ARGS__)
#define SCIN(...) string __VA_ARGS__;CINT(__VA_ARGS__)

template <class T = ll>
T IN(){T x;cin>>x;return (x);}

template <class Head>
void VT(Head head){}
template <class Head,class Seco,class... Tail>
void VT(Head&& head,Seco&& seco,Tail&&... tail){
    seco.resize(head);
    VT(head,move(tail)...);
}
void VT2(){}
template <class Head,class... Tail>
void VT2(Head&& head,Tail&&... tail){
  VECCIN(head);
  VT2(move(tail)...);
}

template <class Head>
void VT3(Head&& head){}
template <class Head,class Seco,class... Tail>
void VT3(Head&& head,Seco&& seco,Tail&&... tail){
  seco[head]=IN();
  VT3(head,move(tail)...);
}

#define VC1(n,...) V __VA_ARGS__;VT(n,__VA_ARGS__);VT2(__VA_ARGS__); //aaabbbccc
#define VC2(n,...) V __VA_ARGS__;VT(n,__VA_ARGS__);REP(i,n)VT3(i,__VA_ARGS__); //abcabcabc

// #include <boost/multiprecision/cpp_int.hpp>
// using namespace boost::multiprecision; // cpp_int

#define P pair<ll,ll>
#define V vector<ll>
#define M map<ll,ll>
#define S set<ll>

#define pb(a) push_back(a)
#define mp make_pair

int main(){
  CIN(h,w);
  vector<V> v(h,V(w,0));
  REP(i,h){
    SCIN(s);
    REP(j,w){
      if(s[j]=='#')v[i][j]=1;
    }
  }
  REP(i,h){
    REP(j,w){
      cout<<(i!=h-1 &&(!i || j%2==0 || v[i][j])?"#":".");
    }
    ENDL;
  }
  ENDL;
  REP(i,h){
    REP(j,w){
      cout<<(i&&(i==h-1 || j%2 || v[i][j])?"#":".");
    }
    ENDL;
  }

  
  return 0;
}


Measured memory_bytes: 2688
R,C,K = map(int,input().split())
board = [[0 for _ in range(C)] for __ in range(R)]
for _ in range(K):
  r,c,v = map(int,input().split())
  board[r-1][c-1] = v

dp0 = [[0]*C for _ in range(R)]
dp1 = [[0]*C for _ in range(R)]
dp2 = [[0]*C for _ in range(R)]
dp3 = [[0]*C for _ in range(R)]

ans = 0
for i in range(R):
  for j in range(C):
    if dp1[i][j] < dp0[i][j]+board[i][j]:
      dp1[i][j] = dp0[i][j]+board[i][j]
    if j>0:
      if dp0[i][j] < dp0[i][j-1]:
        dp0[i][j] = dp0[i][j-1]
      if dp1[i][j] < dp1[i][j-1]:
        dp1[i][j] = dp1[i][j-1]
      if dp2[i][j] < dp2[i][j-1]:
        dp2[i][j] = dp2[i][j-1]
      if dp3[i][j] < dp3[i][j-1]:
        dp3[i][j] = dp3[i][j-1]
      if dp1[i][j] < dp0[i][j-1]+board[i][j]:
        dp1[i][j] = dp0[i][j-1]+board[i][j]
      if dp2[i][j] < dp1[i][j-1]+board[i][j]:
        dp2[i][j] = dp1[i][j-1]+board[i][j]
      if dp3[i][j] < dp2[i][j-1]+board[i][j]:
        dp3[i][j] = dp2[i][j-1]+board[i][j]
    if i>0:
      if dp0[i][j] < dp0[i-1][j]:
        dp0[i][j] = dp0[i-1][j]
      if dp0[i][j] < dp1[i-1][j]:
        dp0[i][j] = dp1[i-1][j]
      if dp0[i][j] < dp2[i-1][j]:
        dp0[i][j] = dp2[i-1][j]
      if dp0[i][j] < dp3[i-1][j]:
        dp0[i][j] = dp3[i-1][j]
      if dp1[i][j] < dp0[i-1][j]+board[i][j]:
        dp1[i][j] = dp0[i-1][j]+board[i][j]
      if dp1[i][j] < dp1[i-1][j]+board[i][j]:
        dp1[i][j] = dp1[i-1][j]+board[i][j]
      if dp1[i][j] < dp2[i-1][j]+board[i][j]:
        dp1[i][j] = dp2[i-1][j]+board[i][j]
      if dp1[i][j] < dp3[i-1][j]+board[i][j]:
        dp1[i][j] = dp3[i-1][j]+board[i][j]
print(max(dp0[-1][-1],dp1[-1][-1],dp2[-1][-1],dp3[-1][-1]))

Measured memory_bytes: 444220
#include <bits/stdc++.h>
#define all(a) a.begin(), a.end()
#define db(a) cout << fixed << #a << " = " << a << endl;

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
ll S(ll k) {
	return  k*(k + 1) / 2;
}

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	ll N;
	cin >> N;
	ll s = 0;
	for (ll i = 1; i <= N; i++) {
		s += i * (S(N / i));
	}
	cout << s << endl;
}



Measured memory_bytes: 3668
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <math.h>
#include <complex>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <unordered_map>
#include <set>
#include <bitset>
#include <functional>
#include <assert.h>
using ll=long long;
#define int ll
#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,b) rng(i,0,b)
#define gnr(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define per(i,b) gnr(i,0,b)
#define eb emplace_back
#define all(x) x.begin(),x.end()
#define SZ(x) x.size()
#define fi first
#define se second
const int INF = 1e9;
using namespace std;

template<class T> using vc=vector<T>;
template<class T> using vvc=vc<vc<T>>;

using pi=pair<int,int>;
using vi=vc<int>;

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;}

signed main() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout<<fixed<<setprecision(20);

    int A[3][3];
    rep(i,3){
        rep(j,3){
            cin >> A[i][j];
        }
    }
    bool B[3][3];
    rep(i,3){
        rep(j,3){
            B[i][j]=false;
        }
    }
    int N; cin >> N;
    rep(i,N){
        int a; cin >> a;
        rep(j,3){
            rep(k,3){
                if(A[j][k]==a){
                    B[j][k]=true;
                }
            }
        }
    }
    bool can=false;
    rep(i,3){
        if(B[0][i] && B[1][i] && B[2][i]) can=true;
        if(B[i][0] && B[i][1] && B[i][2]) can=true;
    }
    if(B[0][0] && B[1][1] && B[2][2]) can=true;
    if(B[0][2] && B[1][1] && B[2][0]) can=true;
    if(can) cout << "Yes" << endl;
    else cout << "No" << endl;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
	int a,b,c;
	cin>>a>>b>>c;
	int k;
	cin>>k;
	int f;
	int d=max({a,b,c});
	if(d==a){
		f=c+b;
	}
	else if(d==b){
		f=a+c;
	}
	else{
		f=a+b;
	}
	for(int i=1;i<=k;i++){
		d=d*2;
	}
	cout<<d+f<<endl;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
int main() {
	int N, W;
	cin >> N >> W;
	vector<int>Value(110), Weight(110);
	for (int i = 0; i < N; i++) {
		cin >> Value.at(i) >> Weight.at(i);
	}
	vector<vector<long long> >DP(110, vector<long long>(11000));
	for (int i = 0; i < W; i++) {
		DP.at(0).at(i) = 0;
	}
	for (int i = 0; i < N; i++) {
		for (int j = 0; j <= W; j++) {
			if (j >= Weight.at(i)) DP.at(i + 1).at(j) = max(DP.at(i).at(j - Weight.at(i)) + Value.at(i), DP.at(i).at(j));
			else DP.at(i + 1).at(j) = DP.at(i).at(j);
		}
	}
	cout << DP.at(N).at(W) << endl;
}


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

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

    int k; cin >> k;

    string ans;
    queue<ll> q;
    for (int i = 1; i <= 9; ++i) q.push(i);

    for (int i = 0; i < k - 1; ++i) {
        ll x = q.front();
        q.pop();

        int d = x % 10;
        ll last_two_digits_same = 10*x + d;
        
        if (d > 0) q.push(last_two_digits_same - 1);
        q.push(last_two_digits_same);
        if (d < 9) q.push(last_two_digits_same + 1);
    }

    cout << q.front() << endl;

    return 0;
}

Measured memory_bytes: 1792
//#include <bits/stdc++.h>
//#include <stdio.h>
#include<iostream>
#include<cstdio>
#include<bitset>
#include<algorithm>
#include<vector>
#include<list>
#include<queue>
#include<stack>
#include<string>
#include<string.h>
#include<cmath>
#include<utility>
#include<functional>
#include<map>
#include<set>
#include<cctype>
#include<fstream>


#define FOR(i, a, b) for( int i=(a);i<=(b);i++)
#define RFOR(i, a, b) for( int i=(a);i>=(b);i--)
#define LFOR(i, a, b) for( long long int i=(a);i<=(b);i++)
#define LRFOR(i, a, b) for(long long int i=(a);i>=(b);i--)
#define MOD 1000000007
#define INF 1000000000 //2000000000
#define LINF 1000000000000000000 //9000000000000000000
#define PI 3.14159265358979
#define MAXI 7500000

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

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

long long int n, a, b;
long long int sa;

// index が条件を満たすかどうか
bool isOK(long long int index,vector<long long int> h) {
	long long int count = 0;
	FOR(i, 0, n - 1) {
		if (index*b < h[i]) {
			if ((h[i] - index * b) % sa == 0) {
				count += (h[i] - index * b) / sa;
			}
			else {
				count += (h[i] - index * b) / sa;
				count++;
			}
			
		}
	}

	//cout << count << " " << index << endl;

	if (count<=index) return true;
	else return false;
}

// 汎用的な二分探索のテンプレ
int binary_search(vector<long long int> h) {
	long long int left = -1; //「index = 0」が条件を満たすこともあるので、初期値は -1
	long long int right = 1000000000; // 「index = a.size()-1」が条件を満たさないこともあるので、初期値は a.size()

							   /* どんな二分探索でもここの書き方を変えずにできる！ */
	while (right - left > 1) {
		long long int mid = left + (right - left) / 2;

		if (isOK(mid,h)) right = mid;
		else left = mid;
	}

	/* left は条件を満たさない最大の値、right は条件を満たす最小の値になっている */
	return right;
}

int main(void) {
	
	


	cin >> n >> a >> b;
	sa = a - b;
	vector<long long int> h(n);
	FOR(i, 0, n - 1) {
		cin >> h[i];
	}
	sort(h.begin(), h.end());

	cout << binary_search(h) << endl;
	

	return 0;
}

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

using ll =  long long;
using pint =  pair<int,int>;

#define INF 99999999
#define rep(i,n) for(int (i)=0,temp=(int)(n);(i)<temp;++(i)) 
#define repi(i,start,end) for(int (i)=(start),temp=(int)(end);i<(end);++(i))
#define rfor(v,x) for(const auto& (x) : (v)) //xは値を表す
#define all(x) (x).begin(),(x).end()
#define SORT(v, n) sort((v), (v)+(n))
#define vsort(v) sort((v).begin(), (v).end())
#define vfsort(v,lambda) sort(all((v)),(lambda))
#define vint vector<int>
#define vvint vector<vector<int>> //vvint v(n,vint(n))のように宣言できる
#define vin(v) rep(i,(v).size()) {cin >> (v)[i];}
//最終奥義(使うときはINFも書き換えろ!!)
//#define int long long
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; }
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int ctoi(char c) {return c-'0';}
//lambda式 -> [&](int x, int y){return x<y;}
//vector内の重複を削除-> v.erase(unique(all(v)),v.end());

signed main(void){
  int n;cin>>n;
  vector<string> s(n);
  int max=0;
  rep(i,n){
    cin>>s[i];
  }
  vsort(s);
  int cnt=0;
  repi(i,1,n){
    if(s[i]==s[i-1])cnt++;
    else{
      chmax(max,cnt);
      cnt=0;
    }
  }chmax(max,cnt);

  cnt=0;
  repi(i,1,n){
    if(s[i]==s[i-1])cnt++;
    else{
      if(cnt==max)cout << s[i-1] << endl;
      cnt=0;
    }
  }
  if(cnt==max) cout << s[n-1] << endl;
  

}


Measured memory_bytes: 14208
#include <iostream>
#include <algorithm>
#include <map>
using namespace std;
#define ll long long
#define ld long double
int main()
{
	int n, k; cin >> n >> k;
	int a[100005];
	for (int i = 0; i < n; i++)
		cin >> a[i];
	cout << (n + k - 3) / (k - 1);
}

Measured memory_bytes: 640
#include <iostream>
#include <string>
#include <vector>
#include <array>
#include <queue>
#include <deque>
#include <algorithm>
#include <set>
#include <map>
#include <bitset>
#include <cmath>
#include <functional>
#include <cassert>
#include <iomanip>
#define vll vector<ll>
#define vvvl vector<vvl>
#define vvl vector<vector<ll>>
#define VV(a, b, c, d) vector<vector<d>>(a, vector<d>(b, c))
#define VVV(a, b, c, d) vector<vvl>(a, vvl(b, vll (c, d)));
#define re(c, b) for(ll c=0;c<b;c++)
#define all(obj) (obj).begin(), (obj).end()
typedef long long int ll;
typedef long double ld;
using namespace std;

int main(){
  ll n;std::cin >> n;
  vvl d = VV(n, 2, 0, ll);
  re(i, n) std::cin >> d[i][0] >> d[i][1];
  for(int i=0;i<n-2;i++){
    if(d[i][0]==d[i][1]&&d[i+1][0]==d[i+1][1]&&d[i+2][0]==d[i+2][1]){
      std::cout << "Yes" << '\n';
      return 0;
    }
  }
  std::cout << "No" << '\n';
}


Measured memory_bytes: 3632
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
int main(){
  string str;
  cin >> str;
  int q,i;
  cin >> q;
  string s1,s2;
  int a,b;
  for(i=0;i<q;i++){
    //cout << str << endl;
    cin >> s1 >> a >> b;
    if(s1=="print"){
      cout << str.substr(a,b-a+1) << endl;
    }else if(s1=="reverse"){
      string s3=str.substr(a,b-a+1);
      reverse(s3.begin(),s3.end());
      str=str.substr(0,a)+s3+str.substr(b+1,str.size()-a-1);
    }else{
      cin >> s2;
      str=str.substr(0,a)+s2+str.substr(b+1,str.size()-a-1);
    }
  }
}


Measured memory_bytes: 3216
#include <bits/stdc++.h>
#define rep(i, n) for (int i=0; i<(int)(n); i++)
#define all(v) v.begin(), v.end()
#define allR(v) v.rbegin(), v.rend()
#define PRINT(v) for (auto x : (v)) cout <<x <<" " ; cout <<endl;
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
typedef pair<int,int> Pi;
const ll MOD = 1000000007;
const ll INF = 10000000000000000;
const int inf = 1001001001;
vector<int> x4 = {0, 1, 0, -1}, x8 = {0, 1, 1, 1, 0, -1, -1, -1};
vector<int> y4 = {1, 0, -1, 0}, y8 = {1, 1, 0, -1, -1, -1, 0, 1};
template<class T> inline bool chmin(T& a, T b){if (a>b){a = b; return true;}return false;}
template<class T> inline bool chmax(T& a, T b){if (a<b){a = b; return true;}return false;}
template<class T> inline T powerM(T a,T b){if (b==0) return 1;
T tmp = powerM(a,b/2); if (b%2==0) return tmp*tmp%MOD; else return tmp*tmp%MOD*a%MOD; }
template<class T> inline T power(T a,T b,T m){ if (b==0) return 1;
  T tmp = power(a,b/2,m); if (b%2==0) return tmp*tmp%m; else return tmp*tmp%m*a%m; }
template<class T> inline T gcd(T a, T b){if (b==0) return a; return gcd(b, a%b);}
template<class T> inline T lcm(T a, T b){return a / gcd(a,b) * b;}
// ax+by=gcd(a,b)を解く
template<class T> inline T extgcd(T a,T b,T &x,T &y){if (b==0){x=1; y=0; return a;} T d=extgcd(b,a%b,y,x); y -= a/b*x; return d;}
void hey(){ cout <<"hey" <<endl; }

template<class T> struct edge { int to; T cost;};


int main() {
  int n; cin >>n;
  string s; cin >>s;
  if (s.size() <= n){
    cout <<s;
  }else{
    for (int i=0; i<n; i++) cout <<s[i];
    cout <<"...";
  }
  cout <<endl;
}


Measured memory_bytes: 3628
import math

a, b, x = list(map(int, input().split()))

x /= a  # focus on the rectangle a * b

if a * b / 2 > x:
    c = 2 * x / b
    answer = math.degrees(math.atan(b / c))
    print(answer)
else:
    rest = a * b - x
    c = 2 * rest / a
    answer = math.degrees(math.atan(c / a))
    print(answer)


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

using namespace std;

#define DUMP(x) std::cerr << (#x) << " = " << (x) << "\n"
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define REP(i, k, n) for (int i = (k); i < (int)(n); ++i)
#define ALL(r) r.begin(), r.end()
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl
#define IMP cout << "IMPOSSIBLE" << endl
#define Imp cout << "Impossible" << endl
#define imp cout << "impossible" << endl
#define M1 cout << "-1" << endl
#define pb push_back
#define eb emplace_back
#define fi first
#define se second

template <typename T>
ostream &operator<<(ostream &os, vector<T> &v)
{
    os << "{";
    rep(i, v.size()) os << v[i] << (i == (int)v.size() - 1 ? "" : ", ");
    os << "}";
    return os;
}
template <typename T, typename U>
ostream &operator<<(ostream &os, pair<T, U> &p)
{
    os << "(" << p.first << ", " << p.second << ")";
    return os;
}
template <typename T>
T dup(T x, T y)
{
    return (x + y - 1) / y;
};
template <typename A, size_t N, typename T>
inline void arrayFill(A (&array)[N], const T &val) { std::fill((T *)array, (T *)(array + N), val); }
struct in
{
    const size_t n = 0;
    in() = default;
    in(size_t n) : n(n){};
    template <typename T>
    operator T()
    {
        T ret;
        cin >> ret;
        return ret;
    }
    template <typename T>
    operator vector<T>()
    {
        assert(n != 0);
        vector<T> ret(n);
        for (auto &x : ret)
            cin >> x;
        return ret;
    }
};

using ll = int64_t;
using vint = vector<int32_t>;
using vvint = vector<vint>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vstr = vector<string>;
using pint = pair<int32_t, int32_t>;
using vpint = vector<pint>;
using pll = pair<ll, ll>;
using vpll = vector<pll>;
using setint = set<int32_t>;
using setstr = set<string>;
using qint = queue<int32_t>;
using qpint = queue<pint>;

constexpr std::int32_t INF = 1001001001;
constexpr std::int64_t LINF = 1001001001001001001;

void Main()
{
    int n;
    cin >> n;

    cout << dup(n, 2) << endl;
}

signed main()
{
    std::cin.tie(nullptr);
    std::ios_base::sync_with_stdio(false);
    std::cout << std::fixed << std::setprecision(15);
    Main();
    return 0;
}


Measured memory_bytes: 256
n = int(input())
ls = [list(map(int, input().split())) for i in range(n)]
ls1=list()
ls2=list()
for i in range(n):
    ls1.append(ls[i][0])
    ls2.append(ls[i][1])
ls1.sort()
ls2.sort()

if n%2:
    print(ls2[n//2]-ls1[n//2]+1)
else:
    a=ls2[n//2-1]+ls2[n//2]
    b=ls1[n//2-1]+ls1[n//2]
    print(a-b+1)




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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll, ll> P;

#define EACH(i,a) for (auto& i : a)
#define FOR(i,a,b) for (ll i=(a);i<(b);i++)
#define RFOR(i,a,b) for (ll i=(b)-1;i>=(a);i--)
#define REP(i,n) for (ll i=0;i<(n);i++)
#define RREP(i,n) for (ll i=(n)-1;i>=0;i--)
#define debug(x) cout<<#x<<": "<<x<<endl
#define pb push_back
#define ALL(a) (a).begin(),(a).end()

const ll linf = 1e18;
const int inf = 1e9;
const double eps = 1e-12;
const double pi = acos(-1);

template<typename T>
istream& operator>>(istream& is, vector<T>& vec) {
	EACH(x,vec) is >> x;
	return is;
}
template<typename T>
ostream& operator<<(ostream& os, vector<T>& vec) {
	REP(i,vec.size()) {
		if (i) os << " ";
		os << vec[i];
	}
	return os;
}
template<typename T>
ostream& operator<<(ostream& os, vector< vector<T> >& vec) {
	REP(i,vec.size()) {
		if (i) os << endl;
		os << vec[i];
	}
	return os;
}

ll L(string s) {
	int N = s.size();
	ll res = s[0]-'0';
	for (int i = 2; i < N; i += 2) {
		int v = s[i]-'0';
		if (s[i-1] == '+') {
			res += v;
		}
		else {
			res *= v;
		}
		res = min(res, (ll)inf);
	}
	return res;
}
ll M(string s) {
	int N = s.size();
	ll res = 0, p = s[0]-'0';
	for (int i = 2; i < N; i += 2) {
		int v = s[i]-'0';
		if (s[i-1] == '+') {
			res += p;
			p = v;
		}
		else {
			p *= v;
		}
		p = min(p, (ll)p);
		res = min(res, (ll)inf);
	}
	res += p;
	res = min(res, (ll)inf);
	return res;
}

int main() {
	std::ios::sync_with_stdio(false);
	std::cin.tie(0);
	string s; cin >> s;
	ll a; cin >> a;
//	cout << M(s) << " " << L(s) << endl;
	if ( M(s) == a && L(s) == a ) {
		cout << "U" << endl;
	}
	else if ( M(s) == a ) {
		cout << "M" << endl;
	}
	else if ( L(s) == a ) {
		cout << "L" << endl;
	}
	else {
		cout << "I" << endl;
	}
}

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

#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 main() {
  int a,b;
  cin >> a >> b;
  int x1= (a*100)/8;
  if((a*100)%8)x1++;
  int x2=((a+1)*100)/8;
    if(((a+1)*100)%8==0)x2--;
  int y1=b*10;
  int y2=(b+1)*10-1;

  if(x1>y2 || y1>x2){cout << -1;return 0;}
  else cout << max(x1,y1);
}

Measured memory_bytes: 764
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cstdio>
#include <cstdlib>
#include <cstring>

using namespace std;

int main() {
	ios::sync_with_stdio(0);
	int a, b;
	cin >> a >> b;
	if (a > b)
		swap(a, b);
	if (a == 1) {
		if (b == 2)
			cout << "3\n";
		else
			cout << "2\n";
	}
	else
		cout << "1\n";
	//system("pause");
	return 0;
}

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

using namespace std;
typedef long long LL;
typedef pair<int,int> pii;

const int MAXN = 1e5 + 5;
const int MOD = 1e9+7;
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second 
#define FAIL0 {cout << "0\n"; return 0;}
#define FAIL1 {cout << "-1\n"; return 0;}
#define FAILNO {cout << "No\n"; return 0;}

int N,K;
vector<int> edges[MAXN];

int add(int a, int b) {
    int r = a+b;
    if (r >= MOD) r -= MOD;
    return r;
}

int mul(int a, int b) {
    return 1LL*a*b%MOD;
}

int fact[MAXN], inv[MAXN], ifact[MAXN];

template<typename T, typename T1>
T mod(T x, T1 p) {
	x %= p;
	if (x < 0)
		x += p;
	return x;
}

template<typename T>
T inverse(T x, T p) {
	x = mod(x, p);
	if (x == 1)
		return x;
	return mod((1LL * (-p / x) * (inv[p % x] % p)) , p); 
	// Since inverse of p % x is already calculated.
}

int NcR(int n, int r) {
	int ret = (1LL * ifact[n - r] * ifact[r]) % MOD ;
	ret = (1LL * ret * fact[n]) % MOD;
	return ret;
}

int P(int n, int r) {
    return (1LL * fact[n] * ifact[n-r]) % MOD;
}

vector<int> child[MAXN];
int dp[MAXN];

void dfs(int u, int p) {
    for (int v: edges[u]) {
        if (v != p) {
            child[u].pb(v);
            dfs(v,u);
        }
    }
}

int ans = 1;
void f(int u) {
    if (u == 1) ans = mul(K,P(K-1,child[1].size()));
    else ans = mul(ans,P(K-2,child[u].size()));

    for (auto ch: child[u]) 
        f(ch);
}

int main() {
#ifdef OJ
    freopen("input.txt", "rt", stdin);
    //freopen("output.txt", "wt", stdout);
#endif
    ios::sync_with_stdio(false);
    cin.tie(0);

	fact[0] = 1;
	for(int i = 1; i < MAXN; i++) {
		fact[i] = 1LL * fact[i - 1] * i % MOD;
	}

	ifact[0] = 1;
	for(int i = 1; i < MAXN; i++) {
		inv[i] = inverse(i, MOD);
		ifact[i] = 1LL * ifact[i - 1] * inv[i] % MOD;
	}

    cin >> N >> K;
    for (int i = 0; i < N-1; i++) {
        int a,b;
        cin >> a >> b;
        edges[a].pb(b);
        edges[b].pb(a);
    }

    int ok = 1;
    for (int v = 1; v <= N && ok; v++)
        ok = edges[v].size() < N;

    if (!ok) FAIL0;
    dfs(1,0);
    f(1);

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


Measured memory_bytes: 17024
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define IOS ios_base::sync_with_stdio(0);cin.tie(0)
/* start */

const int N = 200010;

int p1[N], p2[N];

signed main(){
   IOS;
   int n, m, k;
   cin >> n >> m >> k;
   vector<int> a(n),b(m);
   for(auto &it : a) cin >> it;
   for(auto &it : b) cin >> it;
   for(int i = 1; i <= n; i++) p1[i] = p1[i-1] + a[i - 1];
   for(int i = 1; i <= m; i++) p2[i] = p2[i-1] + b[i - 1];
   int ans = -1;
   for(int i = 0; i <= n; i++) {
      int x = k - p1[i];
      int l = 0, r = m + 1;
      while(r - l > 1) {
         int mid = (l + r) / 2;
         if(p2[mid] > x) r = mid;
         else l = mid;
      }
      // cout << l << "\n";
      // cout << p2[l] + p1[i] << "\n";
      if(p1[i] + p2[l] <= k) ans = max(ans, i + l);
   }
   cout << ans << '\n';
}

Measured memory_bytes: 9528
#define _USE_MATH_DEFINES	//M_PI
#include <iostream>			//std::cout, std::cin
#include <string>			//std::string
#include <vector>			//std::vector
#include <valarray>			//std::valarray	??°????????????????¬???????
#include <algorithm>		//std::sort
#include <time.h>			//localtime_s
#include <cstdlib>			//abs
#include <cmath>			//abs, pow, sqrt, sin, cos,
#include <fstream>			//std::ifstream
#include <iomanip>			//std::setprecision
#include <random>			//std::random(C++11)

int main(void) {

	//test??¨
	//std::ifstream in("test.txt");
	//std::cin.rdbuf(in.rdbuf());

	std::vector<int> dice1(6), dice2(6);
	for (int i = 0; i < 6; i++) {
		std::cin >> dice1[i];
	}
	for (int i = 0; i < 6; i++) {
		std::cin >> dice2[i];
	}

	bool flg = true;
	std::vector<int> temp1(6), temp2(6);
	temp1 = dice1;
	temp2 = dice2;
	std::sort(temp1.begin(), temp1.end());
	std::sort(temp2.begin(), temp2.end());
	if (!std::equal(temp1.begin(), temp1.end(), temp2.begin())) {
		flg = false;
	}

	if (flg) {

		flg = 0;
		for (int k = 0; k < 4; k++) {
			for (int j = 0; j < 4; j++) {
				for (int i = 0; i < 4; i++) {

					if (std::equal(dice1.begin(), dice1.end(), dice2.begin())) {
						flg = 1;
						k = j = i = 4;
					}

					temp1[0] = dice1[3];
					temp1[1] = dice1[1];
					temp1[2] = dice1[0];
					temp1[3] = dice1[5];
					temp1[4] = dice1[4];
					temp1[5] = dice1[2];
					dice1 = temp1;
				}
				temp1[0] = dice1[1];
				temp1[1] = dice1[5];
				temp1[2] = dice1[2];
				temp1[3] = dice1[3];
				temp1[4] = dice1[0];
				temp1[5] = dice1[4];
				dice1 = temp1;
			}
			temp1[0] = dice1[0];
			temp1[1] = dice1[3];
			temp1[2] = dice1[1];
			temp1[3] = dice1[4];
			temp1[4] = dice1[2];
			temp1[5] = dice1[5];
			dice1 = temp1;
		}
	}

	if (flg) {
		std::cout << "Yes" << std::endl;	
	}
	else {
		std::cout << "No" << std::endl;
	}

}

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

#define rep(i,n) for(int i = 0; i < n; i++)
#define REP(i,n) for(int i = 1; i < n; i++)
#define repll(i,n) for(ll i = 0; i < n; i++)
#define REPll(i,n) for(ll i = 1; i < n; i++)
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define yesorno(a) printf(a ? "yes\n" : "no\n")
#define YesorNo(a) printf(a ? "Yes\n" : "No\n")
#define YESorNO(a) printf(a ? "YES\n" : "NO\n") 
#define endl "\n"
using ll = long long;
using P = pair<int,int>;
using Pl = pair<ll,ll>;
using vi = vector<int>;
using vii = vector<vi>;
using vl = vector<ll>;
using vll = vector<vl>;
const int dx[] = {0,1,0,-1,1,1,-1,-1};
const int dy[] = {1,0,-1,0,1,-1,-1,1};
const int inf = (1<<30)-1;
const ll infll = (1LL<<62)-1;
ll ceil(const ll a, const ll b){return ((a)+(b)-1)/b;}


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

  int n;
  cin >> n;
  vi a(n+1);
  rep(i,n){
    cin >> a[i];
  }
  a[n] = inf;
  sort(all(a));
  int ans = 0;
  int cnt = 1;
  REP(i,n+1){
    //cout << cnt << endl;
    if(a[i] != a[i-1]){
      if(cnt >= a[i-1]) ans += cnt - a[i-1];
      else ans += cnt;
      cnt = 0;
    }
    cnt++;
  }
  cout << ans << endl;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
constexpr long long MOD = 1000000007;
constexpr long long INF = 1LL << 60;
const long double PI = acosl(-1.0);
constexpr long double EPS = 1e-11;
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
int main(){
    ll n, k;
    cin >> n >> k;
    vector<ll> a(n);
    for (ll i = 0; i < n; i++) cin >> a[i];
    for (ll i = k; i < n;i++){
        if (a[i - k] < a[i]) cout << "Yes" << endl;
        else
            cout << "No" << endl;
    }
}

Measured memory_bytes: 4840
package main

import (
	"bufio"
	"fmt"
	"io"
	"math"
	"os"
	"strconv"
)

var (
	readString func() string
	readBytes  func() []byte
	stdout     *bufio.Writer
)

func init() {
	readString, readBytes = newReadString(os.Stdin)
	stdout = bufio.NewWriter(os.Stdout)
}

func newReadString(ior io.Reader) (func() string, func() []byte) {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), math.MaxInt32)
	r.Split(bufio.ScanWords)

	f1 := func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
	f2 := func() []byte {
		return []byte(f1())
	}
	return f1, f2
}

func readInt() int {
	return int(readInt64())
}

func readInt64() int64 {
	i, err := strconv.ParseInt(readString(), 10, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

func readFloat64() float64 {
	f, err := strconv.ParseFloat(readString(), 64)
	if err != nil {
		panic(err.Error())
	}
	return f
}

func printf(f string, args ...interface{}) (int, error) {
	return fmt.Fprintf(stdout, f, args...)
}

func println(args ...interface{}) (int, error) {
	return fmt.Fprintln(stdout, args...)
}

func eprintln(args ...interface{}) (int, error) {
	return fmt.Fprintln(os.Stderr, args...)
}

func eprintf(f string, args ...interface{}) (int, error) {
	return fmt.Fprintf(os.Stderr, f, args...)
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func min64(a, b int64) int64 {
	if a < b {
		return a
	}
	return b
}

func max(a, b int) int {
	if a < b {
		return b
	}
	return a
}

func max64(a, b int64) int64 {
	if a < b {
		return b
	}
	return a
}

func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

func abs64(a int64) int64 {
	if a < 0 {
		return -a
	}
	return a
}

func gcd(a, b int) int {
	if b == 0 {
		return a
	}
	return gcd(b, a%b)
}

func gcd64(a, b int64) int64 {
	if b == 0 {
		return a
	}
	return gcd64(b, a%b)
}

// readString() string
// readInt() int
// readInt64() int64
// readFloat64() float64

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

func main() {
	defer stdout.Flush()
	N := readInt()
	K := readInt()
	var ans int
	for i := 0; i < N; i++ {
		h := readInt()
		if K <= h {
			ans++
		}
	}
	println(ans)
}

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


Measured memory_bytes: 896
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;

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

  int h, a;
  cin >> h >> a;

  int cnt = 0;
  while (h > 0) {
    h -= a;
    cnt++;
  }

  cout << cnt << endl;

  return 0;
}

Measured memory_bytes: 256
// +build ignore
package main

import (
	"bufio"
	"fmt"
	"io"
	"os"
	"strconv"
)

func solve(sc *scanner, wr *bufio.Writer) int {
	A := sc.i()
	V := sc.i()
	B := sc.i()
	W := sc.i()
	T := sc.i()

	if A > B {
		V *= -1
		W *= -1

		if A+V*T <= B+W*T {
			fmt.Println("YES")
			return 0
		}
	} else {
		if A+V*T >= B+W*T {
			fmt.Println("YES")
			return 0
		}
	}

	fmt.Println("NO")
	return 0
}

func main() {
	sc := newScanner(os.Stdin)
	wr := bufio.NewWriter(os.Stdout)
	ret := solve(sc, wr)
	wr.Flush()
	os.Exit(ret)
}

// I/O
type scanner struct {
	sc *bufio.Scanner
}

func newScanner(input io.Reader) *scanner {
	sc := bufio.NewScanner(input)
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 1024), int(1e+9))
	return &scanner{sc}
}

func (s *scanner) s() string {
	s.sc.Scan()
	return s.sc.Text()
}

func (s *scanner) i() int {
	i, e := strconv.Atoi(s.s())
	if e != nil {
		panic(e)
	}
	return i
}

func (s *scanner) f() float64 {
	f, e := strconv.ParseFloat(s.s(), 64)
	if e != nil {
		panic(e)
	}
	return f
}

func (s *scanner) bs() []byte {
	return []byte(s.s())
}

func (s *scanner) is(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = s.i()
	}
	return res
}

func (s *scanner) fs(n int) []float64 {
	res := make([]float64, n)
	for i := 0; i < n; i++ {
		res[i] = s.f()
	}
	return res
}


Measured memory_bytes: 1756
#include <iostream>
#include<string>
#include<cmath>
#include<ciso646>
#include<cstring>
#include<iomanip>
#include<vector>
#include<algorithm>
#include<utility>
#include<map>



using ll = long long;
const int M = 1000005;


using namespace std;
int gcd(int a, int b) {
	if (a < b) {
		int t = a;
		a = b;
		b = t;
	}
	
	while (b != 0) {
		int t = b;
		b = a % b;
		a = t;
	}
	return a;
}

int factorial(ll n) {
	if (n > 0) {
		return n * factorial(n - 1);
	}
	else
		return 1;
}
int main()
{
	//約数列挙！
	int n;
	cin >> n;
	vector<int> aa(n);
	vector<int> cnt(M);
	for (int i = 0;i < n;i++)
		cin >> aa[i];
	for (int x : aa) {
		//もうすでにダメな奴
		if (cnt[x] != 0) {

			cnt[x] = 2;
			continue;
		}
		for (int j = x;j < M;j += x) {
			//xの倍数にチェックをつける
			cnt[j]++;
		}
	}
	int ans = 0;
	for (int i : aa) {
		if (cnt[i] == 1) ans++;
	}
	cout << ans;
	
}
	


Measured memory_bytes: 7956
#include <bits/stdc++.h>
#define REP(i,x) for(int i=0;i<(int)(x);i++)
#define REPS(i,x) for(int i=1;i<=(int)(x);i++)
#define RREP(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define RREPS(i,x) for(int i=((int)(x));i>0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define ALL(v) v.begin(), v.end()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
#define INF 1e9
using namespace std;
typedef long long ll;

signed main() {
  // std::ifstream in ("input.txt"); std::cin.rdbuf(in.rdbuf());
  int n;
  cin >> n;

  int prv;
  cin >> prv;

  REP(i, n - 1){
    int cur;
    cin >> cur;
    if (cur - prv > 0){
      prv = cur - 1;
    } else if (cur - prv < 0){
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
  return 0;
}



Measured memory_bytes: 256
//Source:
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define un unsigned
#define vi vector<int>
#define pb push_back

using namespace std;
//******************************************************************************
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(NULL);

  #ifndef ONLINE_JUDGE
  freopen("input.txt", "r", stdin); //Read external file
  //freopen("output.txt", "w", stdout); //Write to external file
  #endif

  int a,b;
  cin>>a>>b;
  cout << (a*b) << "\n";


  return 0;
}
//******************************************************************************
//******************************************************************************


Measured memory_bytes: 3652
INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STRM = lambda: map(str,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
LISTS = lambda: list(map(str,input().split()))
def do():
    n=INT()
    a=LIST()
    a=sorted(a)
    print(a[-1]-a[0])
if __name__ == '__main__':
    do()

Measured memory_bytes: 3060
#include <map>
#include <set>
#include <ctime>
#include <cmath>
#include <stack>
#include <queue>
#include <cstdio> 
#include <iostream>
#include <algorithm>
using namespace std;

int X;
int main()
{
	cin>>X;
	if(X>=400&&X<=599)
		cout<<8<<endl;
	else if(X>=600&&X<=799)
		cout<<7<<endl;
	else if(X>=800&&X<= 999)
		cout << 6 << endl;
	else if(X >= 1000 && X <= 1199)
		cout << 5 << endl;
	else if(X >= 1200 && X <= 1399)
		cout << 4 << endl;
	else if(X >= 1400 && X <= 1599)
		cout << 3 << endl;
	else if(X >= 1600 && X <= 1799)
		cout << 2 << endl;
	else
		cout << 1 << endl;
	return 0;
}


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

int main(){
string S,T;
  cin>>S>>T;
  
  bool ans=false;
  for(int i=0; i<S.size(); i++){
   S=S[S.size()-1]+S.substr(0, S.size()-1);
    if(S==T){ans=true; break;}
  }
  
  if(ans){cout<<"Yes";}
  else{cout<<"No";}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <iomanip>
#include <math.h>
#define rep(i,x) for(ll i = 0;i<x;i++)
#define all(a) (a).begin(),(a).end()
using ll = long long;
using ld = long double;
using namespace std;
const ll INF = 1001001001;
const ll mod = 1000000007;
ll gcd(ll a,ll b){
    if(a < b)swap(a,b);
    if(a % b == 0)return b;
    else return gcd(b,a%b);
}
bool isp(ll n){
    bool res = true;
    if(n == 1)return false;
    else{
        for(ll i = 2;i * i <= n;i++){
            if(n % i == 0){
                res = false;
                break;
            }
        }
        return res;
    }
}

int main() {
    ll N;
    cin >> N;
    vector<string> kyoku(N);
    vector<ll> time(N);
    bool ok = false;
    string target;
    rep(i,N){
        cin >> kyoku[i] >> time[i];
    }
    ll ans = 0;
    cin >> target;
    rep(i,N){
        if(ok)ans += time[i];
        if(kyoku[i] == target)ok = true;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
/*AMETHYSTS*/
#pragma comment(linker, "/STACK:1000000000")
#include <cstdio>
#include <iostream>
#include <ctime>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>
#include <cstring>
#include <set>
#include <map>
#include <cstdlib>
#include <ctime>
#include <cassert>
#include <bitset>
#include <deque>
#include <stack>
#include <climits>
#include <string>
#include <queue>
#include <memory.h>
#include <unordered_map>
#include <random>
 
#define ll long long
#define ld double
#define pii pair <int, int>
#define forn(i, n) for (ll i = 0; i < (ll)n; i++)
#define mp make_pair
#define ui unsigned int
 
using namespace std;

const int maxn = 2010;
ll v[maxn];

int n;

multiset <ll> s;

void add(int x) {
	x %= n;
	if (x < 0) {
		x += n;
	}

	s.insert(v[x]);
}

void del(int x) {
	x %= n;
	if (x < 0) {
		x += n;
	}

	s.erase(s.find(v[x]));
}

ll solve(int d) {
	s.clear();
	for (int i = -d; i <= 0; i++) {
		add(i);
	}

	ll res = 0;

	for (int i = 0; i < n; i++) {
		res += *s.begin();
		del(i - d);
		add(i + 1);
	}

	return res;
}

int main() {
	ll x;

	cin >> n >> x;

	ll sum = 0;

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

	ll ans = (ll)1e18;

	for (int i = 0; i < n; i++) {
		ans = min(ans, x * i + solve(i));
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 384
#親戚の数
relatives = int(input())

#ビットコインの合計
BTC = 0.0

#日本円の合計
JPY = 0

#お年玉判定
Currency = ''
amount = ''

#合計金額
total = 0.0

for i in range(relatives):
  amount, Currency = map(str,input().split())

#日本円の合計額をJPYに格納する。
  if Currency == 'JPY':
    JPY += int(amount)

#ビットコインの合計量をBTCに格納する。
  elif Currency == 'BTC':
    BTC += float(amount)

#ビットコインを日本円にし、日本円の合計額を計算する。
total = JPY + 380000.0 * float(BTC)

print(total)

Measured memory_bytes: 3064
using System;
using System.Linq;

class Program {
    static void Main() {
        while(true) {
            string[] stdin = Console.ReadLine().Split();
            int h = int.Parse(stdin[0]);
            int w = int.Parse(stdin[1]);
            if((h | w) == 0) break;
            for(int i = 0; i < h; i++) {
                for(int j = 0; j < w; j++) Console.Write((i + j) % 2 == 0? '#' : '.');
                Console.WriteLine();
            }
            Console.WriteLine();
        }
    }
}


Measured memory_bytes: 20000
#include <iostream>

using namespace std;

int main() {
    char a, b, c;
    cin >>a>>b>>c;
    if(a-'0' ==7 || b-'0'==7||c-'0'==7)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
long long n, s;
int main()
{
    scanf("%lld%lld", &n, &s);
    if(n < s)
    {
        puts("-1"); return 0;
    }
    if(n == s)
    {
        printf("%lld\n", n+1); return 0;
    }
    vector<long long> div;
    for(long long i=1; i*i<=n-s; ++i)
        if((n-s)%i==0) div.push_back(i), div.push_back((n-s)/i);
    sort(div.begin(), div.end());
    for(auto x: div)
    {
        ++x;
        long long m = n;
        long long ans = 0;
        while(m)
        {
            ans += m%x;
            m /= x;
        }
        if(ans == s)
        {
            printf("%lld\n", x);
            return 0;
        }
    }
    puts("-1");
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
//#include <algorithm>
#include <vector>

using namespace std;

int main(){
    string s;
    cin >> s;
    int A,B,C,D;
    A = s[0]-'0';
    B = s[1]-'0';
    C = s[2]-'0';
    D = s[3]-'0';

    int sum = 0;
    char first, second, third;

    for(int i = 0; i < 2; i++){
        for(int j = 0; j < 2; j++){
            for(int k = 0; k < 2; k++){
                if(i==0){
                    sum = A+B;
                    first = '+';
                }else{
                    sum = A-B;
                    first = '-';
                }
                if(j==0){
                    sum = sum+C;
                    second = '+';
                }else{
                    sum = sum-C;
                    second = '-';
                }
                if(k==0){
                    sum = sum+D;
                    third = '+';
                }else{
                    sum = sum-D;
                    third = '-';
                }
                if(sum == 7){
                    cout << A << first << B << second << C << third << D << "=7" << endl;
                    return 0;
                }
            }
        }
    }

    return 0;
}


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

int main() {
    int n,l;
    cin >> n >> l;
    vector<string> s(n);
    for(int i=0;i<n;i++){
        cin >> s.at(i);
    }
    sort(s.begin(),s.end());
    for(int i=0;i<n;i++){
        cout << s.at(i);
    }
    cout << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main{

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);

        int lineCount = 1;
        while (sc.hasNextLine()) {
            String[] line = sc.nextLine().split(" ");
            int fromYear = Integer.parseInt(line[0]);
            int toYear = Integer.parseInt(line[1]);

            // ??\???????????¨??????0??§????????´?????????????????????
            if (fromYear == 0 && toYear == 0) {
                break;
            }

            if (lineCount++ != 1) {
                System.out.println("");
            }

            int leapCount = 0;
            for (int year = fromYear; year <= toYear; year++) {
                if (isLeapYear(year)) {
                    System.out.println(year);
                    leapCount++;
                }
            }

            if (leapCount == 0) {
                System.out.println("NA");
            }

        }
        sc.close();
    }

    /**
     * ?????°??????????????´???????????????????????????
     */
    private static boolean isLeapYear(int year) {
        if (year % 400 == 0) {
            return true;
        }

        if (year % 100 == 0) {
            return false;
        }

        if (year % 4 == 0) {
            return true;
        }

        return false;

    }
}

Measured memory_bytes: 27432
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N,c=0,x=0;cin>>N;int H[N];
  for(int i=0;i<N;i++)cin>>H[i];
  while(c<N){
    int i=0;
    while(c+i+1<N&&H[c+i+1]<=H[c+i])i++;
    x=max(x,i);
    c+=i+1;
  }
  cout<<x<<endl;
}

Measured memory_bytes: 640
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstring>
#include<cmath>

#define lson k << 1
#define rson k << 1 | 1
using namespace std;
const int N = 200005;
typedef long long ll;

int read(){
	int x = 0 , f = 1; char ch = getchar();
	while(ch < '0' || ch > '9'){if(ch == '-') f = -1 ; ch = getchar();}
	while(ch >= '0' && ch <= '9'){x = x * 10 + ch - '0' ; ch = getchar();}
	return x * f;
}

int a[N] , n;
int main(){
	n = read();
	for(int i = 1 ; i <= n ; i++) a[i] = read();
	ll ans = 0;
	if(a[1]) return 0 * puts("-1");
	for(int i = 2 ; i <= n ; i++) if(a[i] - a[i - 1] > 1) return 0 * puts("-1");
	for(int i = 1 ; i <= n ; i++){
		if(a[i]){
			ans++;
			if(a[i] - a[i - 1] != 1){
				ans += a[i] - 1;
			}			
		}
	}
	printf("%lld\n",ans);
}

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

using namespace std;



int main(){
    int64_t a, b;
    cin >> a >> b;
    int64_t arr[a];
    for(int64_t i = 0; i < a; i++){
        cin >> arr[i];
    }
    sort(arr, arr+a);
    int64_t res = 0;
    for(int64_t i = 0; i < a-b; i++){
        res += arr[i];
    }
    cout << res << endl;
    return 0;
}

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

	int bubbleSort(int A[], int N){
		int sw=0;
		bool flag=1;
		for(int i=0; flag; i++){
			flag=0;
			for(int j=N-1; j>=i+1; j--){
				if(A[j]<A[j-1]){
					swap(A[j], A[j-1]);
					flag=1;
					sw++;
			}
		}
	}
	return sw;
}

int main(){
	int A[100], N, sw;
	cin >> N;
	for(int i=0; i<N; i++) cin >> A[i];
	
	sw = bubbleSort(A, N);
	
	for(int i=0; i<N; i++){
		if(i) cout << " ";
		cout << A[i];
	}
	cout << endl;
	cout << sw << endl;
	
	return 0;
}


Measured memory_bytes: 3128
group1 = [1,3,5,7,8,10,12]
group2 = [4,6,9,11]
group3 = [2]
x,y = map(int,input().split())
if (x in group1 and y in group1) or (x in group2 and y in group2) or (x in group3 and y in group3):
    print("Yes")
else:
    print("No")


Measured memory_bytes: 2940
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = Integer.parseInt(sc.next());
		int b = Integer.parseInt(sc.next());
		int c = Integer.parseInt(sc.next());
		int d = Integer.parseInt(sc.next());
		int e = Integer.parseInt(sc.next());
		int f = Integer.parseInt(sc.next());
		int water = 0;
		int sugar = 0;
		for (int i = 0; i <= f; i += 100 * a) {
			for (int j = 0; i + j <= f; j += 100 * b) {
				for (int k = 0; i + j + k <= f; k += c) {
					for (int l = 0; i + j + k + l <= f; l += d) {
						if ((k + l) * 100 <= e * (i + j)) {
							if ((water == 0 && sugar == 0)|| sugar * (i + j + k + l) < (k + l) * water) {
								water = i + j + k + l;
								sugar = k + l;
							}
						}
					}
				}
			}
		}
		System.out.println(water + " " + sugar);
	}
}

Measured memory_bytes: 21716
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;

public class Main {
  public static void main(String[] args) throws IOException {
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    String[] str = in.readLine().split(" ");
    int a = Integer.parseInt(str[0]);
    int b = Integer.parseInt(str[1]);
    int c = Integer.parseInt(str[2]);
    int d = Integer.parseInt(str[3]);
    boolean flg = true;
    for(; flg == true;){
      c = c-b;
      if(c<=0){
        System.out.println("Yes");
        flg = false;
        break;
      }
      a = a-d;
      if(a<=0){
        System.out.println("No");
        flg = false;
      }
    }
  }
}

Measured memory_bytes: 32516
#include <bits/stdc++.h>
 
using namespace std;
 
const long long MOD=1e9+7;
const double PI=3.14159265359;


int main() {
    
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    
    vector<int> vi(4);
    
    string s;
    cin>>s;
    for(int i=0; i<4; i++){
        vi[i]=s[i]-'0';
    }
    
    
    
    
    for(int i=0; i<(1<<3); i++){
        string s;
        s+=to_string(vi[0]);
        int num=vi[0];
        for(int j=0; j<3; j++){
            int num2=1<<j;
            //cout<<vi[j+1];
            
            if(num2&i){
                num+=vi[j+1];
                s+="+";
            }
            else{
                num-=vi[j+1];
                s+="-";
            }
            s+=to_string(vi[j+1]);
        }
        //cout<<i<<" "<<num<<endl;
        
        if(num==7){
            cout<<s<<"=7";
            return 0;
        }
        
        
        
    }
    
    
    
    return 0;
    
}

Measured memory_bytes: 256