akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <deque>
#include <list>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>

using namespace std;

//typedef
typedef long long LL;
typedef vector<LL> VL;
typedef vector<VL> VVL;
typedef vector<string> VS;
typedef pair<LL, LL> PLL;

//conversion
inline LL toLong(string s) {LL v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) LL((a).size())
#define EACH(i,c) for(auto i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
#define FOR(i,a,b) for(LL i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define UNTIL(p) while(!(p))

//constant
const double EPS = 1e-5;
const double PI  = acos(-1.0);

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

#define PUTS(x) cout << (x) << endl;

const LL MOD = 1e9 + 7;

class ModCombination{
    vector<LL> fact_, inv_, finv_;
public:
    ModCombination() {}
    ModCombination(LL n) noexcept : fact_(n, 1), inv_(n, 1), finv_(n, 1) {
        init(n);
    }
    void init(LL n) noexcept {
        fact_.assign(n, 1), inv_.assign(n, 1), finv_.assign(n, 1);
        for(LL i = 2; i < n; i++){
            fact_[i] = fact_[i-1] * i % MOD;
            inv_[i] = MOD - inv_[MOD%i] * (MOD/i) % MOD;
            finv_[i] = finv_[i-1] * inv_[i] % MOD;
        }
    }
    LL comb(LL n, LL k) const noexcept {
        if (n < k || n < 0 || k < 0) return 0;
        return fact_[n] * (finv_[k] * finv_[n-k] %MOD) % MOD;
    }
    LL fact(LL n) const noexcept {
        if (n < 0) return 0;
        return fact_[n];
    }
    LL inv(LL n) const noexcept {
        if (n < 0) return 0;
        return inv_[n];
    }
    LL finv(LL n) const noexcept {
        if (n < 0) return 0;
        return finv_[n];
    }
};

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

    LL n,k;
    cin>>n>>k;
    VL a(n);
    REP(i,n)cin>>a[i];

    ModCombination mod(n);

    SORT(a);
    LL max_sum = 0;
    LL min_sum = 0;
    REP(i,n){
        if(i >= k-1){
            max_sum += a[i] * mod.comb(i,k-1);
            max_sum %= MOD;
        }
        if(n-i-1 >= k-1){
            min_sum += a[i] * mod.comb(n-i-1, k-1);
            min_sum %= MOD;
        }
    }

    PUTS(((max_sum + MOD) - min_sum) % MOD);
}

Measured memory_bytes: 3456
#include <bits/stdc++.h>
#define rep(i, n, m) for (int i = (int)(n); i < (int)(m); i++)
using namespace std;
using ll = int64_t;
const int MOD = 1000000007; // 10^9+7

int main() {
    int N;
    cin >> N;
    vector<int> A(N);
    map<int, ll> B;
    map<int, ll> C;
    rep(i, 0, N)
    {
        cin >> A[i];
        B[A[i]]++;
    }

    for (auto i = B.begin(); i != B.end(); ++i)
    {
        C[i->first] = i->second * (i->second - 1) / 2;
    }

    ll sum = 0L;
    for (auto i = C.begin(); i != C.end(); ++i)
    {
        sum += i->second;
    }

    rep(i, 0, N)
    {
        cout << sum - C[A[i]] + C[
            A[i]] * (B[A[i]] - 2L) / B[A[i]] << endl;
    }
}


Measured memory_bytes: 18176
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using pii = pair<int, int>;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define MOD 1000000007

long long lmax(long long a, long long b) {
  if (a > b) return a;
  else return b;
}

long long lmin(long long a, long long b) {
  if (a > b) return b;
  else return a;
}

int main() {
  ll W, H, x, y;
  cin >> W >> H >> x >> y;
  double area = (double)W * (double)H / 2.0;

  printf("%10lf ", area);
  double a = (double)W / 2.0;
  double b = (double)H / 2.0;
  if ((double)x == a && (double)b == y) cout << "1" << endl;
  else cout << "0" << endl;


}



Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#define rep(i,n) for (int i = 0; i < n; ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;

int main() {
  int A, B;
  cin >> A >> B;
  if (A > 9 || B > 9) cout << -1 << endl;
  else cout << A*B << endl;
  return 0;
}

Measured memory_bytes: 3144
#include<iostream>
#include<stdio.h>
#include<math.h>
#include<algorithm>
using namespace std;

const int MAX=2e5+5;
const int MOD=1000000000;
const long long int Min=(2e5)*(1e9)+5;
long long int  a[MAX];
long long int sum[MAX];

int main()
{
    ios::sync_with_stdio(false);
    int N;
   scanf("%d",&N);
    long long int sum2=0;
    for(int i=1;i<=N;i++)
    {
        scanf("%lld",&a[i]);
        sum[i]=sum[i-1]+a[i];
        sum2+=a[i];
    }
    long long int min=Min;
    for(int i=1;i<N;i++)
    {
           if(min>fabs(2*sum[i]-sum2))
           min=fabs(2*sum[i]-sum2);
    }
    printf("%d\n",min);

    return 0;
}

Measured memory_bytes: 3328
#include <iostream>
#include <vector>
#include <cmath>
#include <string>
#include <algorithm>
#include <iomanip>
#include <map>
#include <bitset>
#include <cstdio>
#include <set>
#include <stack>
#include <queue>
#include <cassert>
#include <numeric>
#define rep(i,n) Rep(i,0,n)
#define Rep(i,k,n) for(int i=k ; i<n ; i++)
#define rep1(i,n) for(int i=1 ; i<=n ; i++)
#define Rep1(i,k,n) for(int i=k ; i<=n ; i++)
#define rrep(i,n) for(int i=n ; i>=0 ; i--)
#define vi vector<int>
#define vii vector<vector<int>>
#define mii map<int,int>
#define Sort(v) sort(v.begin(),v.end())
#define Reverse(v) reverse(v.begin(),v.end())
#define ALL(a)  (a).begin(),(a).end()
#define pb push_back
#define mp make_pair
//#define int ll
typedef long long ll;

const int md = 1000000007;
const int INF = 1<<30;
using namespace std;


int main(){
    int n,m ; cin >> n >> m;
    vector<pair<int,int>> p(m);
    int ml = 0;

    rep(i,m){
        cin >> p[i].first >> p[i].second;
        ml = max(ml,p[i].first);
    }

    Sort(p);
    //cout << ml << " " << mr << endl;
    int mr = n;
    rep(i,m){
        //cout << p[i].second << endl;
        if(p[i].second < ml){
            mr = ml -1;
            break;
        }
        if(p[i].second >= ml) {
            mr = min(mr, p[i].second);

        }

    }
    //cout << ml << " " << mr << endl;

    cout << mr - ml + 1 << endl;


}


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

using namespace std;


int main()
{

  int A, B, C;
  cin >> A >> B >> C;
  int a = A, b = B, c = C;

  int cost = 0;

  while(a % 2 == 0 && b % 2 == 0 && c % 2 == 0) {
    int latte = a / 2;
    int malta = b / 2;
    int beet = c / 2;
    a = malta + beet;
    b = latte + beet;
    c = latte + malta;

    ++cost;
    if(A == a && b == B && c == C) {
      cout << -1 << endl;
      return (0);
    }
  }

  cout << cost << endl;
}

Measured memory_bytes: 384
#include<iostream>
#include<iomanip>
#include<map>
#include<unordered_map>
#include<set>
#include<unordered_set>
#include<vector>
#include<array>
#include<string>
#include<stack>
#include<queue>
#include<algorithm>
#include<cassert>
#include<functional>
#include<random>
#include<complex>
#include<bitset>
#include<chrono>
//#include<boost/multiprecision/cpp_int.hpp>
#define int int64_t
#define uint uint64_t
#define REP(i, a, b) for (int64_t i = (int64_t)(a); i < (int64_t)(b); i++)
#define rep(i, a) REP(i, 0, a)
#define EACH(i, a) for (auto i: a)
#define ITR(x, a) for (auto x = a.begin(); x != a.end(); x++)
#define ALL(a) (a.begin()), (a.end())
#define HAS(a, x) (a.find(x) != a.end())
#define Min(x) *min_element(ALL(x))
#define Max(x) *max_element(ALL(x))
#define Unique(L) (L.erase(unique(ALL(L)), L.end()))
#define veccat(v1, v2) std::copy((v2).begin(),(v2).end(),std::back_inserter(v1)/*v1の後ろにv2を入れる*/)
#define intmax (std::numeric_limits<int64_t>::max() / 4)
using namespace std;
//typedef boost::multiprecision::cpp_int bigint;
const double EPS = 1e-9;
const double PI = acos(-1.0);


int n, k;

int solve(int i) {
	int num[3][7];
	rep(j, 3)rep(k, 7)num[j][k] = 7 * (i + j) + (k + 1) - 7;
	int ans = 0;
	rep(j, 5) {
		int sum = 0;
		rep(k, 3)rep(l, 3)sum += num[k][j + l];
		if (sum % 11 == k)ans++;
	}
	return ans;
}

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

	int unit = 0;
	for (int i = 1; i <= 11; i++)unit += solve(i);

	cin >> n >> k;
	n -= 2;


	int ans = unit * (n / 11);
	for(int i = 1; i <= (n % 11); i++)ans += solve(i);
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<utility>
#include<deque>
#include<algorithm>
#include <iomanip>
#include<cmath>
#include <map>
#include<numeric>

using namespace std;
using ll = long long int;
constexpr int INF = 1 << 29;
constexpr ll MOD = ll(1e9 + 7);
string s, t;
int n = 0;
vector<char> r(26, '#'), r2(26, '#');

bool permutation_check(vector<char>& vec, char c1, char c2) {
	int pos = c1 - 'a';
	if (vec[pos] == '#')
		vec[pos] = c2;
	else if (vec[pos] != c2) {
		return false;
	}
	return true;
}

int main(void) {
	cin >> s >> t;
	n = s.size();
	string ret = "Yes";

	for (int i = 0; i < n; i++) {
		if (!permutation_check(r, s[i], t[i])) {
			ret = "No";
			break;
		}
		if (!permutation_check(r2, t[i], s[i])) {
			ret = "No";
			break;
		}
	}
	cout << ret << endl;
}


Measured memory_bytes: 776
import math

if __name__ == "__main__":
    x, n = map(int, input().split())
    a = set(map(int, input().split()))
    p = q = x
    while True:
        if p not in a and q not in a:
            print(min(p, q))
            quit(0)
        if p not in a:
            print(p)
            quit(0)
        elif q not in a:
            print(q)
            quit(0)
        else:
            p -= 1
            q += 1



Measured memory_bytes: 9092
import java.io.*;
import java.util.*;

class Main{
    public void run() throws Exception{
        Scanner cin = new Scanner(System.in);
        String arg = cin.next();

        if(arg.contains("111") || arg.contains("222") ||arg.contains("333") || arg.contains("444")||arg.contains("555") || arg.contains("666")||arg.contains("777") || arg.contains("888") || arg.contains("999") || arg.contains("000")){
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }
    public static void main(String[] args) throws Exception{
        new Main().run();
    }
}


Measured memory_bytes: 21716
with open(0) as f:
    N, *A = map(int, f.read().split())

pair = []
unpair = set()
for a in A:
    if a in unpair:
        unpair.remove(a)
        pair.append(a)
    else:
        unpair.add(a)
pair.sort()
print(pair.pop()*pair.pop() if len(pair) > 1 else 0)

Measured memory_bytes: 20080
/**
 *    created by : PawPaw       
**/

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

typedef tree<int, null_type, less<int>, rb_tree_tag,  
        tree_order_statistics_node_update>  
        ordered_set;  

#define F(i,a,b) for(int i = (int)(a); i <= (int)(b); i++)
#define RF(i,a,b) for(int i = (int)(a); i >= (int)(b); i--)
#define LL long long
#define PHI acos(-1)
#define EPS 0.000000001
#define N 100001
#define MOD 1000000007
#define PB push_back
#define MP make_pair
#define FbO find_by_order
#define OoK order_of_key

int ans = 0;

int visa[N];
bool vis[N];
vector<int> adj[N];

void dfsa(int u, int time){
  visa[u] = time;
  for(int v : adj[u]){
    if(visa[v] == -1)
      dfsa(v, time+1);
  }
}

int dfst(int u, int time){
  if(time >= visa[u]) return visa[u];
  int ret = visa[u]-1;
  vis[u] = true;
  for(int v : adj[u]){
    if(!vis[v])
      ret = max(ret, dfst(v, time+1));
  }
  return ret;
}

int solve(){
  int n, u, v, a, b;
  fill(visa, visa+N, -1);
  fill(vis, vis+N, false);

  cin >> n >> u >> v;
  F(i, 1, n-1){
    cin >> a >> b;
    adj[a].PB(b);
    adj[b].PB(a);
  }

  dfsa(v, 0);
  cout << dfst(u, 0) << '\n';

  return 0;
}

void fun(){
  int t = 1;
  // cin >> t;
  while(t--) solve();
} 

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

  fun();

  
  return 0;
}

Measured memory_bytes: 9344
class Combination():
    def __init__(self, n, mod=10**9+7):
        self.mod = mod
        self.fac = [1]*(n+1)
        for i in range(1,n+1):
            self.fac[i] = self.fac[i-1] * i % self.mod
        self.invfac = [1]*(n+1)
        self.invfac[n] = pow(self.fac[n], self.mod - 2, self.mod)
        for i in range(n-1, 0, -1):
            self.invfac[i] = self.invfac[i+1] * (i+1) % self.mod
 
    def combination(self, n, r):
        return self.fac[n] * self.invfac[r] % self.mod * self.invfac[n-r] % self.mod
 
    def permutation(self, n, r):
        return self.factorial(n) * self.invfactorial(n-r) % self.mod
 
    def factorial(self, i):
        return self.fac[i]
 
    def invfactorial(self, i):
        return self.invfac[i]
c = Combination(2000)
mod = 10**9+7
S = int(input())
n = 1
ans = 0
while True:
    if S - 3*n < 0:
        break
    elif S - 3*n == 0:
        ans += 1
        break
    ans += c.combination(S-2*n-1,n-1)
    ans %= mod 
    n += 1
print(ans%mod)


Measured memory_bytes: 64436
/*~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=
*$* WRITER:kakitamasziru/OxOmisosiru *$*
~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=*/
#ifdef LOCAL_JUDGE
#define _GLIBCXX_DEBUG //FOR THE DEBUG! COMMENT OUT THIS WHEN SUBMITTING!
#endif
/* I REALLY HOPE MY WISH REACH YOU , ATCODER'S ONLINE JUDGE */
#define WOULD
#define YOU
#define PLEASE
#define ACCEPT
#define MY
#define SUBMISSION
/* I REALLY HOPE MY WISH REACH YOU , ATCODER'S ONLINE JUDGE */
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <iomanip>
#include <limits>//setprecision
//#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <math.h>//pow,,,
#include <cmath>//abs,,,
#include <bitset> // bitset
//It is so troublesome that I include bits/stdc++.h !
using namespace std;

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; }
const long long INF = 100100100100;
const long long MOD = 1000000007;
typedef pair<long long,long long> P;
//NのM乗を求める(繰り返し二乗法)
long long mod_pow(long long N, long long M) {
    if (M == 0) return 1;
    long long res = mod_pow((N * N) % MOD, M / 2);
    //最下位ビット(*N)が1の時は単独でNをかける
    if (M & 1) res = (res * N) % MOD;

    return res %= MOD;
}
long long nCr(long long n, long long r) {
    long long A = 1, B = 1;
    //Aが分子Bが1/r!
    for (long long i = n - r + 1; i <= n; i++) {
        A = A * i % MOD;
    }
    for (long long i = 1; i <= r; i++) {
        B = B * i % MOD;
    }
    B = mod_pow(B, MOD - 2);
    B %= MOD;
    //Bは割るのではなく掛ける
    return (A * B) % MOD;
}

long long gcd(long long a, long long b) {
    if (b == 0) return a;
    else return gcd(b, a % b);
}
 
long long lcm(long long a, long long b) {
    return a * b / gcd(a, b);
}

//long long A,B;
bool ok(long long key,long long index){
    if(index > key) return true;
    else if(index <= key) return false;
}
long long binary_search(long long key,long long size){
    //left,right,midはいずれもindex
    long long left = -1,right = size;
    while(right - left > 1){
        long long mid = left + (right-left)/2;
        long long hantei = ok(key,mid);
        if(hantei) right = mid;
        else left = mid;
    }
    if(left == -1)return 0;
    return left;
}

int main() {
    long long A,B;cin >> A >> B;
    if(A <= 0 && B >= 0){
        cout << "Zero" << endl;
        return 0;
    }
    if(A > 0 || B < 0 && (abs(A-B)+1) % 2 == 0){
        cout << "Positive" << endl;
        return 0;
    }
    if(B < 0 && (abs(A-B)+1) % 2 == 1){
        cout << "Negative" << endl;
        return 0;
    }
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cctype>

#include <algorithm>
#include <random>
#include <bitset>
#include <queue>
#include <functional>
#include <set>
#include <map>
#include <vector>
#include <chrono>
#include <iostream>
#include <limits>
#include <numeric>

#define LOG(FMT...) fprintf(stderr, FMT)

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

// mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

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

template <class T>
ostream& operator<<(ostream& os, const vector<T>& v) {
  if (!v.empty()) {
    os << v.front();
    for (int i = 1; i < v.size(); ++i)
      os << ' ' << v[i];
  }
  return os;
}

int main() {
#ifdef LBT
  freopen("test.in", "r", stdin);
  int nol_cl = clock();
#endif
  ios::sync_with_stdio(false);
  cin.tie(nullptr);

  function<int(ll)> cns = [&](ll x) { return x ? (x % 10 + cns(x / 10)) : 0; };
  ll n;
  cin >> n;
  int ans = cns(n), v = 0;
  while (n >= 10) {
    v += 9;
    n /= 10;
  }
  ans = max(ans, v + (int)n - 1);
  cout << ans;

#ifdef LBT
  LOG("Time: %dms\n", int ((clock()
          -nol_cl) / (double)CLOCKS_PER_SEC * 1000));
#endif
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<map>
using namespace std;
int main() {
  int n,a[100000]={},cnt=0;
  cin >> n;
  map<int,int> m;
  for(int i=0; i<n; i++) {
    cin >> a[i];
    m[a[i]]++;
  }
  for(auto p:m) {
    if(p.second>1) {
      cnt+=p.second-1;
    }
  }
  if(cnt%2==0) {
    cout << n-cnt << endl;
  }
  else {
    cout << n-cnt-1 << endl;
  }
}

Measured memory_bytes: 5376
#include  <stdio.h>

int main () {
  long long int A;
  long long int B;
  long long int C;
  long long int K,amari,sum;
  scanf("%lld %lld %lld %lld",&A,&B,&C,&K);
  if(A>=K){
    printf("%lld",K);
    return 0;
  }else{
    amari = K-A;
    sum = A;
    if(B>=amari){
	  printf("%lld",sum);
      return 0;
    }else{
	  amari = amari-B;
      printf("%lld",sum-amari);
    }
  }
  return 0;
}


Measured memory_bytes: 1712
import Control.Applicative

solve :: Floating a => [a] -> [a] -> a -> a
solve as bs p = (**(1/p)) . sum . map ((**p) . abs) $ zipWith (-) as bs

solve' :: (Ord a, Num a) => [a] -> [a] -> a
solve' as bs = maximum . map abs $ zipWith (-) as bs

main = do
    getLine
    as <- map read . words <$> getLine
    bs <- map read . words <$> getLine
    mapM_ print $ map (solve as bs) [1..3]
    print $ solve' as bs


Measured memory_bytes: 4364
import sys
import math
from collections import Counter
import itertools
#from functools import reduce

# 入力を整数に変換して受け取る
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def MI1(): return map(int1, sys.stdin.readline().split())
# 入力全てを整数に変換したものの配列を受け取る
def LI(): return list(map(int, sys.stdin.readline().split()))
# 入力全てを整数に変換して1引いたものの配列を受け取る
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def SR(): return sys.stdin.readline().rstrip()

ascii_lowercase = 'abcdefghijklmnopqrstuvwxyz'
ascii_uppercase = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
ascii_uppercase2 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ'

# リストを改行区切りで出力する
p2D = lambda x: print(*x, sep="\n")
p2E = lambda x: print(''.join(x))
p2S = lambda x: print(*x, sep=" ")

# ###########################################

N=II()
W=LI()
mini=9999999

for i in range(1,N):
    s1=0
    s2=0
    for j in range(1,N+1):
        if j<=i:
            s1+=W[j-1]
        else:
            s2+=W[j-1]
    mini = min(mini, abs(s1-s2))
print(mini)

Measured memory_bytes: 3316
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define int long long
signed main(){
    int x;
    cin>>x;
    int i = 0;
    int answer = 100;
    while(1){
    	if(answer>=x){
    		break;
    	}
        answer = answer*1.01;
        i++;
    }
    cout<<i;
    return 0;
}

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

int main() {
  string A, B;
  cin >> A >> B;
  string ans="EQUAL";
  
  if(A.size()>B.size())ans="GREATER";
  else if(A.size()<B.size())ans="LESS";
  else{
    for(int i=0; i<A.size(); i++){
      if(A.at(i)>B.at(i)){
        ans ="GREATER";
        break;
      }
      else if(A.at(i)<B.at(i)){
        ans ="LESS";
        break;
      }
    }
  }
  
  cout << ans << endl;
}


Measured memory_bytes: 3632
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtCoder.Abc
{
    public class QuestionA
    {
        public static void Main(string[] args)
        {
            // 整数配列の入力
            var inputLongArray = Console.ReadLine().Split(' ').Select(i => long.Parse(i)).ToArray();

            Console.WriteLine(inputLongArray[0] * inputLongArray[1] / 2);


        }
    }
}

Measured memory_bytes: 13396
###############################################################################

from bisect import bisect_left as binl

def intin():
    input_tuple = input().split()
    if len(input_tuple) <= 1:
        return int(input_tuple[0])
    return tuple(map(int, input_tuple))


def intina():
    return [int(i) for i in input().split()]


def intinl(count):
    return [intin() for _ in range(count)]


def modadd(x, y):
    global mod
    return (x + y) % mod


def modmlt(x, y):
    global mod
    return (x * sy) % mod


def lcm(x, y):
    while y != 0:
        z = x % y
        x = y
        y = z
    return x


###############################################################################


def main():
    timelist = intinl(5)

    min_broken = 10
    min_i = None

    for i, time in enumerate(timelist):
        broken = time % 10
        if broken and broken < min_broken:
            min_broken = min(broken, min_broken)
            min_i = i

    new_timelist = []
    for time in timelist:
        if time % 10:
            time += (10 - time % 10)
        new_timelist.append(time)


    if min_i is None:
        print(sum(new_timelist))
    else:
        del new_timelist[min_i]
        time = timelist.pop(min_i)
        print(sum(new_timelist) + time)


if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
#include<iostream>
#include<algorithm>
#include<vector>
#include<stdio.h>
#include<complex>
using namespace std;

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

  vector<vector<bool> > t(4,vector<bool>(13,false));

  for(int i = 0; i < n; i++){
    char m; int nn; cin >> m >> nn;
    nn--;
    if(m == 'S') t[0][nn] = true;
    if(m == 'H') t[1][nn] = true;
    if(m == 'C') t[2][nn] = true;
    if(m == 'D') t[3][nn] = true;
  }
  for(int i = 0; i < 4; i++){
    for(int j = 0; j < 13; j++){
      if(t[i][j]) continue;
      if(i == 0){
        cout << "S " << j+1 << endl;
      }else if(i == 1){
        cout << "H " << j+1 << endl;
      }else if(i == 2){
        cout << "C " << j+1 << endl;
      }else if(i == 3){
        cout << "D " << j+1 << endl;
      }
    }
  }
  return 0;
}



Measured memory_bytes: 3088
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define INFTY 200000000000
long long dp[310][310];
const int MOD=1000000007;
vector<long long> a(310);
int b;
const double PI=3.1415926535897932;
int main(){
    ll n,x;cin>>n>>x;
    ll ans=0;
    for (ll k = x; k <= n+1; k++)
    {
        ans = (ans+n*k-k*(k-1)+1)%MOD;
    }
    cout<<ans<<endl;


    return 0;
}

Measured memory_bytes: 3584
#include <bits/stdc++.h>
using namespace std;
 
int main(void)
{
    int n,d,x,sum=0;
    cin >> n >> d >> x;
    vector<int> date(n);
    vector<int> unko(n);
    for(int i=0;i<n;i++){
        cin >> date.at(i);
        unko.at(i)=((d-1)/date.at(i))+1;
    }
    for(int i=0;i<n;i++){
        sum+=unko.at(i);
    }
    cout << sum+x;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main()
{
    int N,A,B,C,D;
    cin >> N >> A >> B >> C >> D;

    int ansX=(N%A==0?N/A:(N/A)+1)*B;
    int ansY=(N%C==0?N/C:(N/C)+1)*D;

    cout << min(ansX,ansY) << endl;
    return 0;
}



Measured memory_bytes: 3108
import java.util.*;
import java.util.stream.IntStream;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] a = new int[n];
        IntStream.range(0,n).forEach(i ->
        {
            a[i] = sc.nextInt();
        });
        long count4 = Arrays.stream(a).filter(i -> { if( i%4==0){return true;}else{return false;}}).count();
        long count2 = Arrays.stream(a).filter(i -> { if( i%4!=0 && i%2==0){return true;}else{return false;}}).count();

        long N = (long)n;

        N = N-((count2/2)*2);
        N = N-(count4*2+1);
        if(N >= 1){
            System.out.print("No");
        }else{
            System.out.print("Yes");
        }

    }
}

Measured memory_bytes: 59448
#include<cstdio>
#include<iostream>
#include<cstring>
#include<iostream>
#include<algorithm>
#include<cmath>
using namespace std;

int n, m;

int main()
{
	while(scanf("%d %d", &n, &m) != EOF)
	{
		int t = 1 << m;
		int ans = t * (1900 * m + (n - m) * 100);
		printf("%d\n", ans);
	}
	return 0;
}

Measured memory_bytes: 256
package main

import "fmt"

func main() {
	var a [3]int
	var c5, c7 int
	fmt.Scan(&a[0], &a[1], &a[2])
	for _, v := range a {
		switch v {
		case 5:
			c5++
		case 7:
			c7++
		}
	}
	if c5 == 2 && c7 == 1 {
		fmt.Println("YES")
	} else {
		fmt.Println("NO")
	}

}


Measured memory_bytes: 512
#include <cstdio>
#include <cmath>
#include <iostream>
#include <set>
#include <algorithm>
#include <vector>
#include <map>
#include <cassert>
#include <string>
#include <cstring>
#include <queue>

using namespace std;

#define rep(i,a,b) for(int i = a; i < b; i++)
#define S(x) scanf("%d",&x)
#define S2(x,y) scanf("%d%d",&x,&y)
#define P(x) printf("%d\n",x)
#define all(v) v.begin(),v.end()
#define mp make_pair
#define pb push_back
#define FF first
#define SS second

typedef long long int LL;
typedef pair<int, int > pii;
typedef vector<int > vi;

const int N = 200005;

int MX[N],MN[N];
vector<pii> v;
set<pii > mx,mn;

int main() {
  int n;
  S(n);

  rep(i,0,n) {
    int x,y;
    S2(x,y);
    MX[i] = max(x,y);
    MN[i] = min(x,y);
    v.pb(mp(MN[i],MX[i]));
  }
  sort(all(v));
  rep(i,0,n) {
    mn.insert(mp(v[i].FF,i));
    mx.insert(mp(v[i].SS,i));
  }
  LL ans = ((*mx.rbegin()).FF - (*mx.begin()).FF) * 1LL * ((*mn.rbegin()).FF - (*mn.begin()).FF);
  rep(i,0,n) {
    pii p = *mn.begin();
    mx.erase(mp(v[p.SS].SS,p.SS));
    mx.insert(mp(v[p.SS].FF,p.SS));

    mn.erase(mp(v[p.SS].FF,p.SS));
    mn.insert(mp(v[p.SS].SS,p.SS));
  
    LL val = ((*mx.rbegin()).FF - (*mx.begin()).FF) * 1LL * ((*mn.rbegin()).FF - (*mn.begin()).FF);
    ans = min(ans, val);
  }
  cout << ans << "\n";
  return 0;
}


Measured memory_bytes: 22128
#include <stdio.h>
int main(){
    int s[105][105];
     int a,b;
    scanf("%d%d",&a,&b);
    getchar();
    for(int i=1;i<=a;i++){
    for(int j=1;j<=b;j++){
        scanf("%c",&s[i][j]);
    }
    getchar();
    }
    for(int i=0;i<=a+1;i++){
        for(int j=0;j<=b+1;j++){
        if(i==0||i==a+1||j==0||j==b+1) putchar('#');
        else printf("%c",s[i][j]);
        }
      printf("\n");}
    return 0;
}


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

void solve() {
    int h, w; cin >> h >> w;
    pair<int, int> src = {0, 0};
    pair<int, int> dest = {0, 0};
    cin >> src.first >> src.second >> dest.first >> dest.second;
    src.first = src.first - 1;
    src.second = src.second - 1;
    dest.first = dest.first - 1;
    dest.second = dest.second - 1;
    vector<vector<int>> arr(h, vector<int>(w));
    for(int i = 0; i < h; i ++) 
        for(int j = 0; j < w; j ++) {
            char ch; cin >> ch;
            arr[i][j] = ch == '.';
        }
    vector<vector<bool>> visited(h, vector<bool>(w, 0));
    vector<vector<int>> dist(h, vector<int>(w, 1e9));    
    set<pair<int, pair<int, int>>> pq;
    pq.insert({0, src});
    dist[src.first][src.second] = 0;
    visited[src.first][src.second] = 1;
    auto can = [&](int i, int j, int d) {
        if(i >= 0 && j >= 0 && i < h && j < w && arr[i][j] == 1) {
            if(visited[i][j] == 0) {
                return 1;
            }
            if(dist[i][j] > d) {
                return 1;
            }
            return 0;
        }
        return 0;
    };
    while(pq.size()) {
        auto v = *pq.begin();
        int x = v.second.first, y = v.second.second, d = v.first;
        pq.erase(pq.begin());
        if(can(x + 1, y, d)) {
            visited[x+1][y] = 1;
            dist[x + 1][y] = min(dist[x+1][y], d);
            pq.insert({d, {x+1, y}});
        }
        if (can(x - 1, y, d))
        {
            visited[x-1][y] = 1;
            dist[x - 1][y] = min(dist[x-1][y], d);
            pq.insert({d, {x - 1, y}});
        }
        if (can(x, y + 1, d))
        {
            visited[x][y+1] = 1;
            dist[x][y + 1] = min(dist[x][y+1], d);
            pq.insert({d, {x, y + 1}});
        }
        if (can(x, y - 1, d))
        {
            visited[x][y-1] = 1;
            dist[x][y-1] = min(dist[x][y-1], d);
            pq.insert({d, {x, y - 1}});
        }
        for(int i = x-2; i <= x + 2; i ++) {
            for(int j = y-2; j <= y + 2; j ++) {
                if(can(i, j, d + 1)) {
                    visited[i][j] = 1;
                    dist[i][j] = min(dist[i][j], d + 1);
                    pq.insert({d + 1, {i, j}});
                }
            }
        }
    }
    int ans = dist[dest.first][dest.second];
    cout << (ans == 1e9 ? -1 : ans) << endl;
}


int32_t main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    solve();
    return 0;
}

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

#define rep(i,N) for(int i=0;i<N;i++)
#define rep2(i,N) for(int i=1;i<=N;i++)
using namespace std;
long long  INF=1e18;
long long mod=1e9+7;

long long n,k,c;
string s;
vector<int>getWorkday_L(){
    int now=0;
    vector<int>ret;
    for(int i=0;i<n;i++){
        if(now<=0 && s[i]!='x'){
            ret.push_back(i+1);
            now=c;
        }
        else{
            now--;
        }
    }
    return ret;
}
vector<int>getWorkday_R(){
    int now=0;
    int num=k;
    vector<int>ret;
    for(int i=n-1;i>-1;i--){
        if(now<=0 && s[i]!='x'){
            ret.insert(ret.begin(),i+1);
            now=c;
        }
        else{
            now--;
        }
    }
    return ret;
}
//status unsolved
int main(){
    
    cin>>n>>k>>c;
    cin>>s;
    
    vector<int>w=getWorkday_L();
    vector<int>R=getWorkday_R();
    
    if(w.size()>k){
        return 0;
    }
    else{
        
        rep(i,w.size()){
            if(R[i]==w[i]){
                cout<<R[i]<<endl;
            }
        }

    }
    return 0;

}
/*


*/


Measured memory_bytes: 5616
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) for(int i=0;i < (n);i++)
#define ALL(obj) (obj).begin(),(obj).end()
#define SCANF(i) int i;scanf("%d",&i)
typedef long long ll;
using namespace std;
using P = pair<int,int>;
const long long INF = 1LL << 60;
const int IINF=100000000;
const int MOD = (int)1e9 + 7;
//約数列挙
vector<long long> divisor(long long n) {
    vector<long long> ret;
    for (long long i = 1; i * i <= n; i++) {
        if (n % i == 0) {
            ret.push_back(i);
            if (i * i != n) ret.push_back(n / i);
        }
    }
    //sort(ret.begin(), ret.end()); // 昇順に並べる
    return ret;
}
vector<int> dx={1,0,-1,0};vector<int> dy={0,-1,0,1};

signed main () {
    int n;cin >> n;
    int ans=n % 1000;
    if(ans!=0)ans = 1000-ans;
    cout << ans << endl;
}

Measured memory_bytes: 3612
//#include<bits/stdc++.h>
#include<iostream>
#include<cmath>
#include<cstdio>
#include<vector>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<utility>
#include<algorithm>
#include<cstring>
#include<sstream>
#include <iomanip>

using namespace std;

typedef long long ll ;
typedef double db;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef vector< pair<int,int> > vii;
const double pi = 2*acos(0) ;

#define pf		  	printf
#define sf			  scanf
#define pb(a)         push_back(a)
#define mp			make_pair
#define fi			 first
#define se			 second
#define for0(i,n)        for(int i=0;i<n;i++)
#define for1(i,n)        for(int i=1;i<=n;i++)
#define forab(i,a,b)       for(int i=a;i<=b;i++)
#define lcm(a, b)     ((a)*((b)/gcd(a,b)))
#define sq(a)		   (a)*(a)
#define nw				"\n"
#define abs(x)		fabs(x)
#define pcase(z,x)    cout<<"Case "<<z<<": "<<x<<"\n"
ll max_div(ll n){
	ll ans;
	for(ll i=1 ; i*i<=n ; i++){
		if(n%i==0) ans=i;
		}
	return ans;
	}
int main()
{
	ll n,x,a;
	cin>>n;
	x = max_div(n);
	a = n/x;
	//cout<<x<<" "<<a<<nw;
	if(x==1) x=a;
	x = log10(x) + 1;
	a = log10(a) + 1;
	ll ans=max(x,a);
	cout<<ans<<nw;
	return 0;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
#define title "title"
#define ll long long
#define ull unsigned ll
#define fix(x) fixed<<setprecision(x)
using namespace std;
void Freopen(){
	freopen(title".in","r",stdin);
	freopen(title".out","w",stdout);
}
ll read(){
	ll g=0,f=1;
	char ch=getchar();
	while(ch<'0'||'9'<ch){if(ch=='-')f=-1;ch=getchar();}
	while('0'<=ch&&ch<='9'){g=g*10+ch-'0';ch=getchar();}
	return g*f;
}
const ll N=3e5+5;
ll n,L,x[N],t[N],lc[N],rc[N],del[N],ans,su,top,pos;
signed main(){
	n=read(),L=read(),ans=n+1;pos=n;
	for(ll i=1;i<=n;i++)x[i]=read();
	for(ll i=1;i<=n;i++)t[i]=read();
	for(ll i=1;i<=n;i++)ans+=(t[i]/(L<<1)),t[i]%=(L<<1);
	for(ll i=1;i<=n;i++){
		if(!t[i])ans--,del[i]=1;
		else lc[i]=(2*(L-x[i])>=t[i]),rc[i]=(2*x[i]>=t[i]),del[i]=!(lc[i]|rc[i]);
	}ans-=lc[n];
	for(ll i=1;i<n;i++){
		if(del[i])continue;
		if(!lc[i]){pos=i;break;}
		rc[i]?++top:(top?--top,--ans:0);
	}su=top,top=0;
	for(ll i=n-1;i>=pos;i--){
		if(del[i])continue;
		if(!rc[i])break;
		lc[i]?++top:(top?--top,--ans:0);
	}return cout<<(L<<1)*(ans-(su+top>>1)),signed();
}

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

using namespace std;

int main() {
    int N,M; cin>>N>>M;
    vector<int> Xn(M);
    for (int i=0;i<M;i++) cin>>Xn[i];
    
    if (N>=M) {
        cout << 0 << endl;
    } else {
        sort(Xn.begin(), Xn.end());

        priority_queue<int> unvisited;
        for (int i=0;i<M-1;i++) {
            unvisited.push(abs(Xn[i+1] - Xn[i]));
        }

        int sum=0;
        for (int i=0;i<N-1;i++) {
            sum += unvisited.top();
            unvisited.pop();
        }

        cout << Xn[M-1]-Xn[0]-sum << endl;
    }


    return 0;
}

Measured memory_bytes: 1276
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
#include <array>
#include <functional>
using namespace std;
 
#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()
 
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<double> VD;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef vector<VD> VVD;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

template<typename T> void chmin(T &a, T b) { if (a > b) a = b; }
template<typename T> void chmax(T &a, T b) { if (a < b) a = b; }

int in() { int x; scanf("%d", &x); return x; }
ll lin() { ll x; scanf("%lld", &x); return x; }

int main() {
    ll n;
    cin >> n;
    ll ans = 1e18;
    for (ll x = 1; x * x <= n; x++){
        if (n % x) continue;
        ll y = n / x;
        chmin(ans, x + y - 2);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cfloat>
#include <climits>
#include <cmath>
#include <cstdio>
#include <deque>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_set>
#include <vector>
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int, int>> vpii;
typedef vector<pair<ll, ll>> vpll;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<vc> vvc;
typedef vector<vs> vvs;
typedef vector<vll> vvll;
typedef map<int, int> mii;
typedef set<int> si;
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = 1; i <= (n); ++i)
#define arep(i, v) for (auto i : v)
#define irep(it, stl) for (auto it = stl.begin(); it != stl.end(); it++)
#define drep(i, n) for (int i = (n)-1; i >= 0; --i)
#define fin(ans) cout << (ans) << '\n'
#define STLL(s) strtoll(s.c_str(), NULL, 10)
#define mp(p, q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define Sort(a) sort(a.begin(), a.end())
#define Rort(a) sort(a.rbegin(), a.rend())
#define MATHPI acos(-1)
#define fi first
#define se second
#include <atcoder/all>
using namespace atcoder;
constexpr int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
constexpr int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
template <class T>
inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
inline void dump(T& v) {
    irep(i, v) { cout << (*i) << ((i == --v.end()) ? '\n' : ' '); }
}
template <class T, class U>
inline void dump(map<T, U>& v) {
    irep(i, v) { cout << i->first << " " << i->second << '\n'; }
}
inline string getline() {
    string s;
    getline(cin, s);
    return s;
}
inline void yn(const bool b) { b ? fin("yes") : fin("no"); }
inline void Yn(const bool b) { b ? fin("Yes") : fin("No"); }
inline void YN(const bool b) { b ? fin("YES") : fin("NO"); }
struct io {
    io() {
        ios::sync_with_stdio(false);
        cin.tie(0);
    }
};
const int INF = INT_MAX;
constexpr ll LLINF = 1LL << 61;
constexpr ll MOD = 1000000007;
constexpr ld EPS = 1e-11;

/* --------------------   ここまでテンプレ   -------------------- */

int main() {
    int n, q;
    cin >> n >> q;
    fenwick_tree<ll> fw(n);
    rep(i, n) {
        int a;
        cin >> a;
        fw.add(i, a);
    }
    rep(i, q) {
        int t, u, v;
        cin >> t >> u >> v;
        if (t) {
            cout << fw.sum(u,v) << endl;
        } else {
            fw.add(u,v);
        }
    }
}

Measured memory_bytes: 8220
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;

ull gcd(ull a, ull b){
  ull c;
  if (a < b) swap(a, b);
  
  while (b > 0) {
    c = a % b;
    a = b;
    b = c;
  }
  
 return a; 
}
int main(){
  ull a, b;
  cin >> a >> b;
  
  ull c = gcd(a, b);
  cout << a * b / c;
  
  return 0;
}


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

int main(void){
    int h,w;
    cin>>h>>w;
    string s[50];
    for(int i=0;i<h;i++) cin >> s[i];
    const int dx[8]={1,0,-1,0,1,-1,-1,1};
    const int dy[8]={0,1,0,-1,1,1,-1,-1};

    for(int i=0;i<h;i++){
        for(int j=0;j<w;j++){
            if(s[i][j]=='#') continue;
            int cnt=0;
            for(int d=0;d<8;d++){
                const int ni=i+dx[d];
                const int nj=j+dy[d];
                if(ni<0 or h<=ni) continue;
                if(nj<0 or w<=nj) continue;
                else{
                    if(s[ni][nj]=='#') cnt++;
                }
            }
            s[i][j]=char(cnt+'0');
        }
    }
    for(int i=0;i<h;i++) cout<<s[i]<<endl;
}

Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
using namespace std;
int a[1000001] = {0};
int main()
{
    int n;
    scanf("%d",&n);
    for(int i=0;i<n;i++)
        scanf("%d",&a[i]);
    sort(a,a+n);
    int count=0,sum=1;  //sum is same num
    int temp=a[0];
    for(int i=1;i<n;i++)
    {
        if(a[i]==temp){
            sum++;
            if(i==n-1){
                if(sum%2==0) break;
                else count++;
            }
        }
        else{
            if(sum%2==0){sum=1;}
            else{    //相同的为奇数
                count++;sum=1;
            }
            temp=a[i];
            if(i==n-1)  count++;
        }
    }
    if(n==1)    printf("1");
    else
        printf("%d",count);
    return 0;
}


Measured memory_bytes: 512
package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
)

type Runes []rune

func (s Runes) Less(i, j int) bool {
	return s[i] < s[j]
}

func (s Runes) Swap(i, j int) {
	s[i], s[j] = s[j], s[i]
}

func (s Runes) Len() int {
	return len(s)
}

func solve() {
	var n int
	fmt.Scan(&n)
	s := make([]string, n)
	sc := bufio.NewScanner(os.Stdin)
	for i := 1; sc.Scan(); i++ {
		s[i-1] = sc.Text()
	}

	strs := make([][]rune, n)
	for i, str := range s {
		strs[i] = []rune(str)
	}

	for i := 0; i < n; i++ {
		sort.Sort(Runes(strs[i]))
	}

	ss := make([]string, n)
	for i, str := range strs {
		ss[i] = string(str)
	}

	count := map[string]int64{}
	for _, str := range ss {
		count[str]++
	}

	var ans int64
	for _, value := range count {
		ans += value * (value - 1) / 2
	}

	fmt.Println(ans)
}

func main() {
	solve()
}


Measured memory_bytes: 20096
#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;
	cin >> n;
	vector<ll> a(n), b(n);
	rep(i,n){
		cin >> a[i];
	}
	ll cnt = 0;
	rep(i,n){
		cin >> b[i];
		if(a[i] <= b[i]) cnt += (b[i] - a[i]) / 2;
		else cnt -= a[i] - b[i];
	}
	cout << (cnt >= 0 ? "Yes" : "No") << endl;
	return 0;
}


Measured memory_bytes: 384
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
signed main() {
  ios::sync_with_stdio(false); cin.tie(0);
  int q;
  cin >> q;
  while (q--) {
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    int ans = 0;
    for (int i = a; i <= c; i++) {
      for (int j = b; j <= d; j++) {
        ans += i % 2 == 0 || j % 2;
        }
    }
    cout << ans << endl;
  }
  return 0;	
}


Measured memory_bytes: 3188
#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<string>
#include<iostream>
#include<cctype>
#include<cstdio>
#include<vector>
#include<stack>
#include<queue>
#include <algorithm>
#include<math.h>
#include<set>
#include<map>
#include<iomanip>

//#include<bits/stdc++.h>


using namespace std;

int y[100][100];

int main() {
	

	int a;
	int g = 1;
	while (1) {
		cin >> a;
		if (!a)break;
		int p = 2;
		int d = 2;
		y[0][0] = 1,y[0][1]=p;
		int r = 1, h = 0;
		while (p <= a*a) {
			if (d == 1) { if (r < a - 1)r++; else h++; d++; }
			else if (d == 2) { h++, r--; if (r == 0||h==a-1)d++; }
			else if (d == 3) { if (h < a - 1)h++; else r++; d++; }
			else if (d == 4) { h--, r++;; if (h == 0||r==a-1)d=1; }
			p++;
			y[h][r] = p;
		//	cout << h << r << endl;
		}
		cout << "Case " << g <<":"<< endl;
		for (int i = 0; i < a; i++) {
			for (int j = 0; j < a; j++) {
				cout << " ";
				if (y[i][j] < 10)cout << " ";
				cout << y[i][j];
			}
			cout << endl;
		}
		g++;
	}

	return 0;

}

Measured memory_bytes: 3088
#include<bits/stdc++.h>
#include <math.h>
#include <limits.h>

using namespace std;

#define rep(i,n) for(int i=0;i<(n);++i)
#define reps(i,n) for(int i=1;i<=(n);++i)
#define repr(i,n) for(int i=(n);i>=0;--i)
const long long INF = 1LL<<60;
const long long MOD = 1e9+7;
int gcd(int a,int b){if(b==0)return a;return gcd(b,a%b);}
int lcm(int a,int b){return a/gcd(a,b)*b;}
void Yes(){cout<<"Yes"<<endl;}
void No(){cout<<"No"<<endl;}
void YN(bool b){cout<<(b?"Yes":"No")<<endl;}

int n,q;
string s;
vector<char> spellC;
vector<int> spellD;

int isRemoved(int index){
  int q = spellC.size();
  rep(i,q){
    if(spellC[i]==s[index]){
      index += spellD[i];
    }
    if(index<0) return -1;
    if(index>=n) return 1;
  }
  return 0;
}

int main(void){
  long long int k,i,j;

  cin >> n >> q;
  cin >> s;
  spellC.resize(q);
  spellD.resize(q);
  rep(i,q){
    char d;
    cin >> spellC[i] >> d; 
    if(d=='L') spellD[i]=-1;
    else spellD[i]=1;
  }
  
  int left = 0;
  int right = n;
  while(right-left>1){
    int mid = (right+left)/2;
    if(isRemoved(mid)==-1)left=mid;
    else right=mid;
  }
  int mostLeft = right;
  left = 0;
  right = n;
  while(right-left>1){
    int mid = (right+left)/2; 
    if(isRemoved(mid)==1)right=mid;
    else left=mid;
  }
  int mostRight = left;

  cout << mostRight-mostLeft+1 << endl;
  
  return 0;
}




Measured memory_bytes: 1540
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <string>
#include <cmath>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <list>
#include <iostream>
#include <climits>
#include <cfloat>

using namespace std;


int main()
{
	char* dir = "><^v";
	int dx[] = { 1, -1, 0, 0 };
	int dy[] = { 0, 0, -1, 1 };

	while (true)
	{
		int H, W;
		scanf("%d %d", &H, &W);
		if (H == 0 && W == 0)
			break;

		char tile[128][128];
		for (int i = 0; i < H; ++i)
			scanf("%s", tile[i]);

		bool visit[128][128];
		for (int i = 0; i < H; ++i)
			for (int j = 0; j < W; ++j)
				visit[i][j] = false;

		int x, y;
		x = y = 0;
		while (true)
		{
			char c = tile[y][x];
			if (c == '.')
				break;
			else if(visit[y][x])
			{
				x = -1;
				break;
			}

			visit[y][x] = true;
			for (int i = 0; i < 4; ++i)
			{
				if (c == dir[i])
				{
					x += dx[i];
					y += dy[i];
					break;
				}
			}
		}
		if (x == -1)
			printf("LOOP\n");
		else
			printf("%d %d\n", x, y);
	}

	return 0;
}

Measured memory_bytes: 0
N = int(input())
D = list(map(int, input().split()))
M = int(input())
T = list(map(int, input().split()))
D.sort()
T.sort()
i = 0
j = 0
while True:
    if i >= len(T) or j >= len(D):
        break
    ans = 0
    while True:
        if j >= len(D):
            break
        if T[i] == D[j]:
            ans = 1
            j += 1
            break
        j += 1
    if ans == 0:
        break
    i += 1
            
if ans == 1:
    print("YES")
elif ans == 0:
    print("NO")

Measured memory_bytes: 35420