akhauriyash/Code-Regression huggingface dataset:
import java.util.*;
public class Main {
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String a = sc.next();
    String[] arr = a.split("");
    int s = 0;
    if(arr[0].equals("1")){ ++s; }
    if(arr[1].equals("1")){ ++s; }
    if(arr[2].equals("1")){ ++s; }
    System.out.println(s);
  }
}

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

int main(){
    int N;
    cin >> N;
    int arr[N];

    for (int i = 0; i < N; i++)
    {
        cin >> arr[i];
    }
    
    long long sum = 0;
    
    for (int i = 0; i < N - 1; i++)
    {
        if (arr[i] > arr[i + 1])
        {
            sum = sum + arr[i] - arr[i + 1];
            arr[i + 1] = arr[i];          
        }else
        {
            sum = sum;
        }
    }
    cout << sum; 
}


Measured memory_bytes: 4368
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n)     for(int i = 0; i < (int)(n); i++)
#define rep2(i, m, n) for(int i = m; i < (int)(n); i++)
#define MOD 1000000007
#define Graph vector<vector<int>>
#define lint int64_t

int main(){
  char C;
  cin >> C;
  
  if(C == 'z'){
    cout << "a" << endl;
  }else{
    C = C + 1;
    cout << C << endl;
  }

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define inf 0x3f3f3f3f
#define mod 1000000007
#define pb push_back
#define mp make_pair
#define ll long long
#define vi vector <int>
#define pii pair <int, int>
#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#define rep(i,n) for (int i = 0; i < (int) (n); ++ i)
#define foreach(it,c) for (__typeof(c.begin()) it = c.begin(); it != c.end(); ++ it)

inline int read() {
	int x = 0, f = 1, c = getchar();
	for (;!isdigit(c);c = getchar()) if (c == '-') f ^= 1;
	for (; isdigit(c);c = getchar()) x = x * 10 + c - '0';
	return f ? x : -x;
}

#define N 1<<20
int n, k;
int a[N];
set <int> st;
bool inc[N][20];

bool isINC(int l, int r) {
	rep(i, 20) if ((r - l) & 1<<i) {
		if (!inc[l][i] || (l + (1<<i) < r && a[l + (1<<i) - 1] > a[l + (1<<i)])) return 0; 
		l += 1<<i;
	}
	return 1;
}

int main() {
	n = read(), k = read();
	rep(i, n) a[i] = read();
	rep(i, n) inc[i][0] = 1;
	for (int j = 1; j < 20; ++ j) {
		rep(i, n) inc[i][j] = inc[i][j - 1] && inc[i + (1<<(j - 1))][j - 1] && (i + (1<<(j - 1)) >= n || a[i + (1<<(j - 1)) - 1] < a[i + (1<<(j - 1))]);
	}
	rep(i, k - 1) st.insert(a[i]);
	int ans = 0;
	bool hasINC = 0;
	for (int i = k - 1; i < n; ++ i) {
		++ ans;
		bool iisINC = isINC(i - k + 1, i + 1);
		if ((a[i] > *(st.rbegin()) && (i >= k && a[i - k] < *(st.begin()))) || (iisINC && hasINC)) -- ans;
		hasINC |= iisINC;
		st.erase(a[i - k + 1]);
		st.insert(a[i]);
	}
	printf("%d\n", ans);
	return 0;
}


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

// templates -------------------------------------

#define ULL unsigned long long
#define LL long long
#define LLD long long double
#define REP(i, n) for(LL i = 0; i < n; i++)
#define INV_REP(i, n) for(LL i = n; 0 <= i; i--)

LL combination(LL n, LL m)
{
  LL nume = 1;
  REP(i, m) nume *= (n-i);
  LL demo = 1;
  for(int i = 1; i <= m; i++) demo *= i;
  return nume / demo;
}

template<class T>
class UnionFind
{
private:
  vector<T> par;
  vector<T> rank;
  vector<T> size;

public:
  UnionFind(T N) :
    par(N, T()), rank(N, T()), size(N, T())
  {
    REP(i, N)
    {
      par[i] = i;
      rank[i] = 0;
      size[i] = 1;
    }
  }

  inline T root(T x)
  {
    return par[x] == x ? x : par[x] = root(par[x]);
  }

  inline bool same(T x, T y)
  {
    return root(x) == root(y);
  }

  inline T getSize(T x)
  {
    return size[root(x)];
  }

  void unite(T x, T y)
  {
    T r1 = root(x);
    T r2 = root(y);
    if(r1 == r2) return;

    if(rank[r1] < rank[r2]) swap(r1, r2);
    if(rank[r1] == rank[r2]) rank[r1]++;
    par[r2] = r1;
    size[r1] += size[r2];
  }
};

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

int a, b, t;

void input()
{
  cin >> a >> b >> t;
}

void solve()
{
  cout << int((float(t)+0.5) / a) * b << endl;
}

int main()
{
  input();
  solve();
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <utility>
#include <algorithm>
#include <cstdio>
#include <iomanip>
#include <queue>
#include <deque>
#include <stack>
#include <fstream>
#include <cmath>
#include <random>
#include <complex>
#include <functional>
#include <bitset>
#include <sstream>
#include <cassert>
#include <time.h>

#define ll int64_t
#define Rep(i, n) for (ll i = 0; i < n; i++)
using namespace std;
typedef vector<ll> vec;
typedef vector<vec> mat;

const ll inf = 1LL << 60;

template<class T> inline void chmin(T& a, T b) {
    if (a > b) {
        a = b;
    }
}
template<class T> inline void chmax(T& a, T b) {
    if (a < b) {
        a = b;
    }
}
void printvec (vec &v) {
    Rep (i, (ll)v.size()) {
        cout << v[i] << " \n"[i+1 == (ll)v.size()];
    }
}

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

    ll X, Y, N;
    cin >> X >> Y >> N;
    auto on_edge = [&] (ll x, ll y) -> bool {
        if (x == 0 or x == X or y == 0 or y == Y) return true;
        else return false;
    };
    auto encode = [&] (ll x, ll y) -> ll {
        if (x == 0) return y;
        else if (y == Y) return x+y;
        else if (x == X) return 2*Y+X-y;
        else return 2*Y+2*X-x;
    };
    set<pair<ll, ll>> points;

    Rep (i, N) {
        ll x1, y1, x2, y2;
        cin >> x1 >> y1 >> x2 >> y2;
        if (on_edge(x1, y1) and on_edge(x2, y2)) {
            points.insert({encode(x1, y1), i});
            points.insert({encode(x2, y2), i});
        }
    }

    stack<ll> st;
    for (auto e : points) {
        ll now = e.second;
        // cout << now << "\n";
        if (st.size() and st.top() == now) st.pop();
        else st.push(now);
    }

    while (st.size()) {
        ll now = st.top();
        st.pop();
        if (st.size() and st.top() == now) st.pop();
        else break;
    }

    if (st.empty()) cout << "YES\n";
    else cout << "NO\n";

}

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

int main() {
 string s;
  cin >> s;
  int answer=0;
  for(int i=0;i<s.size();i++){
    if(s.at(i)=='2'){
      answer++;
    }
  }
  cout << answer << endl;
}

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

const int MAXN=2005;

int n,m,Q;
int l[MAXN][MAXN],u[MAXN][MAXN],p[MAXN][MAXN];
char s[MAXN][MAXN];

int main(){
    scanf("%d%d%d",&n,&m,&Q);
    for(int i=1;i<=n;i++) scanf("%s",s[i]+1);
    for(int i=1;i<=n;i++)
        for(int j=1;j<=m;j++){
            l[i][j]=l[i-1][j]+l[i][j-1]-l[i-1][j-1];
            u[i][j]=u[i-1][j]+u[i][j-1]-u[i-1][j-1];
            p[i][j]=p[i-1][j]+p[i][j-1]-p[i-1][j-1];
            if(s[i][j]=='0') continue;
            p[i][j]++;
            if(s[i][j-1]=='1') l[i][j]++;
            if(s[i-1][j]=='1') u[i][j]++;
        }
    while(Q--){
        int x1,y1,x2,y2;
        scanf("%d%d%d%d",&x1,&y1,&x2,&y2);
        int point=p[x2][y2]-p[x1-1][y2]-p[x2][y1-1]+p[x1-1][y1-1];
        int edge=l[x2][y2]-l[x1-1][y2]-l[x2][y1]+l[x1-1][y1];
        edge+=u[x2][y2]-u[x1][y2]-u[x2][y1-1]+u[x1][y1-1];
        printf("%d\n",point-edge);
    }
}


Measured memory_bytes: 52736
import bisect
a, b, q = map(int, input().split())
inf = 10**18
lst1 = [-inf] + [(int(input())) for i in range(a)] + [inf]
lst2 = [-inf] + [(int(input())) for i in range(b)] + [inf]
left = 0
for i in range(q):
    x = int(input())
    j = bisect.bisect_right(lst1, x)
    k = bisect.bisect_right(lst2, x)
    res = inf
    for s in [lst1[j-1], lst1[j]]:
        for t in [lst2[k-1], lst2[k]]:
            ans1 = abs(x-s) + abs(s-t)
            ans2 = abs(x-t) + abs(t-s)
            res = min(res, ans1, ans2)
    print(res)

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

#define rep(i,s,n) for (int i = (int)s; i < (int)n; i++)
#define ll long long
#define pb push_back
#define eb emplace_back
#define All(x) x.begin(), x.end()
#define Range(x, i, j) x.begin() + i, x.begin() + j
#define lbidx(x, y) lower_bound(x.begin(), x.end(), y) - x.begin()
#define ubidx(x, y) upper_bound(x.begin(), x.end(), y) - x.begin()
#define llbidx(x, y, z) lower_bound(x.begin(), x.end(), z) - lower_bound(x.begin(), x.end(), y) // 二要素間の距離
#define deg2rad(deg) ((((double)deg)/((double)360)*2*M_PI))
#define rad2deg(rad) ((((double)rad)/(double)2/M_PI)*(double)360)
#define Find(set, element) set.find(element) != set.end()
#define Decimal(x) printf("%.10f\n", x) // 小数点を10桁まで表示
// debug用
#define PrintVec(x) for (auto elementPrintVec: x) { cout << elementPrintVec << " "; } cout << endl;

typedef pair<int, int> PI;
typedef pair<ll, ll> PLL;

int POWINT(int x, int n) {
  int ret = 1;
  rep(i, 0, n) ret *= x;
  return ret;
};

ll POWLL(int x, int n) {
  ll ret = 1;
  rep(i, 0, n) ret *= x;
  return ret;
};

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

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

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int sx, sy, tx, ty;
  cin >> sx >> sy >> tx >> ty;
  tx -= sx;
  ty -= sy;
  sx = sy = 0;
  string ans = "";

  // 1順目
  rep(i, 0, tx) {
    ans += 'R';
  }
  rep(i, 0, ty) {
    ans += 'U';
  }
  rep(i, 0, tx) {
    ans += 'L';
  }
  rep(i, 0, ty) {
    ans += 'D';
  }

  // 2順目
  ans += 'D';
  rep(i, 0, tx+1) {
    ans += 'R';
  }
  rep(i, 0, ty+1) {
    ans += 'U';
  }
  ans += 'L';
  ans += 'U';
  rep(i, 0, tx+1) {
    ans += 'L';
  }
  rep(i, 0, ty+1) {
    ans += 'D';
  }
  ans += 'R';

  cout << ans << endl;


  return 0;
};


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

#define vec                vector<int>
#define vecll              vector<ll>
#define vecd               vector<double>
#define vecst              vector<string>
#define vecb               vector<bool>
#define vec2(var, n, m)    vector<vector<int>> var(n, vector<int>(m, 0))
#define vecll2(var, n, m)  vector<vector<ll>> var(n, vector<ll>(m, 0))

#define rep(i,n)         for(ll i=(ll)0; i<(ll)n; i++)
#define REP(i,m,n)       for(ll i=(ll)m; i<(ll)n; i++)
#define arr(var, n)      vec var(n); rep(i,n){cin >> var[i];}
#define arrll(var, n)    vecll var(n); rep(i,n){cin >> var[i];}
#define arrst(var, n)    vecst var(n); rep(i,n){cin >> var[i];}
#define all(var)         (var).begin(), (var).end()
#define sortall(var)     sort(all(var))
#define uniqueall(v)     v.erase(unique(v.begin(), v.end()), v.end());
#define f_sum(var)       accumulate(all(var), 0)
#define f_sumll(var)     accumulate(all(var), 0LL)
#define chmin(v1, v2)    v1 = min(v1, v2)
#define chmax(v1, v2)    v1 = max(v1, v2)
#define pb(var)          push_back(var)
#define prt(var)         cout << (var) << "\n"
#define prtd(n, var)     cout << fixed << setprecision(n) << (var) << "\n"
#define prtfill(n, var)  cout << setw(n) << setfill('0') << (var);
#define prt2(v1, v2)     cout << (v1) << " " << (v2) << "\n"
#define prt3(v1, v2, v3) cout << (v1) << " " << (v2) << " " << (v3) << "\n"
#define prtall(v)        rep(i,v.size()){cout<<v[i]<<(i!=v.size()-1?" ":"\n");}
void prtok(bool ok){prt(ok ? "YES" : "NO");}
//----------------------------------------------------------------

int main(void) {
  int n, k;
  cin >> n >> k;
  arr(a,n);

  rep(_,min(k, 200)){
    vecll imosu(n+2, 0);
    REP(i,1,n+1){
      if(i - (a[i-1])<1){
        imosu[1] += 1;
      } else {
        imosu[i-(a[i-1])] += 1;
      }
      if(i + (a[i-1])+1>n+1){
        imosu[n+1] -= 1;
      } else {
        imosu[i+(a[i-1])+1] -= 1;
      }
    }
    vecll sum(n+1, 0);
    rep(i,n){
      sum[i+1] = sum[i] + imosu[i+1];
    }
    rep(i,n){
      a[i] = sum[i+1];
    }
  }

  prtall(a);
}


Measured memory_bytes: 7200
#include <iostream>	
#include <vector>
#include <climits>
#include <cstdio>

struct Edge {
	int s;
	int t;
	int c;
	Edge() {}
	Edge(int s, int t, int c) : s(s), t(t), c(c) {}
};
bool operator < (const Edge& e, const Edge& f) { return e.c < f.c; }


int main()
{
	int n, m;
	std::cin >> n >> m;
	//std::cout << n << " " << m << std::endl;
	std::vector<Edge> edge_list;
	
	for (int i=0; i<m; i++) {
		int a, b, c, d;
		scanf("%d,%d,%d,%d", &a, &b, &c, &d);
		//std::cout << a << " " << b << " " << c << " " << d <<std::endl;
		edge_list.push_back( Edge(a,b,c) );
		edge_list.push_back( Edge(b,a,d) );
	}
	
	int* distance = new int[n+1];
	
	int S, G, V, P;
	scanf("%d,%d,%d,%d", &S, &G, &V, &P);
	
	int res = 0;
	
	//std::cout << S << " " << G << std::endl;
	
	for (int i=1; i<=n; i++) distance[i] = INT_MAX;
	distance[S] = 0;
	for (int i=0; i<n; i++) {
		for (int j=0; j<2*m; j++) {
			int s = edge_list[j].s;
			int t = edge_list[j].t;
			int c = edge_list[j].c;
			if (distance[s] < distance[t] - c) distance[t] = distance[s] + c;
		}
	}
	res += distance[G];
	
	//for (int i=1; i<=n; i++) {
	//	std::cout << i << " : " << distance[i] << std::endl;
	//}
	
	for (int i=1; i<=n; i++) distance[i] = INT_MAX;
	distance[G]  = 0;
	for (int i=0; i<n-1; i++) {
		for (int j=0; j<2*m; j++) {
			int s = edge_list[j].s;
			int t = edge_list[j].t;
			int c = edge_list[j].c;
			if (distance[s] < distance[t] - c) distance[t] = distance[s] + c;
		}
	}
	res += distance[S];
	
	std::cout << V - P - res << std::endl;
	
	delete[] distance;
	
	return 0;
}
	



Measured memory_bytes: 3144
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0; i < n; i++)
int main() {
  int n;
  cin >> n;
  vector<int> ans(n+1);
  for (int x = 1; x <= 100; x++) {
    for (int y = 1; y <= 100; y++) {
      for (int z = 1; z <= 100; z++) {
        int s = x*x + y*y + z*z + x*y + y*z + z*x;
        if (s > n) continue;
        ans[s]++;
      }
    }
  }
  for (int i = 1; i <= n; i++) {
    cout << ans[i] << endl;
  }
}
      

Measured memory_bytes: 3624
#include "bits/stdc++.h"

using namespace std;

#define rep(i,a,b) for(int i=(a), i##_len=(b);i<i##_len;i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)

//#define int long long
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair

typedef long long ll;
//typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<double, double> pdd;
typedef vector<vector<int>> mat;
typedef unsigned int uint;

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

const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;

int a[3];

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

	int n;
	cin >> n;
	rep(i, 0, n)cin >> a[i];
	sort(a, a + n);
	int t = a[0];

	rep(i, 1, t + 1)
	{
		bool flag = true;
		rep(j, 0, n)
		{
			if (a[j] % i != 0)
			{
				flag = false;
			}
		}
		if (flag)
		{
			cout << i << endl;
		}
	}

	return 0;
}


Measured memory_bytes: 3152
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
#define all(v) (v).begin(), (v).end()

const ll m = 1000000000000000000;
#define debug(x) cout<<#x<<" = "<<(x)<<endl

#define debug2(x,y) cout<<"("<<#x<<","<<#y<<") = ("<<(x)<<","<<(y)<<")\n"

int main(){
  int N;cin>>N;
  ll ans = 1;
  vector<ll> A(N);
  vector<double> B(N);
  for(int i=0; i<N; i++){
    cin>>A[i];
    B[i] = log10(A[i]);
  }
  if(find(all(A), 0) != A.end()){
    cout<<0<<endl;
    return 0;
  }
  double logans = 0;
  for(int i=0; i<N; i++){
    ans *= A[i];
    logans += B[i];
  }
  if(logans > 18){
    //cout<<"logans"<<endl;
    cout<<-1<<endl;
    return 0;
  }
  if(ans > m){
    cout<<-1<<endl;
    return 0;
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 4760
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>

using namespace std;
#define MAXN 300
#define E2 500000004ll
#define MOD 1000000007
#define rint register int
#define gc() getchar()
inline int read(rint ans = 0, rint sgn = ' ', rint ch = gc())
{
	for(; ch < '0' || ch > '9'; sgn = ch, ch = gc());
	for(; ch >='0' && ch <='9';(ans*=10)+=ch-'0', ch = gc());
	return sgn-'-'?ans:-ans;
}
#define BUF_SIZE 1000000
#define _END fwrite(_Ob,1,_O-_Ob,stdout), _O = _Ob
#define Outc(a) (*_O++ = a)
char _Ob[BUF_SIZE+5], *_O = _Ob, _Os[25], *_Ot;
template <typename T> inline void Out(T x)
{
	if(!x){Outc('0'); return;} if(x < 0) Outc('-'), x = -x;
	for(_Ot = _Os; x; *_Ot++ = x%10+'0', x /= 10);
	for(; _Ot != _Os; Outc(*--_Ot)); if(_O-_Ob >= BUF_SIZE-50) _END;
}
int f[305][305][605], d[305], fac[605], efac[605], n, N, ans; bool flag = true;
inline int fastpow(int s, int n){int a = 1; for(; n; n&1 ? a = 1ll*a*s%MOD : 0, s = 1ll*s*s%MOD, n >>= 1); return a;}
int main()
{
	n = read(), N = n<<1; for(rint i = 1; i <= n; flag &= (d[i++]=read())==2);
	fac[0] = 1; for(rint i = 1; i <= N; fac[i] = 1ll*i*fac[i-1]%MOD, i++);
	efac[N] = fastpow(fac[N],MOD-2); for(rint i = N; i; efac[i-1] = 1ll*i*efac[i]%MOD, i--); f[0][0][0] = 1;
	for(rint i = 1, j, k; i <= n; i++)
		for(j = 0; j <= i; j++)
			for(k = 0; k <= N; k++)
				f[i][j][k] = f[i-1][j][k], j&&d[i]>=2&&k>=d[i]-2 ? f[i][j][k] = (f[i][j][k]+1ll*(d[i]-1ll)*f[i-1][j-1][k-(d[i]-2)])%MOD : 0;
	for(rint j = 3, k; j < n; j++)
		for(k = 1; k <= N; ans = (ans+1ll*fac[n-j-1]*fac[j-1]%MOD*k%MOD*f[n][j][k])%MOD, k++);
	for(rint i = 1; i <= n; ans = 1ll*ans*efac[d[i]-1]%MOD, i++); ans = E2*ans%MOD, flag ? ans = (ans+E2*fac[n-1])%MOD : 0, printf("%d\n",ans); return 0;
}

Measured memory_bytes: 215296
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
#define ALL(x) (x).begin(), (x).end()
#define REP(i ,n) for(int i = 0; i < (int)(n); i++)
#define pb push_back
typedef vector<int>vint;
typedef vector<ll>vll;
template<typename T> istream &operator>>(istream &is, vector<T> &vec){ for (auto &v : vec) is >> v; return is; }
template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}
int main()
{
    ll N;
    cin >> N;
    ll sum=0;
    REP(i,N)sum+=i;
    cout <<sum<<endl;
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
using ll = long long;
using pii = pair<int,int>;
using vi = vector<int>;
using vs = vector<string>;
using vll = vector<long long>;
using vpii = vector<pair<int,int>>;
using vivi = vector<vector<int>>;
const int dx[4] = {1,0,-1,0};
const int dy[4] = {0,1,0,-1};
const int mod = 10000007;



int main(void) {
  string s;
  cin >> s;
  bool ok = true;
  rep(i,s.size()-1){
    if(s[i]==s[i+1]) ok = false;
  }
  if(ok) cout << "Good" << endl;
  else cout << "Bad" << endl;
}


Measured memory_bytes: 256
N = int(input())
a = [[0 for j in range(19)] for i in range(19)]
ans=0
for _ in range(N):
    A=input()
    if A.find('.') > 0:
        count2 = 10 - len(A) + A.find('.')
        count5 = 10 - len(A) + A.find('.')
    else:
        count2 = 9
        count5 = 9
    tmp = int(A.replace('.', ''))
    while count2 < 18:
        if tmp % 2 == 0:
            count2 += 1
            tmp //= 2
        else:
            break
    while count5 < 18:
        if tmp % 5 == 0:
            count5 += 1
            tmp //= 5
        else:
            break
    for i in range(18-count2,19):
        for j in range(18-count5,19):
            ans += a[i][j]
    a[count2][count5] += 1
print(ans)


Measured memory_bytes: 77088
#include<iostream>
#include<vector>
#include<algorithm>
#include<functional>
#include<queue>
#include<stdio.h>
using namespace std;
typedef long long ll;
#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
ll n, a1goukei = 0, a3goukei = 0, a2goukei = 0;
priority_queue<int, vector<int>, greater<int>> a1, a1c;
vector <ll>  a2;
ll a2left[100001], a2right[100001], a1wa[100001], a3wa[100001], ruisekiwa1[100001], ruisekiwa2[100001];
ll a1max = -993193111451419810, a3max = 1145141919810931931, wa1 = 0, wa2 = 0;
priority_queue<ll>a3, a3c;//小さいものを取り出す
int main() {
	cin >> n;
	REP(i, n) {
		ll gomi; cin >> gomi;//代入な
		a1.push(gomi);
		a1wa[i] = gomi;
		wa1 += gomi;//左側すべての和を計算するぞい
	}
	REP(i, n) {
		ll gomi; cin >> gomi;
		a2.push_back(gomi);//代入な
	}
	REP(k, n) {
		ll gomi; cin >> gomi;
		a3.push(gomi);
		a3wa[k] = gomi; wa2 += gomi;//同じだよ
	}			
	ruisekiwa1[0] = wa1;
	REP(i, n) {//累積和でガンガン押します
		a1.push(a2[i]);//a1の方なので、最初から最後に向けて累積和
		ll top1 = a1.top(); a1.pop();//なるべく小さくするぞい
		ruisekiwa1[i + 1] = ruisekiwa1[i] + a2[i] - top1;
	}			
	ruisekiwa2[n] = wa2;
	for (ll i = n - 1; i >= 0; i--)
	{
			a3.push(a2[i]);//今度は逆に累積和
			ll top3 = a3.top();	a3.pop();
			ruisekiwa2[i] = ruisekiwa2[i + 1] - top3 + a2[i];
	}
	for (ll i = 0; i <= n; i++)
	{
		a1max = max(a1max, ruisekiwa1[i] - ruisekiwa2[i]);//最大値をとるよ
	}
	cout << a1max << endl;//はいWA
	return 0;
}

Measured memory_bytes: 6388
#include <iostream>
#include <sstream>
#include <string>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cassert>

using namespace std;

#define FOR(i,k,n) for(int i=(k); i<(int)n; ++i)
#define REP(i,n) FOR(i,0,n)
#define FORIT(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)

template<class T> void debug(T begin, T end){ for(T i = begin; i != end; ++i) cout<<*i<<" "; cout<<endl; }

typedef long long ll;
const int INF = 100000000;
const double EPS = 1e-8;
const int MOD = 1000000007;
inline int move_x(int x, int y, int r){
  if(y % 2 == 0){
    int dx[6] = {-1, 0, 1, 1, 1, 0};
    return x + dx[r];
  }else{
    int dx[6] = {-1, -1, 0, 1, 0, -1};
    return x + dx[r];
  }
}
inline int move_y(int x, int y, int r){
  int dy[6] = {0, 1, 1, 0, -1, -1};
  return y + dy[r];
}

int main(){
  int W, H;
  while(cin>>W>>H && W){
    int grid[100][100] = {};
    REP(y, H)REP(x, W) scanf("%d", &grid[y][x]);
    bool searched[100][100] = {};
    bool env[100][100] = {};
    REP(sy, H)REP(sx, W)if(!searched[sy][sx] && grid[sy][sx] == 0){
      queue<int> qx, qy;
      vector<int> vx, vy;
      qx.push(sx); qy.push(sy);
      searched[sy][sx] = true;
      bool is_env = false;
      while(!qx.empty()){
        int x = qx.front(), y = qy.front();
        qx.pop(); qy.pop();
        vx.push_back(x), vy.push_back(y);
        if(x == 0 || x == W - 1 || y == 0 || y == H - 1) is_env = true;
        REP(r, 6){
          int nx = move_x(x, y, r);
          int ny = move_y(x, y, r);
          if(nx >= 0 && nx < W && ny >= 0 && ny < H && grid[ny][nx] == 0 && !searched[ny][nx]){
            searched[ny][nx] = true;
            qx.push(nx); qy.push(ny);
          }
        }
      }
      if(is_env){
        REP(i, vx.size()) env[vy[i]][vx[i]] = true;
      }
    }
    int ans = 0;
    REP(y, H)REP(x, W)if(grid[y][x]){
      REP(r, 6){
        int nx = move_x(x, y, r);
        int ny = move_y(x, y, r);
        if(!(nx >= 0 && nx < W && ny >= 0 && ny < H) || (env[ny][nx])){
          ans++;
        }
      }
    }
    cout<<ans<<endl;
  }
  return 0;
}

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

int dp[101][4][4][4];

int main() {
    int N;
    cin>>N;
    
    dp[0][3][3][3]=1;
    
    for(int len=0;len<N;len++){
        for(int c1=0;c1<4;c1++){
            for(int c2=0;c2<4;c2++){
                for(int c3=0;c3<4;c3++){
                    if(dp[len][c1][c2][c3]==0) continue;
                    
                    for(int a=0;a<4;a++){
                        if(a==2&&c1==1&&c2==0) continue;
                        if(a==2&&c1==0&&c2==1) continue;
                        if(a==1&&c1==2&&c2==0) continue;
                        if(a==2&&c1==1&&c3==0) continue;
                        if(a==2&&c2==1&&c3==0) continue;
                        
                        dp[len+1][a][c1][c2]+=dp[len][c1][c2][c3];
                        dp[len+1][a][c1][c2]%=mod;
                    }
                }
            }
        }
    }
    int ans=0;
    for(int c1=0;c1<4;c1++){
            for(int c2=0;c2<4;c2++){
                for(int c3=0;c3<4;c3++){
                    ans+=dp[N][c1][c2][c3];
                    ans%=mod;
                }
            }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>

using namespace std;

//vector string deque break continue
#define forn(i, s, f) for (int i = (int)s; i < (int)f; i++)
#define ll long long
#define ull unsigned long long
#define ld long double
#define pii pair <int, int>
#define fs first
#define sc second
#define pf push_front
#define pb push_back
#define pop_f pop_front
#define pop_b pop_back
#define eb emplace_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x).size()

template <typename T> istream& operator>>(istream& in, vector <T>& a) {for (auto& i : a) in >> i; return in;}
template <typename T> ostream& operator<<(ostream& out, vector <T>& a)  {for (auto& i : a) out << i << " "; return out;}
template <typename T, typename U> void chkmin(T& a, U b) {if (a > b) a = b;}
template <typename T, typename U> void chkmax(T& a, U b) {if (a < b) a = b;}

int main() {
    ios_base::sync_with_stdio(0), cin.tie(0);
    string s, t;
    cin >> s >> t;
    t.pop_back();
    if (t == s)
        cout << "Yes";
    else
        cout << "No";
    return 0;
}

Measured memory_bytes: 3640
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>
 
using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef long double ld;
#define int ll
#define pb push_back
#define pii pair<int,int>
#define ff first
#define ss second
const int MOD = 1e9+7;
typedef tree< int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
int n,k;
int getf(int l){
	return (((l-1)*l)/2)%MOD;
}

int getl(int l){
	int t = n*l - ((l-1)*l)/2;
	return t%MOD;
}

signed main(){

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




	cin>>n>>k;
	if (k==n+1){
		cout<<1;
		return 0;
	}

	int su = 0;
	for(int i=k;i<=n+1;i++){

		su += (getl(i) - getf(i) + 1 + MOD)%MOD;
		su %= MOD;
		// cout<<su<<"\n";
	}
	cout<<su;
	return 0;
}

Measured memory_bytes: 3652
N, K = map(int, input().split())

MAX = 4 * 10 ** 5 + 1
MOD = 10 ** 9 + 7

# Factorial
fac = [0] * (MAX + 1)
fac[0] = 1
fac[1] = 1

# Inverse
inv = [0] * (MAX + 1)
inv[1] = 1

# Inverse factorial
finv = [0] * (MAX + 1)
finv[0] = 1
finv[1] = 1

for i in range(2, MAX + 1):
    fac[i] = fac[i - 1] * i % MOD
    inv[i] = MOD - inv[MOD % i] * (MOD // i) % MOD
    finv[i] = finv[i - 1] * inv[i] % MOD


def comb(n, k):
    if n < k or k < 0:
        return 0
    return (fac[n] * finv[k] * finv[n - k]) % MOD


if N - 1 <= K:
    print(comb(2 * N - 1, N - 1))
else:
    # zero: 0 ~ K
    ans = 0
    for n in range(K + 1):
        ans += comb(N, n) * comb(N - 1, N - n - 1)
        ans %= MOD
    print(ans)


Measured memory_bytes: 85648
#include <bits/stdc++.h>
#define int int64_t
#define REP(i, n) for (int i = 0; (i) < (int)(n); ++ (i))
#define REP3(i, m, n) for (int i = (m); (i) < (int)(n); ++ (i))
#define REP_R(i, n) for (int i = (int)(n) - 1; (i) >= 0; -- (i))
#define REP3R(i, m, n) for (int i = (int)(n) - 1; (i) >= (int)(m); -- (i))
#define REPP(i, n) for (int i = 1; (i) < (int)(n+1); ++ (i))
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define FORP(i, m, n) for(int i = m; i < n+1; i++)
#define FORR(i, a, b) for(int i=(b)-1; i>=(a); i--)
#define ALL(v) v.begin(), v.end()
#define SZ(a) int((a).size())
#define SORT(c) sort((c).begin(),(c).end())
#define SORTR(c) sort((c).begin(),(c).end(),greater<int>());
#define BIT(n) (1LL<<(n))
#define PCNT(x) __builtin_popcountll(x)
#define GCD(x,y) __gcd(x,y)
#define LCM(x,y) x/__gcd(x,y)*y
#define PB push_back
#define MP make_pair
#define endl "\n"
#define pa cout << ans << endl
#define p(x) cout << x << endl
#define pall(x) for(auto iter : x) p(iter)
#define yes cout << "Yes" << endl
#define no cout << "No" << endl
#define yn(x) cout << (x ? "Yes" : "No") << endl
using namespace std;
typedef long double LD;
typedef vector<int> VI;
typedef vector<vector<int> > VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef vector<PII> VPII;
using UnweightedGraph = vector<vector<int> >;
using WeightedGraph = vector<vector<pair<int, int> > >;
const int INF = 2000000000ll;
const long double PI = acosl(-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; }



int power(int a, int b) {return b?power(a*a,b/2)*(b%2?a:1):1;}
int perm(int N, int K){
    int x=1;
    for(int i=1;i<=K;i++)
    {
        x=x*(N-i+1);
    }
    return x;
}
int factorial(int N) {return perm(N,N);}
int comb(int N,int K) {return factorial(N)/factorial(K)/factorial(N-K);}
int hcomb(int N, int K) {return comb(N+K-1, N-1);}

int dtoi(double d) {return round(d);}

int isprime(int n) {
    if (n < 2) return 0;
    for (int i = 2; i*i <= n; ++i) {
        if (n % i ==  0) return 0;
    }
    return 1;
}

int mystoll(string S){
    int num = 0;
    for (int i = (int) S.length()-1; i >= 0; i--){
        num += (S[i]-'0') * power(10,S.length()-1-i);
    }
    return num;
}

template<class T>
int SUM(T a) {
    int sum = 0;
    for(auto iter : a) sum += iter;
    return sum;
}

void solve(string S);

signed main() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    cout << fixed << setprecision(10);
    string S;
    cin >> S;
    solve(S);
    return 0;
}

void solve(string S) {
    int ans = 0;
    if (S == "ABC") p("ARC");
    else p("ABC");
}

/*
cd ~/Desktop/Programming/AtCoder/contest/abc166/abc166_a && sh test.sh
cd ~/Desktop/Programming/AtCoder/contest/abc166/abc166_a && sh etest.sh
cd ~/Desktop/Programming/AtCoder/contest/abc166/abc166_a && sh submit.sh
*/


Measured memory_bytes: 3640
#include<bits/stdc++.h>
using namespace std;
#define inf INT_MAX
#define INF LLONG_MAX
#define ll long long
#define ull unsigned long long
#define M (int)(1e9+7)
#define P pair<int,int>
#define PLL pair<ll,ll>
#define FOR(i,m,n) for(int i=(int)m;i<(int)n;i++)
#define RFOR(i,m,n) for(int i=(int)m;i>=(int)n;i--)
#define rep(i,n) FOR(i,0,n)
#define rrep(i,n) RFOR(i,n,0)
#define all(a) a.begin(),a.end()
#define IN(a,n) rep(i,n){ cin>>a[i]; }
const int vx[4] = {0,1,0,-1};
const int vy[4] = {1,0,-1,0};
#define PI 3.14159265
#define F first
#define S second
#define PB push_back
#define EB emplace_back
#define int ll
#define vi vector<int>




template< typename Monoid >
struct segTree {
  using F = function< Monoid(Monoid, Monoid) >;

  int sz;
  vector< Monoid > seg;

  const F f;
  const Monoid M1;

  segTree(int n, const F f, const Monoid &M1) : f(f), M1(M1) {
    sz = 1;
    while(sz < n) sz <<= 1;
    seg.assign(2 * sz, M1);
  }

  void set(int k, const Monoid &x) {
    seg[k + sz] = x;
  }

  void build() {
    for(int k = sz - 1; k > 0; k--) {
      seg[k] = f(seg[2 * k + 0], seg[2 * k + 1]);
    }
  }

  void update(int k, const Monoid &x) {
    k += sz;
    seg[k] = x;
    while(k >>= 1) {
      seg[k] = f(seg[2 * k + 0], seg[2 * k + 1]);
    }
  }

  Monoid get(int a, int b) {
    Monoid L = M1, R = M1;
    for(a += sz, b += sz; a < b; a >>= 1, b >>= 1) {
      if(a & 1) L = f(L, seg[a++]);
      if(b & 1) R = f(seg[--b], R);
    }
    return f(L, R);
  }

  Monoid operator[](const int &k) const {
    return seg[k + sz];
  }
};

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

  int n;
  cin>>n;
  segTree<int> seg(n,[](int a,int b){return __gcd(a,b);},0);
  rep(i,n){
    int a;
    cin>>a;
    seg.update(i,a);
  }

  int ans=0;
  rep(i,n){
    //cout<<seg.get(0,i)<<' '<<seg.get(i+1,n)<<endl;
    ans=max(ans,__gcd(seg.get(0,i),seg.get(i+1,n)));
  }

  cout<<ans<<endl;


}

Measured memory_bytes: 2304
def resolve():
    n = int(input())
    hs = list(map(int, input().split()))
    current = 0
    maxcount = 0

    for i in range(1,n):
        if hs[i] <= hs[i-1]:
            current += 1
        else:
            maxcount = max(maxcount, current)
            current = 0

    print(max(maxcount, current))




resolve()

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

using namespace std;

int main() {
	int n;
	string s;

	cin >> n >> s;

	if (n % 2) {
		cout << "No\n";
		return 0;
	}

	for (int i = 0; i < n/2; i++) {
		if (s[i] != s[n/2 + i]) {
			cout << "No\n";
			return 0;
		}
	}

	cout << "Yes\n";

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <algorithm>
#include <string>
#include <cstring>
#include <unordered_map>
#include <unordered_set>
#include <tuple>
#include <vector>
#include <functional>
#include <cassert>
#include <cmath>
#include <map>
#include <set>
#include <queue>

using namespace std;

vector<int> H;
int N;
vector<int> cnt;

int main() {
	ios_base::sync_with_stdio(false);
	cin >> N;
	H.resize(N);
	cnt = vector<int>(N, 0);
	for (int i = 0; i < N; i++) {
		cin >> H[i];
	}
	int cur = 0;
	int ret = 0;
	for (int i = N - 2; i >= 0; i--) {
		if (H[i] >= H[i + 1]) {
			cur++;
		}
		else {
			cur = 0;
		}
		ret = max(ret, cur);
	}
	cout << ret << endl;
	return 0;
}

Measured memory_bytes: 1024
#include <stdio.h>
#include <math.h>

int mbk(long long a,int n,int m){return n?(mbk((a*a)%m,n/2,m)*(n%2?a:1))%m:1;}
int inv(int a,int m){return mbk((long long)a,m-2,m);}
int aCb(int a,int b,int m){
  long long s=1,i;
  if(b>a-b)b=a-b;
  for(i=0;i<b;i++)s=(((s*(a-i))%m)*inv(i+1,m))%m;  
  return (int)s;
}

int main(){
  long long int n,a,b;
  int mod=1000000000+7;
  scanf("%lld%lld%lld",&n,&a,&b);
  long long int ans = (mbk(2,n,mod)-1-aCb(n,a,mod)-aCb(n,b,mod))%mod;
  while(ans<0) ans+=mod;
  printf("%lld",ans);
  
  return 0;
}
  

Measured memory_bytes: 128
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ITP1_6A
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.ReadLine();
            string[] inString = Console.ReadLine().Split(' ');

            int count = inString.Count();
            for (int i = count - 1; i > 0; i--)
            {
                Console.Write(inString[i]);
                Console.Write(" ");
            }
            Console.Write(inString[0]);
            Console.Write("\n");
        }
    }
}

Measured memory_bytes: 9136
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String S1 = sc.next();
		String S2 = sc.next();
		String S3 = sc.next();
		char turn = 'a';
		int a = S1.length();
		int b = S2.length();
		int c = S3.length();
		int cnt1 = 0;
		int cnt2 = 0;
		int cnt3 = 0;
		while(true) {
			if(turn == 'a') {
				if(a == cnt1) {
					System.out.println("A");
					return;
				}
				cnt1++;
				turn = S1.charAt(cnt1 - 1);
			} else if(turn == 'b') {
				if(b == cnt2) {
					System.out.println("B");
					return;
				}
				cnt2++;
				turn = S2.charAt(cnt2 - 1);
			} else {
				if(c == cnt3) {
					System.out.println("C");
					return;
				}
				cnt3++;
				turn = S3.charAt(cnt3 - 1);
			}
		}
	}
}


Measured memory_bytes: 21716
#include<bits/stdc++.h>
#define mod 1000000007
#define maxn 4000000 
using namespace std;
int n,k;
int dp[2005][2005];
int fac[4000005],ifac[4000005];

int ksm(int x,int y){
	int res=1;
	while(y){
		if(y&1) res=1ll*res*x%mod;
		x=1ll*x*x%mod,y/=2;
	}
	return res;
}

int C(int x,int y){
	int res=1ll*fac[x]*ifac[y]%mod*ifac[x-y]%mod;
	return res;
}

int main(){
	scanf("%d %d",&n,&k);
	if(k==1){
		puts("1");return 0;
	}
	fac[0]=1;for(int i=1;i<=maxn;i++) fac[i]=1ll*i*fac[i-1]%mod;
	ifac[maxn]=ksm(fac[maxn],mod-2);
	for(int i=maxn-1;i>=0;i--) ifac[i]=1ll*(i+1)*ifac[i+1]%mod;
	dp[0][0]=1;
	for(int i=1;i<=n;i++){
		for(int j=0;j<=i;j++){
			dp[i][j]=dp[i-1][j];
			if(j){
				dp[i][j]+=1ll*dp[i][j-1]*(n-j+1)%mod*C(n*k-i-(j-1)*(k-1)-1,k-2)%mod;
				if(dp[i][j]>=mod) dp[i][j]-=mod;
			}
		}
	}
	printf("%d\n",dp[n][n]);
	
	return 0;
}

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

namespace AtCoder.Question
{
    public class QuestionC
    {
        public static void Main(string[] args)
        {
            var n = ReadValue<int>();
            var array = ReadValues<long>();
            long total = 0;
            long numberOfBranch = 1;
            long numberOfLeaves = array.Sum();
            for (int d = 0; d <= n; d++)
            {
                var leaves = array[d];
                long branch = d == 0 ? 1 : Math.Min(2 * numberOfBranch, numberOfLeaves);

                total += branch;

                numberOfBranch = branch - leaves;
                numberOfLeaves -= leaves;
                if (numberOfBranch < 0)
                {
                    Console.WriteLine("-1");
                    return;
                }
            }
            Console.WriteLine(total);
        }
        static T ReadValue<T>()
        {
            return (T)Convert.ChangeType(Console.ReadLine(), typeof(T));
        }
        static (T1, T2) ReadValue<T1, T2>()
        {
            var input = Console.ReadLine().Split(' ');
            return ((T1)Convert.ChangeType(input[0], typeof(T1)), (T2)Convert.ChangeType(input[1], typeof(T2)));
        }
        static (T1, T2, T3) ReadValue<T1, T2, T3>()
        {
            var input = Console.ReadLine().Split(' ');
            return ((T1)Convert.ChangeType(input[0], typeof(T1)), (T2)Convert.ChangeType(input[1], typeof(T2)), (T3)Convert.ChangeType(input[2], typeof(T3)));
        }
        static (T1, T2, T3, T4) ReadValue<T1, T2, T3, T4>()
        {
            var input = Console.ReadLine().Split(' ');
            return ((T1)Convert.ChangeType(input[0], typeof(T1)), (T2)Convert.ChangeType(input[1], typeof(T2)), (T3)Convert.ChangeType(input[2], typeof(T3)), (T4)Convert.ChangeType(input[3], typeof(T4)));
        }
        static T[] ReadValues<T>()
        {
            var input = Console.ReadLine().Split(' ');
            return input.Select(x => (T)Convert.ChangeType(x, typeof(T))).ToArray();
        }
    }
}


Measured memory_bytes: 38956
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
using Graph = vector<vector<int>>;
const int INT_INF = 1001001001;

int main(){
    int n;
    cin >> n;
    int ans = 0;
    for(int i=0;i<n;i++){
        int l,r;
        cin >> l >> r;
        ans += r-l+1;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include<string>
#include<math.h>
#include<vector>
#include<algorithm>
#include<array>
#include<functional>
#include<iomanip>
#include<ios>
using namespace std;
#define FOR(i,n) for(int (i)=0;(i)<(n);(i)++)
const long long int mod=1e9+7;
typedef long long ll;
int N,A,B,C;
ll gcd(ll a, ll b) {
  if(a < b) return gcd(b, a);
  ll r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
}

int dfs(vector<int> HowUse,vector<int> L){
    //cout<<"howuselen : "<< HowUse.size()<<endl;
    if(HowUse.size()==N){
        int lenA,lenB,lenC;
        int cost=0;
        lenA=lenB=lenC=0;
        
        FOR(i,N){
            if(HowUse[i]==1){
                lenA+=L[i];
                if(lenA!=L[i]){
                    cost+=10;
                }
            }else if(HowUse[i]==2){
                lenB+=L[i];
                if(lenB!=L[i]){
                    cost+=10;
                }
            }else if(HowUse[i]==3){
                lenC+=L[i];
                if(lenC!=L[i]){
                    cost+=10;
                }
            }
        }
        if(lenA==0 || lenB==0 || lenC==0){
            return INT32_MAX;
        }
        cost+=abs(lenA-A);
        cost+=abs(lenB-B);
        cost+=abs(lenC-C);    
        return cost;
    }
    vector<int> tmpA=HowUse;
    vector<int> tmpB=HowUse;
    vector<int> tmpC=HowUse;
    vector<int> tmpD=HowUse;
    tmpA.push_back(1);
    tmpB.push_back(2);
    tmpC.push_back(3);
    tmpD.push_back(0);
    int a=dfs(tmpA,L);
    int b=dfs(tmpB,L);
    int c=dfs(tmpC,L);
    int d=dfs(tmpD,L);
    vector<int> re;
    if(a>=0){
        re.push_back(a);
    }
    if(b>=0){
        re.push_back(b);
    }
    if(c>=0){
        re.push_back(c);
    }
    if(d>=0){
        re.push_back(d);
    }
    //i->A
    //B
    //C
    //unse
    int min=INT32_MAX;
    for(auto x : re){
        if(min>x){
            min=x;
        }
    }
    return min;
    
}

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

    if(A+B<C){
        cout<<"No"<<endl;
    }else{
        cout<<"Yes"<<endl;
    }
   

    return 0;
}




Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <cmath>
#include <limits>
#include <stdio.h>
using namespace std;

struct Pos
{
    double x;
    double y;
};
void print(struct Pos p)
{
    printf("%.6lf %.6lf\n", p.x, p.y);
}
void kock(int n, struct Pos p1, struct Pos p2)
{
    if(n == 0) return;
    
    struct Pos s,t,u;
    static const double pi = 3.141592653589793;
    s.x = (2*p1.x + 1*p2.x) / 3.0;
    s.y = (2*p1.y + 1*p2.y) / 3.0;
    t.x = (1*p1.x + 2*p2.x) / 3.0;
    t.y = (1*p1.y + 2*p2.y) / 3.0;
    double rad60 = pi/(180.0/60.0);
    u.x = (t.x-s.x)*cos(rad60) - (t.y-s.y)*sin(rad60) + s.x; 
    u.y = (t.x-s.x)*sin(rad60) + (t.y-s.y)*cos(rad60) + s.y; 
    
    kock(n-1, p1, s); print(s);
    kock(n-1, s,  u); print(u);
    kock(n-1, u,  t); print(t);
    kock(n-1, t, p2);
}
int main()
{
    int n;
    cin >> n;
    
    struct Pos p1, p2;
    print(p1);
    p1.x = 0.0, p1.y = 0.0;
    p2.x = 100.0, p2.y = 0.0;
    kock(n, p1, p2);
    print(p2);
}


Measured memory_bytes: 3200
#include <iostream>
#include <cmath>

#define llong long long

using namespace std;

int main(){
	llong N; cin >> N;
	llong M = sqrt(N)+10;
	bool flag[M];
	if( flag==NULL ) cout << "error";
	llong cnt=0;
	for(llong i=0;i<M;i++) flag[i]=true;
	
	for(llong i=2;i<M;i++){
		if( flag[i] ){
			llong j = i*2;
			while( j<M && j>0 ){
				flag[j] = false;
				j += i;
			}
			llong k = i;
			while( N%k==0 ){
				N /= k;
				cnt++;
				k *= i;
			}
			while( N%i==0 ) N/=i;
		}
	}
	if( N>M ) cout << cnt+1;
	else cout << cnt;
	return 0;
}


Measured memory_bytes: 4540
//#include "bits/stdc++.h"

#define _USE_MATH_DEFINES
#include<cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <deque>
#include <algorithm>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <iterator>

using namespace std;

#define rep(i,a,b) for(int i=(a), i##_len=(b);i<i##_len;i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)

#define int ll
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair

//typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<double, double> pdd;
typedef vector< vector<int> > mat;

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

const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;

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

	int N, H, W;
	cin >> N >> H >> W;
	int ans = 0;

	cout << (N - H + 1)*(N - W + 1) << endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <algorithm>
using namespace std;
int main(){
	int N; 
	cin >> N; 
	int L[11] = {}; 
	int P = 0; 
	for(int i = 0; i < N; i++){
		cin >> L[i]; 
		P += L[i]; 
	}
	sort(L, L+N); 
	if(P > L[N-1] * 2) cout << "Yes" << endl; 
	else cout << "No" << endl; 
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
const double eps = 1e-10;
const int MOD = 1000000007;
const int INF = 1000000000;
const ll LINF = 1ll<<50;
template<typename T>
void printv(const vector<T>& s) {
  for(int i=0;i<(int)(s.size());++i) {
    cout << s[i];
    if(i == (int)(s.size())-1) cout << endl;
    else cout << " ";
  }
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  while(1) {
    int n, p; cin >> n >> p;
    if(n == 0) break;
    vector<int> v(n, 0);
    int win = -1;
    int pos = 0;
    while(1) {
      if(p > 0) {
        v[pos]++;
        p--;
        if(p == 0) {
          bool ok = true;
          for(int i=0;i<n;++i) {
            if(i == pos) continue;
            if(v[i] != 0) {
              ok = false;
              break;
            }
          }
          if(ok) {
            win = pos;
            break;
          }
        }
      } else {
        p = v[pos];
        v[pos] = 0;
      }
      pos = (pos + 1) % n;
    }
    cout << win << endl;
  }
}



Measured memory_bytes: 3152
#include <iostream>
#include <set>

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

void solve()
{
	int n;
	while(cin >> n, n)
	{
		set<P> Set;
		for(int i = 0; i < n; ++i)
		{
			int x, y;
			cin >> x >> y;
			Set.insert(P(x, y));
		}
		int ans = 0;
		for(set<P>::iterator It = Set.begin(); It != Set.end(); ++It)
		{
			for(set<P>::iterator It2 = Set.begin(); It2 != Set.end(); ++It2)
			{
				int tx = It->first - It2->first;
				int ty = It->second - It2->second;
				if(tx * tx + ty * ty <= ans)
				{
					continue;
				}
				if(Set.count(P(It->first - ty, It->second + tx)) && Set.count(P(It2->first - ty, It2->second + tx)))
				{
					ans = tx * tx + ty * ty;
				}
			}
		}
		cout << ans << endl;
	}
}

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

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) REP(i,0,n)
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define repr(i, n) REPR(i, n, 0)
#define REPR(i, s, e) for(int i=(int)(s-1); i>=(int)(e); i--)
#define pb push_back
#define all(r) r.begin(),r.end()
#define rall(r) r.rbegin(),r.rend()
#define fi first
#define se second

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

const ll INF = 1e9;
const ll MOD = 1e9 + 7;
double EPS = 1e-8;

template<typename T> T chmax(T& a, const T& b){return a = (a > b ? a : b);}
template<typename T> T chmin(T& a, const T& b){return a = (a < b ? a : b);}

int main(){
    int h, w, k;
    cin >> h >> w >> k;
    vector<string> s(h);
    rep(i, h) cin >> s[i];
    vector<vector<int>> ans(h, vector<int>(w));
    int cnt = 1;
    vector<int> t(h);
    rep(i, h) {
        rep(j, w) {
            if(s[i][j] == '#') {
                ans[i][j] = cnt++;
                t[i]++;
            }
        }
    } 
    rep(i, h) {
        rep(j, w-1) if(ans[i][j+1] == 0) ans[i][j+1] = ans[i][j];
        for(int j = w-1; j > 0; --j) if(ans[i][j-1] == 0) ans[i][j-1] = ans[i][j];
    }
    rep(i, h-1) {
        if(ans[i+1][0] == 0) ans[i+1] = ans[i];
    }
    for(int i = h-1; i > 0; --i) if(ans[i-1][0] == 0) ans[i-1] = ans[i];
    rep(i, h) {
        rep(j, w) {
            cout << ans[i][j];
            if(j == w-1) cout << endl;
            else cout << " ";
        }
    }
    return 0;
}

Measured memory_bytes: 1280
#include <stdio.h>

int main()
{
	int i, N, A, flag = 0;
	scanf("%d", &N);
	if (N == 1) {
		printf("YES\n");
		fflush(stdout);
		return 0;
	}
	for (i = 1; i <= N; i++) {
		scanf("%d", &A);
		flag ^= A & 1;
	}
	if (flag == 0) printf("YES\n");
	else printf("NO\n");
	fflush(stdout);
	return 0;
}

Measured memory_bytes: 1624
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		double a = sc.nextDouble();
		double b = sc.nextDouble();
		double h = sc.nextDouble();
		double m = sc.nextDouble();

		double theta1 = 30.0d * (h + (m / 60.0D));
		double theta2 = 6.0d * m;

		double theta = Math.toRadians(theta2 - theta1);
		double c = Math.sqrt(Math.pow(a, 2.0D) + Math.pow(b, 2.0D) - 2.0D * a * b * Math.cos(theta));

		System.out.println(String.format("%.20f", c));
	}
}


Measured memory_bytes: 37528