akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;


int main (){
    double N, T, A;
    cin>>N>>T>>A;
    vector<double> H(N);
    for(int i=0; i<N; i++){
        cin>>H.at(i);
    
    }
    double Dif=abs(A-T+H.at(0)*0.006);
    int Num=0;
    for(int i=1; i<N; i++){
        double DifofI=abs(A-T+H.at(i)*0.006);
        if(Dif>DifofI){
            Dif=DifofI;
            Num=i;
        }
    }
    cout<<Num+1<<endl;


}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repi(i, s, n) for (int i = (s); i < (n); i++)
#ifdef LOCAL
#define INPUT_FILE                              \
  ifstream in("atcoder-problems/abc093_b.txt"); \
  cin.rdbuf(in.rdbuf());
#define print_vec(v)                        \
  rep(l, v.size()) { cout << v[l] << " "; } \
  cout << endl;
#else
#define INPUT_FILE
#define print_vec(v)
#endif
#define CIN_OPTIMIZE \
  cin.tie(0);        \
  ios::sync_with_stdio(false);
typedef pair<int, int> P;
typedef long long ll;
typedef pair<ll, ll> pl;
const int INF = 100100100;
const ll LINF = 1e18 + 100;
const int MOD = 1e9 + 7;

int main() {
  INPUT_FILE CIN_OPTIMIZE;

  int A, B, K;
  cin >> A >> B >> K;

  set<int> c;
  c.insert(A);
  repi(i, A, min(A + K, B)) { c.insert(i); }
  for (int i = B; i > max(A, B - K); i--) {
    c.insert(i);
  }

  for(auto i : c) {
    cout << i << endl;
  }

}

Measured memory_bytes: 256
n = int(input())
S = list(map(int, input().split()))
q = int(input())
T = list(map(int, input().split()))

from bisect import bisect_right
def index_right(a, x):
    'Locate the leftmost value exactly equal to x'
    i = bisect_right(a, x)
    i = i-1
    if i != len(a) and a[i] == x:
        return i
    raise ValueError
    
ans = 0
for t in T:
    try:
        index_right(S, t)
        ans += 1
    except:
        continue
print(ans)


Measured memory_bytes: 16716
#%%
import itertools

def warshall_floyd(d):
    for k in range(n):
        for i in range(n):
            for j in range(n):
                d[i][j] = min(d[i][j], d[i][k]+d[k][j])
    return d

n, m, R = map(int, input().split())
r = list(map(lambda x: int(x)-1,input().split()))
dist = [[float("inf")] * n for _ in range(n)]
for i in range(n):
    dist[i][i] = 0
for i in range(m):
    a, b, c = map(int, input().split())
    a, b = a-1, b-1
    dist[a][b] = c
    dist[b][a] = c
dist = warshall_floyd(dist)

l = list(itertools.permutations(r))
ans = float("inf")
for i in range(len(l)):
    tmp = 0
    for j in range(len(r)-1):
        tmp += dist[l[i][j]][l[i][j+1]]
    ans = min(ans, tmp)
print(ans)

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

using namespace std;
#ifdef _DEBUG
#define _GLIBCXX_DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

#define int long long
#define ll long long
#define DBG 1
#define rep(i, a, b) for (int i = (a); i < (b); i++)
#define rrep(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define loop(n) rep(loop, (0), (n))
#define all(c) begin(c), end(c)
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9) + 7;
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
using pii = pair<int, int>;
// template<class T> ostream &operator<<(ostream &os,T &t){dump(t);return os;}
template <typename T, typename S>istream &operator>>(istream &is, pair<T, S> &p) { is >> p.first >> p.second; return is; }
//template <typename T, typename S>ostream &operator<<(ostream &os, pair<T, S> &p) {os << p.first << " " << p.second;return os;}

template <typename T> void printvv(const vector<vector<T>> &v) {
	cerr << endl;
	rep(i, 0, v.size()) rep(j, 0, v[i].size()) {
		if (typeid(v[i][j]).name() == typeid(INF).name() and v[i][j] == INF) {
			cerr << "INF";
		}
		else
			cerr << v[i][j];
		cerr << (j == v[i].size() - 1 ? '\n' : ' ');
	}
	cerr << endl;
}

#ifndef _DEBUG
#define printvv(...)
#endif
void YES(bool f) { cout << (f ? "YES" : "NO") << endl; }
void Yes(bool f) { cout << (f ? "Yes" : "No") << endl; }
template <class T, class U>bool chmin(T& a, U b) { if (a > b) { a = b; return true; }return false; }
template <class T, class U>bool chmax(T& a, U b) { if (a < b) { a = b; return true; }return false; }


signed main(signed argc, char *argv[]) {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(12);

	vector<int>v = { 100,101,102,103,104,105 };
	int m = 1000000;
	vector<int>z;
	int b = 1;
	while (m) {
		int a = min(m, b);
		m -= a;
		z.eb(a);
		b <<= 1;
	}
	dump(z);

	int x; cin >> x;

	vector<int>dp(x + 1, 0);
	dp[0] = 1;
	for (auto a : v) {
		for (auto c : z) {
			if (a*c <= x) {
				rep(i, a*c, x + 1) {
					chmax(dp[i], dp[i - a * c]);
				}
			}
		}
	}
	cout << dp[x] << endl;

	return 0;
}


Measured memory_bytes: 1024
#include<cstdio>
#include<iostream>
#include<cstring>
#include<algorithm>
#define RG register
using namespace std;
const int N=1e5+10;
int n,maxx1,maxx2,tot1=1,tot2=1,a[2][N],cmax1,cmax2,ttt,flg,col1,col2;
inline int read(){
	char ch=getchar(); int x=0, f=1;
	while(ch<'0' || ch>'9') {if(ch=='-') f=-1;ch=getchar();}
	while(ch>='0' && ch<='9') {x=x*10+ch-'0'; ch=getchar();}
	return x*f;}
int main()
{
	//freopen("arc103-C.in","r",stdin);
	//freopen(".out","w",stdout);
	n=read(); 
	for(RG int i=1;i<=n;i++) 
	{
		a[i%2][(i+1)/2]=read();
		if(ttt!=a[i%2][(i+1)/2]) flg=1;
	}
	if(!flg)
	{
		printf("%d",n/2);
		return 0;
	}
	sort(a[0]+1,a[0]+1+n/2);
	sort(a[1]+1,a[1]+1+n/2);
	for(RG int i=2;i<=n/2;i++)
	{
		if(a[0][i]!=a[0][i-1])
		{
			if(tot1>maxx1) col1=a[0][i-1],cmax1=maxx1,maxx1=tot1;
			else if(tot1>cmax1) cmax1=tot1;
			tot1=1;
		}
		else tot1++;
	}
	if(tot1>maxx1) col1=a[0][n/2],cmax1=maxx1, maxx1=tot1;
	else if(tot1>cmax1) cmax1=tot1;
	for(RG int i=2;i<=n/2;i++)
	{
		if(a[1][i]!=a[1][i-1])
		{
			if(tot2>maxx2) col2=a[1][i-1], cmax2=maxx2,maxx2=tot2;
			else if(tot2>cmax2) cmax2=tot2;
			tot2=1;
		}
		else tot2++;
	}
	if(tot2>maxx2) col2=a[1][n/2], cmax2=maxx2, maxx2=tot2;
	else if(tot2>cmax2) cmax2=tot2;
	if(col1==col2) 
	{
		printf("%d",min(n-maxx1-cmax2,n-cmax1-maxx2));
	}
	else printf("%d",n-maxx1-maxx2);
	//fclose(stdin); fclose(stdout);
	return 0;
}

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

int main(void){
   
    int N,ans=0;
    cin >> N;
    int data[N];
    
    for(int i=0;i<N;i++) cin >> data[i];
    
    for(int i=0;i<N;i++){
        for(int j= i+1;j<N;j++){
            ans += (data[i] * data[j]);
        }
    }
    
    cout << ans << endl;
}

Measured memory_bytes: 3620
#include<stdio.h>
#include<math.h>
int main ()
{
	int A,B,C,D,m,n,s;
	while(scanf("%d %d %d %d",&A,&B,&C,&D)!=EOF)
	{
		if(A>C)
		m=A;
		else
		m=C;
		if(B>D)
		n=D;
		else
		n=B;
		s=n-m;
		if(s<0)
		printf("0\n");
		else
		printf("%d\n",s);
	}
	return 0;
}

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

using namespace std;

const int mod = (int)1e9 + 7;

const int MAXN = 60;

int dp[MAXN][4][4];

int main() {
#ifdef __APPLE__
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif

    int n;
    cin >> n;
    string s[2];
    cin >> s[0] >> s[1];
    s[0] = "." + s[0];
    s[1] = "." + s[1];
    dp[0][3][3] = 1;
    for (int i = 1; i <= n; ++i) {
        for (int c0 = 0; c0 < 3; ++c0) {
            for (int c1 = 0; c1 < 3; ++c1) {
                if (s[0][i] == s[0][i - 1] &&
                    s[1][i] == s[1][i - 1]) {
                    dp[i][c0][c1] = dp[i - 1][c0][c1];
                } else if (s[0][i] == s[0][i - 1] &&
                           s[1][i] != s[1][i - 1]) {
                    for (int j = 0; j < 3; ++j) {
                        if (c0 != c1 && c1 != j)
                            (dp[i][c0][c1] += dp[i - 1][c0][j]) %= mod;
                    }
                } else if (s[0][i] != s[0][i - 1] &&
                           s[1][i] == s[1][i - 1]) {
                    for (int j = 0; j < 3; ++j) {
                        if (c0 != c1 && c0 != j)
                            (dp[i][c0][c1] += dp[i - 1][j][c1]) %= mod;
                    }
                } else if (s[0][i] != s[0][i - 1] &&
                           s[1][i] != s[1][i - 1] &&
                           s[0][i] != s[1][i]) {
                    for (int j = 0; j < 4; ++j) {
                        for (int k = 0; k < 4; ++k) {
                            if (c0 != c1 && c0 != j && c1 != k)
                                (dp[i][c0][c1] += dp[i - 1][j][k]) %= mod;
                        }
                    }
                } else {
                    for (int j = 0; j < 4; ++j) {
                        for (int k = 0; k < 4; ++k) {
                            if (c0 == c1 && c0 != j && c1 != k)
                                (dp[i][c0][c1] += dp[i - 1][j][k]) %= mod;
                        }
                    }
                }
            }
        }
    }
    int ans = 0;
    for (int i = 0; i < 3; ++i) {
        for (int j = 0; j < 3; ++j) {
            (ans += dp[n][i][j]) %= mod;
        }
    }
    printf("%d", ans);
    
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
int x,y;
cin>>x>>y;
while(!(x==0&&y==0)){
    if(x>=y){
        cout<<y<<" "<<x<<endl;
    }
    else {
        cout<<x<<" "<<y<<endl;
    }
    cin>>x>>y;
}
return 0;
}


Measured memory_bytes: 3020
while True:
    n = int(input())
    if n == 0:
        break
    
    C = []
    for i in range (n):
        c = int(input())
        C.append(c)
        
    for j in range(10):
        x = C.count(j)
        if x == 0:
            print('-')
        else:
            print('*'*x)


Measured memory_bytes: 5704
#include <bits/stdc++.h>
#include <assert.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define PB push_back
#define MP make_pair
#define MOD 1000000007LL
#define endl "\n"
#define fst first
#define snd second
const ll UNDEF = -1;
const ll INF=1e18;
template<typename T> inline bool chkmax(T &aa, T bb) { return aa < bb ? aa = bb, true : false; }
template<typename T> inline bool chkmin(T &aa, T bb) { return aa > bb ? aa = bb, true : false; }
typedef pair<ll,ll> pll;
typedef vector<ll> vll;
bool f(ll n, ll a, ll b, ll c, ll d) {
	if (d==0) {
		if (a==b) return true;
		return false;
	}
	ll k=n-1;
	for (ll pos=0;pos<=k;pos++) {
		ll neg=k-pos;
		ll delta=b-a+(neg-pos)*c;
		ll s=d-c;
		ll hi=s*pos;
		ll lo=-s*neg;
		//printf("pos:%lld neg:%lld hi:%lld lo:%lld delta:%lld\n",pos,neg,hi,lo,delta);
		if (lo<=delta&&delta<=hi) return true;
	}
	return false;
}
void solve(long long N, long long A, long long B, long long C, long long D){
	if (f(N,A,B,C,D)) {
		printf("YES\n"); return;
	}
	printf("NO\n");
}

int main(){	
	ios_base::sync_with_stdio(false); cin.tie(0);
	long long D;
	long long C;
	long long B;
	long long A;
	long long N;
	scanf("%lld",&N);
	scanf("%lld",&A);
	scanf("%lld",&B);
	scanf("%lld",&C);
	scanf("%lld",&D);
	solve(N, A, B, C, D);
	return 0;
}



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

long long GCD(long long x,long long y){
  if(y == 0) return x;
  return GCD(y,x%y);
}

int main() {
  long long a,b,c,d,suma,sumb,g;
  cin >> a >> b >> c >> d;
  suma = a-1;
  sumb = b;
  g = c*d/GCD(c,d);
  sumb -= b/c+b/d-b/g;
  suma -= (a-1)/c+(a-1)/d-(a-1)/g;
  cout << sumb-suma << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<cmath>
#include<string>
#include<vector>
#include<list>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<stack>
using namespace std;
typedef long long ll;
#define fi first
#define se second
#define mp make_pair
#define rep(i, n) for(int i=0;i<n;++i)
#define rrep(i, n) for(int i=n;i>=0;--i)
const int inf=1e9+7;
const ll mod=1e9+7;
const ll big=1e18;
const double PI=2*asin(1);

int main() {
  int N, T;
  cin>>N>>T;
  int t[N];
  for(int i=0;i<N;++i) {
    cin>>t[i];
  }
  ll ans = 0;
  for(int i=1;i<N;++i) {
    if(t[i-1]+T<t[i]) ans += T;
    else ans += t[i]-t[i-1];
  }
  ans += T;
  cout<<ans<<endl;
}



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

int main(){
    string s,t;
    cin >> s >> t;
    int i = 0;
    while(i <= s.size()){
        s = s[s.size()-1] + s.substr(0,s.size()-1);
        if(s == t){
            cout << "Yes" << endl;
            return 0;
        }
        i++;
    }
    cout << "No" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#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 s,w;
  cin >> s >> w;
  if(s<=w)
    cout << "unsafe" << endl;
  else
    cout << "safe" << endl;
  return 0;
}

Measured memory_bytes: 3624
import java.util.Scanner;
import java.util.Arrays;

public class Main{
public static void main(String[] args){
Scanner scan=new Scanner(System.in);
int n=scan.nextInt();
String[] a=new String[n];

int i=0;
for(i=0;i<n;i++){
    a[i]=scan.next();
}
Arrays.sort(a);

i=0;
int sum=0;
for(i=0;i<n-1;i++){
  if(a[i].equals(a[i+1])){
    sum=sum;
  }else{
    sum=sum+1;
  }
}
  

System.out.println(sum+1);


}
}

Measured memory_bytes: 70056
#include <bits/stdc++.h>
using namespace std;
using Int = long long;
const Int MOD = 1000000007;
Int modpow(Int x, Int y) {
    if (y == 0) return 1;
    if (y % 2 == 0) return modpow(x * x % MOD, y / 2);
    return x * modpow(x, y - 1) % MOD;
}
int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int N; cin >> N;
    vector<int> A(N); for (auto &a : A) cin >> a;
    vector<int> S(N + 1); for (int i = 0; i < N; i++) S[i + 1] = S[i] ^ A[i];
    vector<int> Z(N + 1); for (int i = 0; i < N; i++) Z[i + 1] = Z[i] + (S[i + 1] == 0);
    vector<int> prev(N + 1);
    map<int, int> M;
    for (int i = 0; i <= N; i++) {
        prev[i] = M[S[i]];
        M[S[i]] = i;
    }
    auto f = [&](int i, bool sum) {
        vector<Int> A;
        for (;;) {
            A.push_back(i);
            i = prev[i];
            if (i == 0) break;
        }
        reverse(begin(A), end(A));
        vector<Int> B(A.size()), C(A.size());
        B[0] = C[0] = 1;
        for (int i = 1; i < A.size(); i++) {
            B[i] = C[i - 1] * (Z[A[i]] - Z[A[i - 1]]) + B[i - 1];
            B[i] %= MOD;
            C[i] += C[i - 1] + B[i];
            C[i] %= MOD;
        }
        if (!sum) return B.back();
        else return accumulate(begin(B), end(B), 0LL) % MOD;
    };
    Int ans = 0;
    if (S[N] != 0) {
        ans = f(N, false);
    } else {
        ans = modpow(2, Z[N] - 1);
        for (auto &p : M) if (p.first != 0) ans = (ans + f(p.second, true)) % MOD;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 21504
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define E "\n"

using namespace std;
const long long MOD = (long long)1e9 + 7;

int n, v[100009], cnt[2][100009];
vector<pair<int, int> > vec[2];

int main()
{
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> v[i];
		if (i % 2) cnt[1][v[i]]++;
		else cnt[0][v[i]]++;
	}
	for (int i = 0; i < 2; i++) {
		for (int j = 1; j <= 100000; j++) {
			if (cnt[i][j]) vec[i].pb(make_pair(cnt[i][j], j));
		}
		sort(vec[i].begin(), vec[i].end());
		reverse(vec[i].begin(), vec[i].end());
	}
	int ans = vec[1][0].fi;
	if (vec[0][0].se == vec[1][0].se) {
		int tmp;
		int x, y;
		if (vec[1].size() > 1) x = vec[1][1].fi;
		else x = 0;
		if (vec[0].size() > 1) y = vec[0][1].fi;
		else y = 0;
		tmp = max(vec[0][0].fi + x, y + vec[1][0].fi);
		ans = max(ans, tmp);
	}
	else {
		ans = max(ans, vec[0][0].fi + vec[1][0].fi);
	}
	cout << n - ans << E;
	//system("pause");
	return 0;
}

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

int main() {
  string s;
  cin >> s;
  if(s == "Sunny") {
    cout << "Cloudy";
  } else if(s == "Cloudy") {
    cout << "Rainy";
  } else{
    cout << "Sunny";
  }
}

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

using namespace std;
#define ll long long
#define pb push_back
#define vi vector<int>
#define inf 1000000100

int main()
{
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    cout << max(a*b, c*d) << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
 
#define EPS 1e-7
 
class Point {
  public:
    double x,y;
    Point(double x = 0.0, double y = 0.0) : x(x), y(y) {}
    Point operator + (Point p) { return Point(x+p.x, y+p.y); }
    Point operator - (Point p) { return Point(x-p.x, y-p.y); }
    Point operator * (double a) { return Point(x*a, y*a); }
    Point operator / (double a) { return Point(x/a, y/a); }
    double abs() { return sqrt(norm()); }
    double norm() { return x * x + y * y; }
};
 
double dot(Point a, Point b)
{
    return a.x*b.x + a.y*b.y;
}
double cross(Point a, Point b)
{
    return a.x*b.y - a.y*b.x;
}
 
class Segment {
  public:
    Point t, s;
    Segment(Point t, Point s) : t(t), s(s) {}
};
 
class Circle {
  public:
    double x, y, r;
    Circle(double x = 0.0, double y = 0.0, double r = 0.0) : x(x), y(y), r(r) {}
};
 
Point point[3];
Circle ci;
 
int ccw(Point p0, Point p1, Point p2)
{
    Point a = p1 - p0;
    Point b = p2 - p0;
    if (cross(a, b) > EPS) return 1;
    if (cross(a, b) < -EPS) return -1;
    if (dot(a, b) < -EPS) return 2;
    if (a.norm() < b.norm()) return -2;
    return 0;
}
 
bool check()
{
    Point cp = Point(ci.x, ci.y);
    int c1 = ccw(point[0], point[1], cp);
    int c2 = ccw(point[1], point[2], cp);
    int c3 = ccw(point[2], point[0], cp);
    return (c1 == c2 && c2 == c3);
}
 
typedef Segment Line;

double getDistanceLP(Line l, Point p)
{
    return abs(cross(l.s-l.t, p-l.t) / (l.s-l.t).abs());
}
 
double getDistanceSP(Segment seg, Point p)
{
    if (dot(seg.s-seg.t, p-seg.t) < 0.0) return (p-seg.t).abs();
    if (dot(seg.t-seg.s, p-seg.s) < 0.0) return (p-seg.s).abs(); 
    return getDistanceLP(seg, p);
}
 
int getStateCS(Circle c, Segment seg)
{
    Point cp = Point(c.x, c.y);
    if (getDistanceSP(seg, cp) >= c.r) {
	return 1;
    }
    return 3;
}
 
bool isCross()
{
    Point cp = Point(ci.x, ci.y);
 
    Segment seg[3] = {
	Segment(point[0], point[1]),
	Segment(point[1], point[2]),
	Segment(point[2], point[0])
    };
    int cnt = 0;
    for (int i = 0; i < 3; i++) {
	if (getDistanceSP(seg[i], cp) > ci.r) {
	    cnt++;
	}
    }
 
    if (cnt == 3 && !check()) return false;
    return true;
}
 
void judge()
{
    Segment seg[3] = {
	Segment(point[0], point[1]),
	Segment(point[1], point[2]),
	Segment(point[2], point[0])
    };
    Point cp = Point(ci.x, ci.y);
    int TinC = 0;
    for (int i = 0; i < 3; i++, TinC++) {
	if ((point[i]-cp).abs() > ci.r) {
	    break;
	}
    }
 
    if (TinC == 3) { 
	cout << 'b' << endl;
	return;
    }
 
    int CinT = 0;
    for (int i = 0; i < 3; i++) {
	if (getStateCS(ci, seg[i]) == 1) {
	    CinT++;
	}
    }
    if (CinT == 3 && check()) {
	cout << 'a' << endl;
    } else {
	if (isCross()) {
	    cout << 'c' << endl;
	} else {
	    cout << 'd' << endl;
	}
    }
}
 
int main()
{
    while (1) {
	cin >> point[0].x >> point[0].y;
	if (!point[0].x && !point[0].y) break;
	for (int i = 0; i < 2; i++) {
	    cin >> point[i+1].x >> point[i+1].y;
	}
	cin >> ci.x >> ci.y >> ci.r;
	judge();
    }
    return 0;
}

Measured memory_bytes: 3160
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < (int)n; i++)

int main() {
    int N;
    cin >> N;
    int result = 0;
    REP(i, N){
        int x;
        cin >> x;
        if((i+1)%2 == 1 && x%2 == 1){
            result++;
        }
    }
    cout << result << "\n";
    return 0;
}

Measured memory_bytes: 3620
def check(i, s, c):
    # iが与えられた条件をすべて満たすかチェックする
    hoge = []
    if i == 0:
        hoge.append(0)
    while(i > 0):
        hoge.append(i % 10)
        i = int(i / 10)
    hoge = list(reversed(hoge))
    for sn, cn in zip(s, c):
        if len(hoge)<sn:
            return -1
        if hoge[sn-1] != cn:
            return -1
    return 0

n,m = map(int,input().split())
i = 0
s = []
c = []
while(i < m):
    tmp = input()
    s.append(int(tmp.split()[0]))
    c.append(int(tmp.split()[1]))
    i += 1

result = -1
if n == 1:
    fromnum = 0
else:
    fromnum = 10**(n-1)
for ii in range(fromnum,10**n):
    if check(ii, s, c)==0:
        result = ii
        break
print(result)

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

int main()
{
	int n;
	int way[30];
	while (cin >> n)
	{
		if (n == 0) break;
		for (int i = 1; i <= n; i++)
		{
			if (i == 1)
			{
				way[i] = 1;
			}
			else if (i == 2)
			{
				way[i] = 2;
			}
			else if (i == 3)
			{
				way[i] = 4;
			}
			else
			{
				way[i] = way[i - 3] + way[i - 2] + way[i - 1];
			}
		}
		if (way[n] % 3650 == 0)
		{
			cout << way[n] / 3650 << endl;
		}
		else
		{
			cout << way[n] / 3650 + 1 << endl;
		}
	}

	return 0;
}

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

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<int, int> Pi;
typedef vector<ll> Vec;
typedef vector<int> Vi;
typedef vector<string> Vs;
typedef vector<vector<ll>> VV;
typedef vector<vector<int>> VVi;

#define REP(i, a, b) for(ll i=(a); i<(b); i++)
#define PER(i, a, b) for(ll i=(a); i>=(b); i--)
#define rep(i, n) REP(i, 0, n)
#define per(i, n) PER(i, n, 0)
const ll INF=1e18+18;
const ll MAX=100005;
const ll MOD=1000000007;
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl;
#define YES(n) cout << ((n) ? "YES" : "NO") << endl;
#define ALL(v) v.begin(), v.end()
#define rALL(v) v.rbegin(), v.rend()
#define pb(x) push_back(x)
#define mp(a, b) make_pair(a,b)
#define Each(a,b) for(auto &a :b)
#define REPM(i, mp) for (auto i = mp.begin(); i != mp.end(); ++i)
#define dbg(x_) cerr << #x_ << ":" << x_ << endl;
#define dbgmap(mp) cerr << #mp << ":"<<endl; for (auto i = mp.begin(); i != mp.end(); ++i) { cerr << i->first <<":"<<i->second << endl;}
#define dbgarr(n,m,arr) rep(i,n){rep(j,m){cerr<<arr[i][j]<<" ";}cerr<<endl;}
#define dbgdp(n,arr) rep(i,n){cerr<<arr[i]<<" ";}cerr<<endl;
#define sum(v) accumulate(ALL(v),0)
#define fi first
#define se second

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

template<typename T1, typename T2>
ostream &operator<<(ostream &s, const pair<T1, T2> &p) { return s<<"("<<p.first<<", "<<p.second<<")"; }

// vector
template<typename T>
ostream &operator<<(ostream &s, const vector<T> &v) {
    int len=v.size();
    for(int i=0; i<len; ++i) {
        s<<v[i];
        if(i<len-1) s<<"	";
    }
    return s;
}

// 2 dimentional vector
template<typename T>
ostream &operator<<(ostream &s, const vector<vector<T> > &vv) {
    int len=vv.size();
    for(int i=0; i<len; ++i) {
        s<<vv[i]<<endl;
    }
    return s;
}

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

    ll n;
    cin>>n;
    Vec v(n);
    rep(i,n)cin>>v[i];
    reverse(ALL(v));
    if(v[0]!=2){
        cout<<-1<<endl;
        return 0;
    }
    ll x = 2;
    ll y = 2;
    REP(i,1,n){
        //v[i]の倍数である必要あり
        //決まったv[i-1]以上は足せない
        y += v[i-1]-1;
        y = (y)/v[i]*v[i];
        x = (x+v[i]-1)/v[i]*v[i];
        if(y==0 || x==0 || x>y){
            cout<<-1<<endl;
            return 0;
        }
    }
    y += v[n-1]-1;
    cout<<x<<" "<<y<<endl;
    return  0;
}


Measured memory_bytes: 1024
#include <iostream>
    #include <fstream>
    #include <cstdio>
    #include <cmath>
    #include <vector>
    #include <cstring>
    #include <string>
    #include <set>
    #include <map>
    #include <stack>
    #include <queue>
    #include <algorithm>
    using namespace std;
     
    #define REP(i,n) for(int i=0; i<n; ++i)
    #define FOR(i,a,b) for(ll 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;
     
     
     
    int main(){
        cin.tie(0);
        ios::sync_with_stdio(false);
        ll N;
        cin >> N;
        FOR(h, 1, 3500)FOR(n, h, 3500){
            if(4 * h * n - N * (h + n) <= 0) continue;
            if(N * h * n % (4 * h * n - N * (h + n)) == 0){
                ll w = N * h * n / (4 * h * n - N * (h + n));
                cout << h << " " << n << " " << w << "\n";
                return 0;
            }
        }
     
        return 0;
    }

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <deque>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#include <cmath>

#define endl "\n"

using namespace std;

template<typename T>
void printArray(T a) {
    for(auto i : a)
        cout << i << " ";

    cout << endl;
}

template<typename T>
void print2DArray(T a) {
    for(auto i : a) {
        for(auto j : i)
            cout << j << " ";

        cout << endl;
    }
    cout << endl;
}

int main(int argc, char *argv[])
{
    std::ios::sync_with_stdio(false);
    cin.tie(NULL);

    double a = 2;
    double b = 1;

    cin >> a >> b;

    cout << (int) ceil((b-1)/(a-1)) << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, a) for (int i = 0; i < (int)(a); i++)
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
typedef long long ll;
template<typename T>istream& operator>>(istream&i,vector<T>&v){rep(j,sz(v))i>>v[j];return i;}
template<typename T>string join(const vector<T>&v){stringstream s;rep(i,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename T>ostream& operator<<(ostream&o,const vector<T>&v){if(sz(v))o<<join(v);return o;}
template<typename T1,typename T2>istream& operator>>(istream&i,pair<T1,T2>&v){return i>>v.first>>v.second;}
template<typename T1,typename T2>ostream& operator<<(ostream&o,const pair<T1,T2>&v){return o<<v.first<<","<<v.second;}
template<typename T>bool mins(T& x,const T&y){if(x>y){x=y;return true;}else return false;}
template<typename T>bool maxs(T& x,const T&y){if(x<y){x=y;return true;}else return false;}
template<typename T>ll suma(const vector<T>&a){ll res(0);for(auto&&x:a)res+=x;return res;}

#ifdef _DEBUG
inline void dump() { cerr << endl; }
template<typename Head> void dump(Head&& head) { cerr << head; dump(); }
template<typename Head, typename... Tail> void dump(Head&& head, Tail&&... tail) { cerr << head << ", "; dump(forward<Tail>(tail)...); }
#define debug(...) do {cerr << __LINE__ << ":\t" << #__VA_ARGS__ << " = "; dump(__VA_ARGS__); } while (false)
#else
#define dump(...)
#define debug(...)
#endif

template<typename T>
struct edge {
  int src, to;
  T cost;
  edge(int to, T cost) : src(-1), to(to), cost(cost) {}
  edge(int src, int to, T cost) : src(src), to(to), cost(cost) {}
  edge &operator=(const int &x) {
    to = x;
    return *this;
  }
  operator int() const { return to; }
};
template<typename T>
using Edges = vector<edge<T>>;
template<typename T>
using WeightedGraph = vector<Edges<T>>;
using UnWeightedGraph = vector<vector<int>>;
template<typename T>
using Matrix = vector<vector<T>>;

/////////////////////////////////////////////////////////////////////
const ll inf = 1LL<<60;

int main()
{
  ll n, m; cin>>n>>m;

  vector<int> aa(m);
  vector<int> bb(m);
  vector<int> cc(m);
  vector<vector<ll>> g(n, vector<ll>(n, inf));
  for (int i=0; i<m; i++) {
    ll a,b,c; cin>>a>>b>>c;
    a--; b--;
    mins(g[a][b], c);
    mins(g[b][a], c);
    aa[i] = a;
    bb[i] = b;
    cc[i] = c;
  }

  rep(k, n) rep(i, n) rep(j, n) mins(g[i][j], g[i][k]+g[k][j]);

  ll ans = m;
  rep(i, m) {
    if (g[aa[i]][bb[i]] == cc[i] && g[bb[i]][aa[i]] == cc[i]) ans--;
  }
  cout << ans << "\n";

  return 0;
}


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

/* 大文字を小文字に変換 */
char tolower(char c) {return (c + 0x20);}
/* 小文字を大文字に変換 */
char toupr(char c) {return (c - 0x20);}

// if('A'<=s[i] && s[i]<='Z') s[i] += 'a'-'A';

/*
string s = "abcdefg"
s.substr(4) "efg"
s.substr(0,3) "abc"
s.substr(2,4) "cdef"

// イテレータ要素のインデックス
distance(A.begin(), itr);
*/

int main()
{
    int N, W; cin >> N >> W;
    P item[N];
    rep(i,N){
        cin >> item[i].first >> item[i].second;
    }
    int A[N+1][W+1];
    rep(i,W+1) A[0][i] = 0; // 何も品物を選択しない場合は、価値が0になる
    rep(i,N+1) A[i][0] = 0; //ナップザックの耐久重量が0のとき、品物の価値は0となる
    // ここから動的計画法により実装してく
    for(int i=1; i<=N; i++){
        int in = i-1;
        for(int w=1; w<=W; w++){
            if(item[in].second > w) A[i][w] = A[i-1][w];
            else{
                if(item[in].first + A[i-1][w-item[in].second] > A[i-1][w]){
                    A[i][w] = A[i-1][w-item[in].second] + item[in].first;
                }else{
                    A[i][w] = A[i-1][w];
                }
            }
        }
    }
    cout << A[N][W] << endl;
}


Measured memory_bytes: 7020
#include <iostream>
#include <vector>
#include <unordered_map>
#include <map>
#include <algorithm>
#include <set>
#include <unordered_set>
#include <deque>
#include <cmath>
#include <stack>
#include <queue>
#include <string>
#include <locale>
#include <iomanip>
#include <math.h>

#define nl '\n'

using namespace std;

long long a, b, x;

int main(){

    cin >> a >> b >> x;

    if(a%x == 0){
        cout << (b/x) - (a/x) + 1;
        return 0;
    }

    cout << (b/x) - (a/x);





}

//g++ -std=c++14 comp.cpp -o b; ./b.exe

Measured memory_bytes: 256
let inf = 1000000000000000001
let step (a, b) (r1, r2) =
  let c1 = begin
    let ta = (a + r1 - 1) / r1 * r1 in
    let tb = ta / r1 * r2 in
    let m = (b + tb - 1) / tb in
    (m * ta, m * tb)
  end in
  let c2 = begin
    let tb = (b + r2 - 1) / r2 * r2 in
    let ta = tb / r2 * r1 in
    let m = (a + ta - 1) / ta in
    (m * ta, m * tb)
  end in
  min c1 c2

let n = Scanf.scanf "%d" (fun x -> x)
let () =
  Array.init n (fun _ -> Scanf.scanf " %d %d" (fun x y -> x, y))
  |> Array.fold_left step (1, 1)
  |> (fun (a, b) -> Printf.printf "%d\n" (a+b))



Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define FOR(i, m, n) for (ll i = m; i < n; i++)
#define IFOR(i, m, n) for (ll i = n - 1; i >= m; i--)
#define REP(i, n) FOR(i, 0, n)
#define IREP(i, n) IFOR(i, 0, n)
#define FOREACH(x, a) for (auto&(x) : (a))
#define ALL(v) (v).begin(), (v).end()
#define SZ(x) ll(x.size())

const ll INF = 1e15;
//始点sとした最短距離を求める O((V+E)logV)
vector<ll> dijkstra(vector<vector<P>>& g, ll s) {
  ll n = SZ(g);
  vector<ll> d(n, INF);
  priority_queue<P, vector<P>, greater<P>> pq;
  vector<bool> fixed(n, false);
  d[s] = 0;
  pq.push(make_pair(0, s));
  while (!pq.empty()) {
    P f = pq.top();
    pq.pop();
    ll cv = f.second;
    fixed[cv] = true;
    if (d[cv] < f.first) continue;
    FOREACH(p, g[cv]) {
      ll nv = p.first;
      ll wgt = p.second;
      if (fixed[nv]) continue;
      if (d[nv] <= d[cv] + wgt) continue;
      d[nv] = d[cv] + wgt;
      pq.push(make_pair(d[nv], nv));
    }
  }
  return d;
}

int main() {
  ll n, m;
  cin >> n >> m;
  vector<vector<P>> to(n);
  FOR(i, 1, n) { to[i].push_back(make_pair(i - 1, 0)); }
  REP(i, m) {
    ll l, r, c;
    cin >> l >> r >> c;
    l--;
    r--;
    to[l].push_back(make_pair(r, c));
  }

  vector<ll> d = dijkstra(to, 0);

  if (d[n - 1] == INF) {
    cout << -1 << endl;
    return 0;
  }
  cout << d[n - 1] << endl;
}

Measured memory_bytes: 10104
#include <bits/stdc++.h>
//#pragma GCC optimize("Ofast")
//#pragma GCC target("avx,avx2,fma")
//#pragma GCC optimization ("unroll-loops")
 
#define int long long 
#define pb push_back
#define all(s) s.begin(),s.end()
#define pii pair<int,int>
#define fr first
#define sc second
#define bst ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define endl "\n"
#define no cout << "NO" << endl;
#define yes cout << "YES" << endl;

using namespace std;

const int N = 5e5 + 10, mod = 1e9 + 7, inf = 1e18 + 7, logn = 23;
const double pi = acos(-1);

int dp[3010][3010];
pii p[3010][3010];
string l, r;
string ans = "";

void solve() {
	//soln
	cin >> l >> r;
	for(int i = 0; i < l.size(); i++) {
		for(int j = 0; j < r.size(); j++) {
			if(l[i] == r[j]) {
				dp[i + 1][j + 1] = dp[i][j] + 1; 
			} else {
				dp[i + 1][j + 1] = max(dp[i][j + 1], dp[i + 1][j]);
			}
		}
	}
	int i = l.size(), j = r.size();
	while(i > 0 && j > 0) {
		if(l[i - 1] == r[j - 1]) {
			ans.pb(l[i - 1]);
			i--;
			j--;
		} else {
			if(dp[i - 1][j] > dp[i][j - 1]) {
				i--;
			} else {
				j--;
			}
		}
	}
	reverse(all(ans));
	cout << ans << endl;
}
main() {
	bst;
	int t = 1;
	//cin >> t;
	while(t--) {
		solve();
	}
}


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

using namespace std;

#define int long long 
#define INF 1e9
#define LINF 1e18

typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<int, P> Pi;
typedef pair<P, P> PP;

const int MOD = 1e9 + 7;
const int dy[] = { 0, 0, 1, -1 };
const int dx[] = { 1, -1, 0, 0 };

template <class T> void chmin(T& a, const T& b) { a = min(a, b); }
template <class T> void chmax(T& a, const T& b) { a = max(a, b); }

int par[200000];     //親

void init(int n) {
    for(int i = 0; i < n; ++i) {
        par[i] = i;
    }
}

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

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

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

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

    int N, M, K;
    cin >> N >> M >> K;
    init(N + M);
    for(int i = 0; i < K; ++i) {
        int rec;
        cin >> rec;
        if(rec == 1) {
            int a, b;
            cin >> a >> b;
            --a; --b;
            a = find(a); b = find(b);
            if(a >= N && b >= N && a != b) {
                cout << i + 1 << endl;
                return 0;
            }
            unite(a, b);
        }
        else {
            int c, x;
            cin >> c >> x;
            --c; --x;
            c = find(c);
            if(c >= N && c != x + N) {
                cout << i + 1 << endl;
                return 0;
            }
            unite(c, x + N);
        }
    }
    cout << 0 << endl;
    return 0;
}



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

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {

            int n = int.Parse(Console.ReadLine());
            var act = new int[n][];
            for (int i = 0; i < n; i++)
            {
                act[i] = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
            }
            long[][] dp = new long[n + 1][];
            dp = dp.Select(e => e = new long[] { 0,0,0 }).ToArray();
            for (int i = 1; i <= n; i++)
            {
                for (int j = 0; j < act[i - i].Length; j++)
                {
                    for (int k = 0; k < act[i - 1].Length; k++)
                    {
                        if (k == j) continue;
                        changeMax(ref dp[i][k], dp[i - 1][j] + act[i - 1][k]);
                    }
                }
            }
            long res = 0;
            for (int i = 0; i < 3; i++)
            {
                changeMax(ref res, dp[n][i]);
            }
            Console.WriteLine(res);
        }

        static bool changeMax(ref long a, long b)
        {
            if (a < b)
            {
                a = b;
                return true;
            }
            return false;
        }
    }
}


Measured memory_bytes: 31800
using System;

namespace question1
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] str = Console.ReadLine().Split(' ');
            int A = int.Parse(str[0]);
            int B = int.Parse(str[1]);
            int C = int.Parse(str[2]);

            int D = C - (A - B);
            if (D < 0) D = 0;

            Console.WriteLine(D.ToString());
            //Console.ReadLine();

        }
    }
}


Measured memory_bytes: 11092
#include <bits/stdc++.h>
using namespace std;
const int maxn=1e5+10;
struct data{int to,next,wi;}e[maxn*2];
int head[maxn];
int cnt=0;
int du[maxn];
queue<int> q;
int vis[maxn];
void ins(int u,int v,int ww)
{
	e[++cnt].to=v;
	e[cnt].next=head[u];
	e[cnt].wi=ww;
	head[u]=cnt;
}
int n,m;
int dis[maxn];
int main()
{
	scanf("%d%d",&n,&m);
	for(int i=1;i<=m;i++)
	{
		int x,y,z;
		scanf("%d%d%d",&x,&y,&z);
		ins(x,y,z);
		du[y]++;
	}
	for(int i=1;i<=n;i++)dis[i]=1e9+10;
	int tot=0;
	for(int s=1;s<=n;s++)
	{
		if(du[s]==0)
		{
			int cha=1e9+100;
			tot++;
			dis[s]=0;
			vis[s]=tot;
			q.push(s);
			while(!q.empty())
			{
				int x=q.front();
				q.pop();
				for(int i=head[x];i;i=e[i].next)
				{
					int u=e[i].to;
					if(vis[u]==tot&&dis[u]!=dis[x]+e[i].wi)
					{
						puts("No");
						return 0;
					}
					if(vis[u]!=tot&&vis[u]!=0)
					{
						if(cha==1e9+100)cha=dis[u]-dis[x];
						else
						{
							puts("No");
							return 0;
						}
					}
					if(vis[u]==0)
					{
						vis[u]=tot;
						dis[u]=min(dis[u],dis[x]+e[i].wi);
						q.push(u);
					}
				}
			}
		}
	}
	for(int i=1;i<=n;i++)if(vis[i]==0){puts("No");return 0;}
	puts("Yes");
	return 0;
}


Measured memory_bytes: 4608
'use strict'

function main(s) {

  s = s.split('\n');

  const N = Number(s[0]);

  s = s.slice(1, -1).map(l => l.split(' ').map(n => Number(n))).map(xy => {
    return {x: xy[0], y: xy[1]}
  });

  const red  = s.slice(0, N);
  const blue = s.slice(N);
  const paired = [...Array(N)].fill(0);

  blue.sort((a, b) => a.x - b.x);

  for (let i = 0; i < N; i++) {
    let max_y = -1;
    let idx = '';

    for (let j = 0; j < N; j++) {
      if (red[j].x >= blue[i].x) continue;
      if (red[j].y >= blue[i].y) continue;
      if (paired[j] === 1)       continue;
      if (max_y >= red[j].y)     continue;

      max_y = red[j].y;
      idx = j;
    }

    if (idx !== '') paired[idx] = 1;
  }

  const ans = paired.filter(n => n === 1).length;

  console.log(ans);
}

main(require("fs").readFileSync("/dev/stdin", "utf8"));


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

int main() {

    priority_queue<int, vector<int>, greater<int>> que1;
    priority_queue<int> que2;

    int N;
    cin >> N;
    vector<int> a(N*3+1);

    rep(i, N*3) cin >> a[i];

    ll p[N+1], b[N+1];

    ll sum=0;
    int id=0;
    rep(i, N) {
        que1.push(a[i]);
        sum += a[i];
    }
    p[id++] = sum;

    for (int i=N; i<2*N; ++i) {
        sum += a[i];
        que1.push(a[i]);
        int t = que1.top(); que1.pop();
        p[id++] = sum - t;
        sum -= t;
    }

    ll sum2 = 0;
    id=0;
    for (int i=3*N-1; i>=2*N; --i) {
        que2.push(a[i]);
        sum2 += a[i];
    }
    b[id++] = sum2;

    for (int i=2*N-1; i>=N; --i) {
        sum2 += a[i];
        que2.push(a[i]);
        ll t = que2.top(); que2.pop();
        b[id++] = sum2 - t;
        sum2 -= t;
    }

    reverse(b, b+(2*N-(N-1)));

    ll ma = -(1LL << 50);
    rep(i, N+1) {
        ma = max(ma, (ll)p[i] - (ll)b[i]);
    }

    cout << ma << endl;

}


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

int main() {
   int n=0,i;
   double x[20],y[20],a,b,c,s=0,z;
   while(scanf("%lf,%lf",&x[n],&y[n])!=EOF) n++;
   for (i=1;i<n-1;i++) {
	   a=sqrt((x[0]-x[i])*(x[0]-x[i])+(y[0]-y[i])*(y[0]-y[i]));
	   b=sqrt((x[0]-x[i+1])*(x[0]-x[i+1])+(y[0]-y[i+1])*(y[0]-y[i+1]));
	   c=sqrt((x[i]-x[i+1])*(x[i]-x[i+1])+(y[i]-y[i+1])*(y[i]-y[i+1]));
	   z=(a+b+c)/2;
	   s+=sqrt(z*(z-a)*(z-b)*(z-c));
   }
   cout << s << endl;
   return 0;
}

Measured memory_bytes: 1288
#include <iostream>
#include <vector>
#include <unordered_map>
#include <map>
#include <algorithm>
#include <set>
#include <unordered_set>
#include <deque>
#include <cmath>
#include <stack>
#include <queue>

#define endl "\n"

using namespace std;

int n, x;
string s;
char c;

int main(){
    vector<char> v;
    cin >> n >> s;
    for(int i = 0; i < n; i++){
        v.push_back(s[i]);
    }

    for(int i = 0; i < n; i++){
        c = v[i];
        for(int j = i+1; j < n; j++){
            if(v[i] != v[j]){
                x++;
            }
            i = j;
        }
    }

    cout << x+1;


}

//g++ -std=c++14 comp.cpp -o b; ./b.exe


Measured memory_bytes: 768
A,B,C = map(int,input().split())

M = sorted([A,B,C])
ans = 0

#Step 1
ans += M[2]-M[1]
M[0] += M[2]-M[1]
M[1] += M[2]-M[1]

#Step 2
ans += (M[2]-M[0])//2
if (M[2]-M[0])%2==0:
    M[0] += M[2]-M[0]
else:
    M[0] += M[2]-M[0]+1
    M[1] += 1
    M[2] += 1
    ans += 2
    
print(ans)

Measured memory_bytes: 3064
num = int(input())
tranp = [[ i + 1 for i in range(13)] for j in range(4)]
while num > 0:
  cards = input().split()
  cards[0] = 0 * (cards[0] == 'S') + 1 * (cards[0] == 'H') + 2 * (cards[0] == 'C') + 3 * (cards[0] == 'D')
  cards[1] = int(cards[1]) - 1
  tranp[cards[0]][cards[1]] = 0
  num -= 1
s = list(set(tranp[0]))
s.sort()
if len(s) > 1:
  s = s[1:]
  [print(f"S {i}") for i in s]
h = list(set(tranp[1]))
h.sort()
if len(h) > 1:
  h = h[1:]
  [print(f"H {i}") for i in h]

c = list(set(tranp[2]))
c.sort()
if len(c) > 1:
  c = c[1:]
  [print(f"C {i}") for i in c]

d = list(set(tranp[3]))
d.sort()
if len(d) > 1:
  d = d[1:]
  [print(f"D {i}") for i in d]


Measured memory_bytes: 5632
import java.util.*;

public class Main {
    private static Scanner sc = new Scanner(System.in);
    public static void main(String[] args) throws Exception {
        long a = sc.nextLong();
        long b = sc.nextLong();
        long x = sc.nextLong();
        System.out.println(calc(b,x)-calc(a-1,x));
    }
    
    private static long calc(long n, long d) {
        if (n<0) return 0;
        return n/d+1;
    }
}


Measured memory_bytes: 9684
A = list(input())
B = list(input())
C = list(input())

X = 'a'
while True:
  if X == 'a':
    if len(A)==0:
      print('A')
      exit()
    else:
      X = A.pop(0)
  elif X == 'b':
    if len(B)==0:
      print('B')
      exit()
    else:
      X = B.pop(0)
  elif X == 'c':
    if len(C)==0:
      print('C')
      exit()
    else:
      X = C.pop(0)

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

int n,a,b;
pair<int,int> p[100005];

int main() {
  cin >> n;
  rep(i,n){
    cin >> a >> b;
    p[i]=make_pair(b,a);
  }
  sort(p,p+n);
  cout << p[0].first+p[0].second << endl;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int (i)=0;(i)<(n);i++)
#define INF 1001001001
#define LLINF 1001001001001001001
#define MOD 1000000007
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
#define ALL(v) v.begin(), v.end()
typedef long long ll;

int main(){
    int n,m,x;
    cin >> n >> m >> x;
    int c[n],a[n][m],score[m];
    for(int i=0;i<n;i++){
        cin >> c[i];
        for(int j=0;j<m;j++){
            cin >> a[i][j];
        }
    }

    int cost0 = INF;

    for(int bit=0; bit < (1<<n);bit++){
        bool ok = true;
        ll cost=0;
        int sum=0;
        int score[m];rep(l,m)score[l]=0;

        for(int i=0;i<n;i++){
            if(bit & (1<<i)){
                cost = cost +c[i];
                for(int j=0;j<m;j++){
                    score[j] += a[i][j];
                }
            }
        }

        rep(i,m){
            if(score[i]<x)ok = false;
        }

        if(ok){
            if(cost0>cost){
                cost0=cost;
            }
        }

    }
    
    if(cost0 == INF) cout << "-1" << endl;
    else cout << cost0 << endl;
    
    return 0;
}





Measured memory_bytes: 3608
a,b,c,d,e,f = map(int,input().split())
ans = [-1]*10000
# ans[0] = 0
ans[a*100] = 0
ans[b*100] = 0
q1 = a*100
q2 = b*100
p = 0
fin = [a*100,0]
for i in range(1,f+1):
    if ans[i] == -1:
        continue
    if (ans[i]+c)/(i-ans[i]) <= e*0.01:
        ans[i+c] = max(ans[i]+c,ans[i+c])
    if (ans[i]+d)/(i-ans[i]) <= e*0.01:
        ans[i+d] = max(ans[i]+d,ans[i+d])
    ans[i+a*100] = max(ans[i+a*100],ans[i])
    ans[i+b*100] = max(ans[i+b*100],ans[i])
    if i != 0:
        if ans[i]/i > p:
            # print(p,i)
            p = ans[i]/i
            fin = [i,ans[i]]
# print(ans[190:210])
print(*fin)

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

#define N_MAX (1 << 20)
int n;
long long dat[2*N_MAX-1]; //segment tree

void init(int n_) {
    n = 1;
    while(n < n_) n *= 2;
    for(int i=0; i < 2 * n - 1; ++i) dat[i] = 0;
}

void add(int k, int a) {
    k += n - 1;
    dat[k] += a;
    while(k > 0) {
        k = (k - 1) / 2;
        dat[k] = dat[2 * k + 1] + dat[2 * k + 2];
    }
}

long long query(int a, int b, int k=0, int l=0, int r=-1) {
    if(r < 0) r = n;

    if(r <= a || l >= b) return 0;

    if(a <= l && r <= b) return dat[k];
    
    long long vl = query(a, b, 2 * k + 1, l, (l + r) / 2);
    long long vr = query(a, b, 2 * k + 2, (l + r) / 2, r);
    return vl + vr;
}

int main() {
    int N,K;
    cin >> N >> K;
    vector<long long> b(N + 1);
    b[0] = 0;
    for(int i=1; i<=N; ++i) {
        cin >> b[i];
        b[i] -= K;
        b[i] += b[i - 1]; 
    }

    vector<pair<long long, int>> c(N + 1);
    for(int i=0; i<=N; ++i) {
        c[i].first = b[i];
        c[i].second = i;
    }
    sort(begin(c), end(c));
    long long prev = -1;
    int cnt = -1;
    for(int i=0; i<=N; ++i) {
        if(prev == c[i].first) {
            b[c[i].second] = cnt;
        } else {
            b[c[i].second] = ++cnt;
            prev = c[i].first;
        }
    }

    init(N + 1);
    long long res = 0;
    for(int i=0; i<=N; ++i) {
        res += query(0, b[i] + 1);
        add(b[i], 1);
    }
    cout << res << endl;
}

Measured memory_bytes: 11136
n, m = map(int, input().split())
x = [[0] * 2 for _ in range(n)]
AC = WA = 0
for _ in range(m):
    a, b = input().split()
    if x[int(a) - 1][0] == 0 and b == 'WA':
        x[int(a) - 1][1] += 1
    elif x[int(a) - 1][0] == 0 and b == 'AC':
        AC += 1
        WA += x[int(a) - 1][1]
        x[int(a) - 1][0] = 1
print(AC, WA)


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

namespace ABC132
{
    class Program
    {


        static void Main(string[] args)
        {
            string Str = Console.ReadLine().Trim();
            var barray = Encoding.ASCII.GetBytes(Str);
            bool isOK = false;

            // AABB ABAB ABBA
            if ((barray[0] == barray[1])&& (barray[2] == barray[3]))
            {
                isOK = true;
            }
            else if ((barray[0] == barray[2]) && (barray[1] == barray[3]))
            {
                isOK = true;
            }
            else if ((barray[0] == barray[3]) && (barray[1] == barray[2]))
            {
                isOK = true;
            }
            if ((barray[0] == barray[1]) && (barray[0] == barray[2]))
            {
                isOK = false;
            }


            if (isOK)
            {
                Console.WriteLine("Yes");
            }
            else
            {
                Console.WriteLine("No");
            }

        }

    }
}


Measured memory_bytes: 11092
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<tuple>
#include<map>
#include<bitset>
#include<queue>
#define rep(i,n) for (int i=0; i<n; i++)
using namespace std;
using vi = vector<int>;
using vvi = vector<vi>;
using ll = long long;

int main(){
  ll n;
  cin >> n;
  string ans;
  while (n){
    n--;
    ans += 'a'+n%26;
    n /= 26;
  }
  reverse(ans.begin(), ans.end());
  cout << ans << endl;
  return 0;
  }


Measured memory_bytes: 3584
#include <iostream>
#include <string>
using namespace std;
int main()
{
	int l, n;
	cin >> n >> l;
	int s = l * n + n * (n - 1) / 2;
	if (l >= 0) cout << s - l;
	else if (n + l - 1 >= 0) cout << s;
	else cout << s - (n + l - 1);
	return 0;
}


Measured memory_bytes: 256