akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
using namespace std;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef long long ll;

const int N = 2e5+5;
int A[N]={};

int main() {
	int n,m;
	scanf("%d%d",&n,&m);
	while(m--) {
		int a,b;
		scanf("%d%d",&a,&b);
		if(a == 1) ++A[b];
		if(b == n) ++A[a];
	}
	for(int i = 2; i < n; ++i)
		if(A[i] == 2) {
			printf("POSSIBLE\n");
			return 0;
		}
	printf("IMPOSSIBLE\n");
}

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

using namespace std;

int main()
{
    int n;

    bool dp[30][2000];
    int a[30];

    while(scanf("%d",&n)!=EOF)
    {
        for(int i=1;i<=n;i++)
        {
            scanf("%d",&a[i]);
        }

        int w;
        int q;

        scanf("%d",&q);

        while(q--)
        {
            scanf("%d",&w);
            for(int i=0;i<=n;i++)
            {
                memset(dp[i],0,sizeof(dp[i]));
            }

            for(int i=0;i<=n;i++)
            {
                dp[i][0]=true;
            }

            for(int i=1;i<=n;i++)
            {
                for(int j=0;j<=w;j++)
                {
                    dp[i][j]|=dp[i-1][j];
                    if(j>=a[i])
                    {
                        dp[i][j]|=dp[i-1][j-a[i]];
                    }
                }
            }
            if(dp[n][w])
            {
                cout<<"yes"<<endl;
            }else
            {
                cout<<"no"<<endl;
            }
        }
    }



    return 0;
}



Measured memory_bytes: 3204
def main():
    from collections import deque
    S = input()
    Q = int(input())
    S = deque(S)
    flag = False
    for query in range(Q):
        a, *bc = (i for i in input().split())
        # print(a, bc)
        if a == "1":
            flag = not(flag)
        else:
            if flag:
                if bc[0] == "1":
                    S.append(bc[1])
                elif bc[0] == "2":
                    S.appendleft(bc[1])
            else:
                if bc[0] == "1":
                    S.appendleft(bc[1])
                elif bc[0] == "2":
                    S.append(bc[1])
    S = "".join(S)
    if flag:
        S = S[::-1]
    print(S)


if __name__ == '__main__':
    main()


Measured memory_bytes: 8684
#include <iostream>
#include <algorithm>

using namespace std;

int main()
{
    int a, c;
    cin >> a >> c;
    if ((a%2==1 && c%2==0) || (a%2==0 && c%2==1)) {
        cout << "IMPOSSIBLE" << endl;
        exit(0);
    }
    cout << abs(a+c)/2 << endl;
    
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
typedef pair<int,int>P;
 
int main() {
  ll a,count,count2;
  cin>>a;
  vector<ll>v1(a);
  vector<ll>v11(a);
  for(ll i=0;i<a;i++){
    cin>>v1.at(i);
    v11.at(i)=v1.at(i);
  }
  sort(v1.begin(),v1.end());
  count=0,count2=0;
  vector<ll>v2(a);
  ll d,sum;
  sum=0;
  for(ll k=0;k<a;k++){
    if(k==0){
      count2++;
       d=v1.at(k);
    }
    else{
      if(d==v1.at(k)){
        count2++;
        if(k==a-1){
          v2.at(d-1)=count2;
          sum+=count2*(count2-1)/2;
        }
      }
      else{
        v2.at(d-1)=count2;
        d=v1.at(k);
        sum+=count2*(count2-1)/2;
        count2=1;
      }
    }
  }
  
  for(ll j=0;j<a;j++){
    if(v2.at(v11.at(j)-1)>=2){
      cout<<sum-(v2.at(v11.at(j)-1)-1)<<endl;
    }
    else{
      cout<<sum<<endl;
    }
  }
}

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

#define rep2(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) rep2(i, 0, n)
#define all(a) a.begin(), a.end()
using ll = long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vvvi = vector<vector<vector<int>>>;
using mii = map<int, int>;
using msi = map<string, int>;
using pii = pair<int, int>;

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

    int n, k;
    cin >> n >> k;
    double ans = 0;
    rep2(i, 1, n + 1) {
        int cnt = 0;
        int s = i;
        while(s < k) {
            s *= 2;
            cnt++;
        }
        ans += 1.0 / (s / i);
    }
    ans /= n;
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>

using namespace std;

string s;

int main () {
    cin >> s;
    if(s == "Sunny") cout << "Cloudy" << endl;
    if(s == "Cloudy") cout << "Rainy" << endl;
    if(s == "Rainy") cout << "Sunny" << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define FAST ios_base::sync_with_stdio(false);cin.tie();cout.tie();
#define FILE_READ_IN freopen("input.txt","r",stdin);
#define FILE_READ_OUT freopen("output.txt","w",stdout);
using namespace std;
typedef long long ll;
int main(){
   #ifndef ONLINE_JUDGE 
      FILE_READ_IN 
      FILE_READ_OUT 
   #endif
    int n,l; cin>>n>>l;
    vector<string> v;
    for(int i=0;i<n;i++)
    {
        string s; cin>>s;
        v.push_back(s);
    }
   sort(v.begin(),v.end());
   for(auto x:v)
    cout<<x;
    cout<<"\n";
   return 0;
}

Measured memory_bytes: 3576
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <set>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <cstdio>
#include <cstring>
#include <iterator>
#include <bitset>
#include <unordered_set>
#include <unordered_map>
#include <fstream>
#include <iomanip>
#include <cassert>
//#include <utility>
//#include <memory>
//#include <functional>
//#include <deque>
//#include <cctype>
//#include <ctime>
//#include <numeric>
//#include <list>
//#include <iomanip>

//#if __cplusplus >= 201103L
//#include <array>
//#include <tuple>
//#include <initializer_list>
//#include <forward_list>
//
//#define cauto const auto&
//#else

//#endif

using namespace std;


typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;

#define VV(T) vector<vector< T > >

template <class T>
void initvv(vector<vector<T> > &v, int a, int b, const T &t = T()){
    v.assign(a, vector<T>(b, t));
}

template <class F, class T>
void convert(const F &f, T &t){
    stringstream ss;
    ss << f;
    ss >> t;
}

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define reep(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) reep((i),0,(n))
#define ALL(v) (v).begin(),(v).end()
#define PB push_back
#define F first
#define S second
#define mkp make_pair
#define RALL(v) (v).rbegin(),(v).rend()
#define DEBUG
#ifdef DEBUG
#define dump(x)  cout << #x << " = " << (x) << endl;
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
#else
#define dump(x) 
#define debug(x) 
#endif

#define MOD 1000000007LL
#define EPS 1e-8
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3fLL
#define maxs(x,y) x=max(x,y)
#define mins(x,y) x=min(x,y)

void mainmain(){
	int n;
	scanf("%d", &n);
	// cout<<n<<endl;
	vll v(n);
	vint op(n);
	op[0]=1;
	int cnt = 0;
	rep(i,n){
		if(i){
			char t;
			scanf(" %c %lld", &t, &v[i]);
			if(t=='+') op[i]=1;
			else op[i]=-1,cnt++;
		}
		else{
			scanf("%lld", &v[i]);
		}
	}
	if(cnt<=1){
		ll sum = 0;
		rep(i,n){
			sum+=op[i]*v[i];
		}
		cout<<sum<<endl;
		return;
	}
	vll s(n+1);
	for(int i=n-1;i>=0;i--){
		if(i==n-1) s[i]=v[i];
		else{
			s[i]=s[i+1]+v[i];
		}
	}
	ll ans = -INFL;
	ll sum = 0;
	rep(i,n){
		sum+=op[i]*v[i];
	}
	ans=sum;
	sum=0;
	rep(i,n){
		if(op[i]==-1){
			ll t = v[i];
			int p = i;
			p++;
			while(p<n&&op[p]==1){
				t+=v[p];
				p++;
			}
			if(p==n){
				break;
			}
			maxs(ans, sum+(-t+s[p]));
			sum-=v[i];
		}
		else{
			sum+=v[i];
		}
	}
	cout<<ans<<endl;
}


signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout<<fixed<<setprecision(20);
    mainmain();
}

Measured memory_bytes: 2176
#include <iostream>
#include <algorithm>
using namespace std;
int main(){
int N , X , m[101];
cin >> N >> X;
int S = 0, M = 1001001001;
for(int i = 0;i < N;i++){
    cin >> m[i];
    S+=m[i];
    if(m[i] < M){
        M = m[i];
    }
}
int ans = N + (X - S) / M;
cout << ans << endl;
return 0;
}

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

int main()
{
	int n,k; cin>>n>>k;
	vector<int> stone(n),m(n);
	for(int i=0;i<n;i++) cin>>stone[i];
	m[0]=0; m[1]=abs(stone[0]-stone[1]);
	for(int i=2;i<n;i++)
	{
        m[i]=INT_MAX;
		for(int j=i-1;j>=max(i-k,0);j--)
		{
			int t=m[j]+abs(stone[j]-stone[i]);
			m[i]=min(m[i],t);
		}
	}
	cout<<m[n-1]<<"\n";
	return 0;
 } 


Measured memory_bytes: 1152
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using static System.Math;
using MethodImplAttribute = System.Runtime.CompilerServices.MethodImplAttribute;
using MethodImplOptions = System.Runtime.CompilerServices.MethodImplOptions;

public static class P
{
    public static void Main()
    {
        var hwk = Console.ReadLine().Split().Select(int.Parse).ToArray();
        var h = hwk[0];
        var w = hwk[1];
        var k = hwk[2];
        var map = Enumerable.Repeat(0, h).Select(_ => Console.ReadLine()).ToArray();
        var res = Enumerable.Repeat(0, h).Select(_ => new int[w]).ToArray();
        int[] firstArr = null;
        int[] curArr = null;
        int id = 0;
        for (int i = 0; i < map.Length; i++)
        {
            if (!map[i].Contains('#'))
            {
                res[i] = curArr;
                continue;
            }
            bool isFirst = true;
            id++;
            for (int j = 0; j < map[i].Length; j++)
            {
                if (map[i][j] == '#')
                {
                    if (isFirst) isFirst = false;
                    else id++;
                }
                res[i][j] = id;
            }
            if (firstArr == null) firstArr = res[i];
            curArr = res[i];
        }
        for (int i = 0; i < res.Length; i++)
        {
            if (res[i] != null) break;
            res[i] = firstArr;
        }

        Console.WriteLine(string.Join("\n", res.Select(x => string.Join(" ", x))));
    }
}


Measured memory_bytes: 21596
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <numeric>
#include <map>
#include <iomanip>


using namespace std;    
typedef long long ll;
typedef pair<ll, ll> pll;
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
const bool DEBAG = false;

int money(int x){
    if(x == 3) return 100000;
    if(x == 2) return 200000;
    if(x == 1) return 300000;

    return 0;

}

int main(){

    int x, y;
    cin >> x >> y;

    int ans = 0;

    ans += money(x);
    ans += money(y);
    if(x == 1 && y == 1){
        ans += 400000 ;
    }

    cout << ans << endl;


}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define sz(a) (int)(a.size())
#define pb push_back
#define all(c) c.begin(),c.end()
#define tr(it,a,c) for(auto it=c.begin()+a;it!=c.end();it++)
#define fr(i,a,n)	for(int i=a;i<n;i++)
#define present(c,x) (c.find(x)!=c.end()) //for set/map etc.
#define cpresent(c,x) (find(all(c),x)!=c.end())
typedef pair<int,int> pi;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<long long> vll;
typedef vector<pair<int,int>> vp;
int N=100001;
int mod=1e9+7;


int min(int a,int b){if(a<b) return a; else return b;}
int max(int a,int b){if(a>b) return a; else return b;}
int power(int a,int b){int res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
int gcd(int p, int q){if(p%q==0) return q; else{return gcd(q,p%q);}} 
bool comp(int a, int b) 
{ 
    return (a > b); 
}

bool comp1(pi a, pi b)
{
	if(a.first==b.first)return a.second<b.second;
	else return a.first>b.first;
}

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

template<typename T> 
ostream& operator<<(ostream& out, vector<T>& v)
{
	for (T& x : v) out << x<<" "; return out;
}

// template<typename T>
int sum1(vector<int>& v)
{
	int sum=0;
	// for(auto x: v)sum+=x;
	fr(i,0,v.size())sum+=v[i];
	return sum;
}





 void solve()
{
	int n;
	cin>>n;
	if(n==0)cout<<1;
	else cout<<0;
}

signed main()
{
	// #ifndef ONLINE_JUDGE
	// freopen("input.txt","r",stdin);
	// freopen("output.txt","w",stdout);
	// #endif
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	// int t;
	// cin>>t;
	// while(t--)
	// {
	// 	solve();
	// 	cout<<endl;
	// }
	solve();
	return 0;	
} 	

Measured memory_bytes: 3612
#include <bits/stdc++.h>
using namespace std;
long long n,k;
bool judge(vector < int > &tag)
{
    long long x=n;
    while(x)
    {
        if (tag[x%10]) return false;
        x/=10;
    }
    return true;
}
void solve()
{
    vector < int > tag(10,0);
    while(k--)
    {
        long long x;
        cin>>x;
        tag[x]=1;
    }
    do
    {
        if (judge(tag)) break;
    }while(n++);
    cout<<n<<endl;
}
int main()
{
    while(cin>>n>>k)
        solve();
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here! 
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        
        long ans = 0;
        while (n-- > 0) {
            ans += (sc.nextInt()-1);
        }
        System.out.println(ans);
    }
}

Measured memory_bytes: 25680
def main():
    n = int(input())
    h = list(map(int, input().split(' ')))

    ans = True
    MAX = h[0]
    for i in range(n):
        if h[i] > MAX:
            MAX = h[i]
        elif h[i] < MAX - 1:
            ans = False
        else:
            continue
        
    print('Yes' if ans else 'No')


if __name__ == '__main__':
    main()


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

int main() {
    string s;
    while (getline(cin, s)) {
        if (s == ".") break;
        stack<char> st;
        st.push('@');
        for (char c : s) {
            if (st.top() == '(' && c == ')') {
                st.pop();
            } else if (st.top() == '[' && c == ']') {
                st.pop();
            } else if (c == '(' || c == '[' || c == ')' || c == ']') {
                st.push(c);
            }
        }
        if ((int)st.size() == 1) {
            cout << "yes" << endl;
        } else {
            cout << "no" << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 1180
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define Would
#define you
#define please

const int cm = 1 << 17;
char cn[cm], * ci = cn + cm, ct;
inline char getcha() {
	if (ci - cn == cm) { fread_unlocked(cn, 1, cm, stdin); ci = cn; }
	return *ci++;
}
inline int getint() {
	int A = 0;
	if (ci - cn + 16 > cm) while ((ct = getcha()) >= '0') A = A * 10 + ct - '0';
	else while ((ct = *ci++) >= '0') A = A * 10 + ct - '0';
	return A;
}

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


	int N = getint();
	int A[200000];
	rep(i, N) A[i] = getint();

	ll ABM[200000], ABm[200000];
	ll keiAB = A[0], keiA = A[0];
	int p = 0;

	for (int i = 1; i < N - 2; i++) {
		keiAB += A[i];
		while (p + 1 < i && keiA + A[p + 1] + A[p + 1] < keiAB - keiA) {
			p++;
			keiA += A[p];
		}
		ll kari;
		if (p + 1 < i) kari = min(abs(keiAB - keiA - keiA), abs(keiAB - keiA - keiA - A[p + 1] - A[p + 1]));
		else kari = abs(keiAB - keiA - keiA);
		ABM[i] = keiAB + kari;
		ABm[i] = keiAB - kari;
	}

	ll kotae = 1e18;
	ll keiCD = A[N - 1], keiD = A[N - 1];
	p = N - 1;
	for (int i = N - 2; i >= 2; i--) {
		keiCD += A[i];
		while (p - 1 > i && keiD + A[p - 1] + A[p - 1] < keiCD - keiD) {
			p--;
			keiD += A[p];
		}
		ll kari;
		if (p - 1 > i) kari = min(abs(keiCD - keiD - keiD), abs(keiCD - keiD - keiD - A[p - 1] - A[p - 1]));
		else kari = abs(keiCD - keiD - keiD);

		kotae = min(kotae, max(ABM[i - 1], keiCD + kari) - min(ABm[i - 1], keiCD - kari));
	}
	co(kotae / 2);

	Would you please return 0;
}

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

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

using ll = long long;

const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int INF = 1<<30;
const ll mod = 1000000007LL;

int main() {
  int H,W;
  cin>>H>>W;
  queue<pair<int,int>> q;
  vector<vector<bool>> seen(H,vector<bool>(W));
  for(int i = 0; i < H; i++){
    for(int j = 0; j < W; j++){
      char c;
      cin>>c;
      if(c=='#') {
        q.push(make_pair(i,j));
        seen[i][j]=true;
      }
    }
  }
  int ans = -1;
  while(!q.empty()){
    queue<pair<int,int>> nq;
    int s = q.size();
    for(int i = 0; i < s;i++){
      pair<int,int>p=q.front();
      q.pop();
      for(int j = 0; j < 4; j++){
        int nx = p.first+dx[j];
        int ny = p.second+dy[j];
        if(nx>=H||nx<0||ny>=W||ny<0) continue;
        if(seen[nx][ny]) continue;
        seen[nx][ny]=true;
        nq.push(make_pair(nx,ny));
      }
    }
    q=nq;
    ans++;
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 8832
import java.util.Scanner;

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

        int N = sc.nextInt();
        int[] a = new int[N];

        for (int i = 0; i < N; i++) {
            a[i] = sc.nextInt();
        }
        long result = 0L;
        for (int i = 0; i <N; i++) {
            result = result + (a[i] - 1);
        }
        System.out.println(result);

    }
}


Measured memory_bytes: 25060
(defun solve (b)
  (let ((max-length 0)
        (length 0))
    (loop :for x :across b
          :do (cond
                ((or
                  (string-equal x "A")
                  (string-equal x "T")
                  (string-equal x "G")
                  (string-equal x "C"))
                 (setf length (1+ length))
                 (setf max-length (max length max-length)))
                (t (setf length 0))))
    max-length))

(defun main ()
  (let ((b (read-line)))
    (format t "~A~%" (solve b))))

(main)


Measured memory_bytes: 13284
//前置き
#pragma region

#include<iostream>
#include<cstdio>
#include<cmath>
#include<string>
#include<vector>
#include<list>
#include<algorithm>
#include<set>
#include<map>
#include<stack>
#include<queue>

using namespace std;

typedef  long long ll;

#define pb(a) push_back(a)
#define all(x) (x).begin(),(x).end()

#define FOR(i, a, n) for(int i = (int)(a); i < (int)(n); ++i)
#define REP(i, n) FOR(i, 0, n)
#define SORT(a) sort(all(a))
#define REVERSE(a) reverse(all(a))

#define PRINT(str) printf(#str "\n")
#define yOUT PRINT(Yes)
#define nOUT PRINT(No)
#define YOUT PRINT(YES)
#define NOUT PRINT(NO)

#pragma endregion

//関数定義
#pragma region 
//偶数 ->　true :: 奇数　-> false
bool EVEN(ll a){
    return a%2-1;
}

//最大公約数
ll gcd(ll a, ll b) {  
    if (!b)  
        return a;  
    return gcd(b, a%b);  
}  

//最小公倍数
ll lcm(ll a, ll b) {  
    return a*b/gcd(a,b);  
} 

#pragma endregion

int main(){
    string s;
    ll k;
    cin >> s >> k;
    REP(i, s.size()){
        if(s[i] != '1' || k-1 == i){
            cout << s[i] << endl;
            return 0;
        }
    }
}




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

#define int long long
#define pb push_back 
#define mp make_pair
#define fr first
#define sc second
#define Rep(i, n) for( int i = 0; i < (n); i++ )
#define Rrep(i, a, n) for( int i = (a); i < (n); i++ )
#define All(v) v.begin(), v.end()

typedef pair<int, int> Pii; 
typedef pair<int, Pii> Pip;
const int INF = 1107110711071107;

signed main() {
  int N;
  int d[301][301];
  int e[301][301];
  int ans = 0;

  cin >> N;
  Rep(i, N) Rep(j, N) cin >> d[i][j], e[i][j] = d[i][j];

  Rep(i, N) Rep(j, N) {
    bool flag = true;
    Rep(k, N) {
      if ( i != k && j != k && d[i][j] == d[i][k] + d[k][j] ) flag = false;
      e[j][k] = min(e[j][k], e[j][i] + e[i][k]);
    }
    if ( flag ) ans += d[i][j];
  }

  bool flag = true;
  Rep(i, N) Rep(j, N) if ( d[i][j] != e[i][j] ) flag = false;

  if ( flag ) cout << ans / 2 << endl;
  else cout << -1 << endl;
  
  return 0;
}


Measured memory_bytes: 1664
#include<bits/stdc++.h>
typedef long long ll;
#define forin(in, n) for(int i=0; i<n; i++) cin>>in[i]
using namespace std;

int main(){
    int a, b, c; cin>>a>>b>>c;
    if(a<b && b<c){
        cout<<"Yes"<<endl;
    }else{
        cout<<"No"<<endl;
    }
}



Measured memory_bytes: 3076
# AtCoder Beginner Contest 146
# E - Rem of Sum is Num
# https://atcoder.jp/contests/abc146/tasks/abc146_e
from collections import defaultdict
N, K = map(int, input().split())
*A, = map(int, input().split())

A = [0]+A
d = []
c = defaultdict(int)
x = 0
ans = 0
for i, a in enumerate(A):
    x += a - 1
    x %= K

    d.append(x)
    if i-K >= 0:
        c[d[i-K]] -= 1
    ans += c[x]
    c[x] += 1

print(ans)

Measured memory_bytes: 139364
#include <iostream>

int main()
{
	int A, B, C, D, out;
	std::cin >> A;
	std::cin >> B;
	std::cin >> C;
	std::cin >> D;
	out = A*B > C*D ? A*B : C*D;
	std::cout << out << std::endl;
	
    return 0;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_DEPRECATE
#pragma comment(linker, "/STACK:128777216")

#include <iostream>
#include <cstdlib>
#include <cstdio>
#include <sstream>

#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <bitset>
#include <queue>
#include <deque>
#include <stack>

#include <math.h>
#include <cmath>
#include <string>
#include <cstring>
#include <string.h>

#include <memory.h>
#include <cassert>
#include <time.h>
#include <functional>

using namespace std;

#define forn(i,n) for (int i = 0; i < (int)(n); i++)
#define fornd(i, n) for (int i = (int)(n) - 1; i >= 0; i--)
#define forab(i,a,b) for (int i = (int)(a); i <= (int)(b); i++)
#define forabd(i, b, a) for (int i = (int)(b); i >= (int)(a); i--)
#define forit(i, a) for (__typeof((a).begin()) i = (a).begin(); i != (a).end(); i++)

#define _(a, val) memset (a, val, sizeof (a))
#define sz(a) (int)((a).size())
#define pb push_back
#define mp make_pair
#define all(v) (v).begin(), (v).end()

typedef long long lint;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pii;
typedef vector<int> vii;

const lint LINF = 1000000000000000000LL;
const int INF = 1000000000;
const long double eps = 1e-9;
const long double PI = 3.1415926535897932384626433832795l;

#ifdef MY_DEBUG
#define dbgx( x ) { cerr << #x << " = " << x << endl; }
#define dbg( ... ) { fprintf(stderr, __VA_ARGS__); fflush(stderr); }
#else
#define dbgx( x ) {  } 
#define dbg( ... ) {  } 
#endif

void prepare(string s) {
#ifdef MY_DEBUG
  freopen("input.txt", "r", stdin);
  //freopen ("output.txt", "w", stdout);
#else
  //freopen("input.txt", "r", stdin);
  //freopen ("output.txt", "w", stdout);
#endif
}

int a, b, c;

void read() {
  scanf("%d %d %d", &a, &b, &c);
  printf("%s\n", (a + b >= c)? "Yes" : "No");
}

void solve() {

}

int main() {
  prepare("");

  read();
  solve();
  dbg("Clock = %.3f\n", clock() / (double)CLOCKS_PER_SEC);
  return 0;
}

Measured memory_bytes: 256
n = gets.to_i
a = 2.times.map { gets.split.map(&:to_i) }

cs = a[0][0] + a[1].reduce(0, &:+)
max_cs = cs
(1..(n - 1)).each do |i|
  cs = cs - a[1][i - 1] + a[0][i]
  max_cs = [max_cs, cs].max
end

puts max_cs

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

int bit[100001] = {},n;

int sum(int i){
	int s = 0;
	while(i > 0){
		s += bit[i];
		i -= i & -i;
	}
	return s;
}

void add(int i,int x){
	while(i <= n){
		bit[i] += x;
		i += i & -i;
	}
}

int main(){
	int q;
	cin >> n >> q;
	for(int i = 0;i < q;i++){
		int a,b,c;
		cin >> a >> b >> c;
		if(a == 0){
			add(b,c);
		}else{
			cout << sum(c) - sum(b - 1) << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 3480
#include<iostream>
using namespace std;
int main() {
	int t[111], n, s, f, ans[111], an;
	an = 0;
	while (1) {
		an = an + 1;
		cin >> t[an];
		if (t[an] == 0) {
			an = an - 1;
			goto a;
		}
		cin >> n;
		ans[an] = 0;
		for(int i=1;i<=n;i++){
			cin >> f >> s;
			ans[an] = ans[an] + s-f;
		}
	}
a:;
	for (int i = 1; i <= an; i++) {
		if (ans[i] >= t[i]) {
			cout << "OK" << endl;
		}
		else {
			cout << t[i] -ans[i] << endl;
		}
	}
}


Measured memory_bytes: 3132
#include <stdio.h>
#include <iostream>
#include <algorithm>

int main(){
  long a;
  long b[5];
  scanf("%ld", &a);
  for(int i=0;i<5;i++){
    scanf("%ld", &b[i]);
  }
  std::sort(b, b+5);
  long r = a / b[0];
  if(a%b[0] != 0){
    r = r + 1;
  }
  r = 5 + (r - 1);
  printf("%ld\n", r);
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,b,a) for(int i=b;i>=a;i--)
#define fori(a) for(auto i : a )
#define all(a) begin(a), end(a)
#define set(a,b) memset(a,b,sizeof(a))
#define sz(a) a.size()
// #define pi 3.14159
#define ll long long
#define ull unsigned long long
#define pb push_back
#define PF push_front //deque
#define mp make_pair
#define pq priority_queue
#define mod 1000000007
#define f first
#define s second
#define pi pair<int,int>
#define pii pair< int, pi >
#define vi vector<int>
#define vpii vector<pii>
#define debug(v) for(auto i:v) cout<<i<<" ";
#define tc int t; cin >> t; while(t--)

using namespace std;
using namespace std::chrono;

string repeat(string s, int n) {
    string s1 = "";
    for (int i=0; i<n;i++)
        s1+=s;
    return s1;
}
string getString(char x) {
    string s(1, x);
    return s;
}

void optimizeIO(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
}
int gcd(int a, int b){
    if (a == 0)  return b;
    return gcd(b % a, a);
}
struct dsu{
  vector<ll> par,rank;
  dsu(ll n):rank(n,1),par(n,1){
    rep(i,0,n) par[i]=i;
  }
  ll root(ll a){
    if(a==par[a]) return a;
    return par[a]=root(par[a]);
  }
  void merge(ll a, ll b){
    a=root(a);
    b=root(b);
    if(rank[a]<rank[b]) swap(a,b);
    par[b]=a;
    rank[a]+= rank[b];
  }
};
void solve(){
  int n,m,x,y;
  cin>>n>>m;
  dsu d(n);
  rep(i,0,m){
    cin>>x>>y;
    d.merge(x-1,y-1);
  }
  vector<int> grp(n,-1);  map<int,int> m1;

  rep(i,0,n) { grp[i]=d.root(i);m1[grp[i]]++;}
  int mx=0;
  for(auto i:m1){
    mx=max(mx,i.second);
  }
  cout<<mx<<endl;
}
int main(){
    optimizeIO();
    // tc
    { solve();
    }
}


Measured memory_bytes: 16252
#include <iostream>
#include <algorithm>
#include <limits>
#include <vector>
#include <map>
#include <cmath>
#include <limits>
#include <iomanip>
#include <queue>
#include <string.h>
#include <bitset>
#define ll long long int
#define ld long double
#define rep(i,n) for(int i = 0;i < n;i++)
#define rep1(i,n) for(int i = 1;i < n;i++)
#define co(x) cout << x << endl
#define cosp(x) cout << x << " "
#define all(x) x.begin(),x.end()
#define allr(x) x.begin(),x.end(),greater<int>()
#define P pair<ll,ll>
#define pb push_back
#define mp make_pair
#define MOD 1000000007
#define INF 1ll << 60
#define PI 3.14159265359

using namespace std;

int main(){
	ll n;
	cin >> n;
	ll ans = 0;
	ll tmp = n;
	ll tmp1 = 10;
	if(n%2 == 1) cout << 0 << endl;
	else{
		tmp = n;
		while(tmp/tmp1 > 0){
			ans += (tmp/tmp1);
			tmp1 *= 5;
		}
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);

		int A = scan.nextInt();
		int B = scan.nextInt();
		int C = scan.nextInt();
		int D = scan.nextInt();

		while (true) {
			C = atk(B, C);
			if (C <= 0) {
				System.out.println("Yes");
				break;
			} else {
				A = atk(D, A);
				if (A <= 0) {
					System.out.println("No");
					break;
				}
			}
		}


	}

	public static int atk(int atk, int hp) {

		hp -= atk;

		return hp;
	}

}



Measured memory_bytes: 35920
#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 n;
  string s;
  cin >> n >> s;
  int ans = 0;
  rep(i, n) {
    vector<int> x(26, 0), y(26, 0);
    rep(j, i) x[s[j] - 'a'] = 1;
    for (int j = i; j < n; ++j) y[s[j] - 'a'] = 1;
    int c = 0;
    rep(j, 26) if (x[j] * y[j] == 1) ++c;
    ans = max(ans, c);
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3604
#include <bits/stdc++.h>
using namespace std;
#define ll          long long
#define mp	    make_pair
#define pb          push_back
#define pii         pair<int,int>
#define vi          vector<int>
#define vii         vector<pii>
#define mi          map<int,int>
#define mii         map<pii,int>
#define all(a)      (a).begin(),(a).end()
#define x           first
#define y           second
#define sz(x)       (int)x.size()
#define endl        '\n'
#define MOD        1000000007
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define gcd(a,b)    __gcd((a),(b))
#define lcm(a,b)    ((a)*(b)) / gcd((a),(b))
#define rep(i,a,b)  for(int i=a;i<b;i++)
ll mult(ll a,ll b, ll p=MOD){return ((a%p)*(b%p))%p;}
ll multbig(ll a,ll b,ll mod){
    if(a==0 or b==0) return 0;
    if(a==1 or b==1) return (a*b)%mod;
    ll cur=multbig(a,b/2,mod);
    cur=(2*cur)%mod;
    if(b%2) cur=(cur+a)%mod;
    return cur;
}
ll add(ll a, ll b, ll p=MOD){return (a%p + b%p)%p;}
ll fpow(ll n, ll k, ll p = MOD) {ll r = 1; for (; k; k >>= 1LL) {if (k & 1LL) r = mult(r,n,p); n = mult(n,n,p);} return r;}
ll inv(ll a, ll p = MOD) {return fpow(a, p - 2, p);}
ll inv_euclid(ll a, ll m = MOD){ll m0 = m;ll y = 0, x = 1;if (m == 1)return 0;while (a > 1){ll q = a / m;ll t = m;m = a % m, a = t;t = y;y = x - q * y;x = t;}if (x < 0)x += m0;return x;}

void solve(){
	string s, t;
	cin>>s>>t;
	rep(i,0,sz(s)){
		string ans = s.substr(i, sz(s)-i) + s.substr(0, i);
		if(ans == t){
			cout<<"Yes"<<endl;
			return;
		}
	}
	cout<<"No"<<endl;
}
signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int t;
    t =1;
//     cin>>t;
    while(t--){
        solve();
    }
    return 0;
}


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

#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl "\n"
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()

using namespace std;
using ll = long long;

const double PI = 3.14159265358979;

void solve()
{
  int a, b;
  cin >> a >> b;
  cout << ((a*b*(a+b)) % 3 == 0 ? "Possible" : "Impossible");
}

int main()
{
  fastio;
  solve();

  return 0;
}

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

int main(){
  int N;
  cin >> N;
  
  vector<int> vec(N);
  for(int i=0; i<N; i++){
    cin >> vec.at(i);
  }
  
  sort(vec.begin(), vec.end());
  reverse(vec.begin(), vec.end());
  
  int sum = 0;
  for(int i=0; i<N; i+=2 ){
    
    if(i+1 == N){
      sum += vec.at(i);
        break;
    }
    sum += vec.at(i) - vec.at(i+1);
  }
  
  cout << sum << endl;
}
  

Measured memory_bytes: 256
/****************************************************
*   Template for coding contests                    *
*   Author    :    Sanjeev Sharma                   *
*   Email     :    thedevelopersanjeev@gmail.com    *
*****************************************************/
#include <bits/stdc++.h>
using namespace std;

#define deb(x) cout << #x << " is " << x << "\n";

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    string s;
    cin >>s;
    int n = s.size();
    for(int i = 0; i < n; i++)
    	cout <<"x";
	return 0;
}


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

int main(){
  int n, s, sum, max, min;
  while(1){
    cin >> n;
    if(n == 0) break;
    sum = 0;
    cin >> s;
    sum += s;
    max = s;
    min = s;
    cin >> s;
    sum += s;
    if(max < s){
      max = s;
    }else{
      min = s;
    }
    for(int i = 2; i < n; i++){
      cin >> s;
      sum += s;
      if(max < s){
	max = s;
      }else if(min > s){
	min = s;
      }
    }
    sum -= max;
    sum -= min;
    int ave = sum / (n-2);

    cout << ave << endl;
  }

  return 0;
}

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

int main() 
{
	int h;
	cin >> h;
	int w;
	cin >> w;
	vector<string> a(h);
	for (int i = 0; i < h; i++) {
		cin >> a[i];
	}
	vector<bool> row(h, false);
	vector<bool> col(w, false);
	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) {
			if (a[i][j] == '#') {
				row[i] = true;
				col[j] = true;
			}
		}
	}
	for (int i = 0; i < h; i++) {
		if (row[i]) {
			for (int j = 0; j < w; j++) {
				if (col[j]) {
					cout << a[i][j];
				}
			}
			cout << endl;
		}
	}
}

Measured memory_bytes: 3608
def xyz(a,b,c,k):
    if k==a:
        return(k)
    if a>k:
        return(k)
    sum1=a
    if a+b>=k:
        return(a)
    d=k-a-b
    sum1=sum1-d
    return(sum1)
    
    


a,b,c,k=list(map(int,input().split()))
d=xyz(a,b,c,k)
print(d)


Measured memory_bytes: 9076
str = list(input())
for _ in range(int(input())):
    cmd = input().split()
    a, b = map(int, cmd[1:3])
    if cmd[0] == 'print':
        for i in range(a, b + 1):
            print(str[i], end='')
        print('')
    if cmd[0] == 'reverse':
        str = str[:a] + list(reversed(str[a:b + 1])) + str[b + 1:]
    if cmd[0] == 'replace':
        p = cmd[3]
        str = str[:a] + list(p) + str[b + 1:]

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

int main(void){
    int n;
    scanf("%d",&n);
    char s[10];
    map<string, int> mp;
    for(int i=0;i<n;i++){
        scanf("%s",&s[0]);
        auto itr = mp.find(s);
        if(itr == mp.end()){
            mp[s]=1;
        }
    }
    printf("%d\n",mp.size());
    return(0);
}

Measured memory_bytes: 19368
n = int(raw_input())
a = raw_input()
b = raw_input()

arr_a = [int(x) for x in a.strip().split()]
arr_b = [int(x) for x in b.strip().split()]

c_max = 0
for i in range(n):
    c = sum(arr_a[0:i + 1]) + sum(arr_b[i:])
    if c > c_max:
        c_max = c

print c_max


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

#define int         long long
const int m=1e9+7;
using namespace std;
int expo(int base,int exponent,int mod){
    int ans=1;
    while(exponent!=0){
        if(exponent&1) ans=(1LL*ans*base)%mod;
        base=(1LL*base*base)%mod;
        exponent>>=1;
    }
    return ans%mod;
}
int n,k,a[100005],ans;
void solve(){
	cin>>n>>k;
	for(int i=k;i>=1;i--){
		a[i]=k/i;
		a[i]=expo(a[i],n,m);
		for(int j=2*i;j<=k;j+=i){
			a[i]=(a[i]-a[j]+m)%m;
		}
		ans=(ans+a[i]*i)%m;
	}
	cout<<ans<<endl;
}

signed main(){
    ios::sync_with_stdio(false);
    
       solve();
    
    return 0;
}


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

using namespace std;

int grid[3][105];

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  for(int i=1; i<=2; i++){
    for(int j=1; j<=n; j++){
      cin >> grid[i][j];
    }
  }
  for(int i=1; i<=2; i++){
    for(int j=1; j<=n; j++){
      if(i==1 && j==1) continue;
      if(i == 1 && j > 1) grid[i][j] += grid[i][j-1];
      else if(j == 1 && i > 1) grid[i][j] += grid[i-1][j];
      else grid[i][j] += max(grid[i-1][j], grid[i][j-1]);
    }
  }
  cout << grid[2][n] << endl;
  return 0;
}


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

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        System.out.println(solve(in));
        
      }
      
      public static String solve(Scanner in) {
        String K = in.next();
        for (int i = 0; i < K.length(); i++) {
          if (K.charAt(i) == '7') return "Yes";
        }
        return "No";
      }
      
    
}

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

int main()
{
    int n;
    cin >> n;
    int P[n];

    REP(i, n)
    cin >> P[i];

    int sum = 0;

    REP(i, n - 2)
    {
        if (P[i] < P[i + 1] && P[i + 1] < P[i + 2])
        {
            sum++;
        }

        if (P[i] > P[i + 1] && P[i + 1] > P[i + 2])
        {
            sum++;
        }
    }

    cout << sum << endl;
}

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

int main()
{
    int N ,count=0;
    int a[100];
    cin >> N;
    for (int i = 0; i < N; i++) {
        cin >> a[i];
    }
    int i = 0;
    for (int i = 1; i <= N; i++) {
        
        if (i % 2 != 0) {
            if (a[i-1] % 2 != 0) {
                count += 1;
            }
            else {
                continue;
            }
        }
        if (i % 2 == 0) { continue; }
        
    }
    cout << count;
    return 0;
}

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

int main(){
	
  int N;
  cin >> N;
  vector<vector<int>> input(N, vector<int>(3));
  vector<int> dp(3);
  for(int i = 0; i < N; i++){
  	for(int j = 0; j < 3; j++){
    	cin >> input[i][j];
    }
  }
  dp[0] = input[0][0];
  dp[1] = input[0][1];
  dp[2] = input[0][2];
  
  for(int i = 1; i < N; i++){
    vector<int> new_dp(3);
  	new_dp[0] = input[i][0] + max(dp[1], dp[2]);
    new_dp[1] = input[i][1] + max(dp[2], dp[0]);
    new_dp[2] = input[i][2] + max(dp[0], dp[1]);
    dp = new_dp;
  }
  
  int res = max(dp[0], max(dp[1], dp[2]));
  cout << res << endl;
  
}


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

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

  int n;
  string s;
  
  cin >> n >> s;

  for (auto &c : s) {
    int d = c - 'A';
    d = (d + n) % 26;
    c = char('A' + d);
  }

  cout << s << '\n';

  return (0);
}


Measured memory_bytes: 3652
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

#define x first
#define y second
#define ndl '\n'
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define up_b upper_bound
#define low_b lower_bound
#define sz(x) (int)x.size()
#define bit __builtin_popcount
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()

using namespace std;
using namespace __gnu_pbds;

template<typename T> using indexed_set = tree <T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

typedef long long ll;
typedef long double ld;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;
typedef pair<int, ll> pil;
typedef pair<ll, int> pli;
typedef pair<int, ull> piu;
typedef vector<vector<int>> matrix;

const ll INF = 1e18 + 123;
const ld EPS = 1e-9;
const int inf = 1e9 + 123;
const int MOD = 1e9 + 7;
const int N = 5e5 + 13;
const int M = 1e6 + 123;
const double pi = acos(-1.0);
const int dx[] = {0, 0, 1, -1};
const int dy[] = {1, -1, 0, 0};

int main(){
    #ifdef KAZAKH
        freopen("input.txt", "r", stdin);
    #endif
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int x, y;
    cin >> x >> y;
    int ans = 0;
    if (x <= 3){
        ans += (4-x)*100000;
    }
    if (y <= 3){
        ans += (4-y)*100000;
    }
    if (x == 1 && y == 1){
        ans += 400000;
    }
    cout << ans;
    return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <string>
#include <cmath>
#include <cstdlib>
#include <ctime>
using namespace std;
typedef long long LL;

LL a[100005];
int n,i;
LL ans,cnt;
int main()
{
	cin>>n;
	for(i=1;i<=n;i++) 
	{
		cin>>a[i];
		if(a[i]%2==0&&a[i]%4!=0)
			cnt++;
		if(a[i]%4==0)
			ans++;
	}
	LL sum=n-cnt-ans;
	ans++;
	if(sum>ans)
	{
		cout<<"No"<<endl;
		return 0;
	}
	ans-=sum;
	if(ans>cnt)
	{
		cout<<"Yes"<<endl;
		return 0;
	}
	if(ans==0&&cnt!=0)
		cout<<"No"<<endl;
	else
		cout<<"Yes"<<endl;
	return 0;
}

Measured memory_bytes: 1024
#include<iostream>
#include<algorithm>
using lint=long long;
using namespace std;

int main()
{
	const int mod=1e9+7;
	int H,W;
	char a;
	int dp[1010][1010]={};
	dp[0][1]=1;
	
	cin >> H >> W;
	for(int i=1;i<=H;i++)
	{
		for(int j=1;j<=W;j++)
		{
			cin >> a;
			if(a=='#')
				dp[i][j]=0;
			else
			{
				dp[i][j]=dp[i-1][j]+dp[i][j-1];
				dp[i][j]%=mod;
			}
		}
	}
	
	cout << dp[H][W] << endl;
	return 0;
}


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

int main()
{
	string S; cin>>S;
	int ans=0;
	
	for(int i=0; i<S.length(); i++)
	{
		if(S[i]=='+') ans++;
		else if(S[i]=='-') ans--;
	}
	
	cout<<ans<<'\n';
	
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
//#define ll long long
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
#define rep(i, n) REP(i, 0, n)
#define rep_rev(i, n) for (int (i) = (int)(n) - 1 ; (i) >= 0 ; --(i))
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
#define all(x) (x).begin(),(x).end()
ll t1,t2,t3;
const ll mod = 1000000007;
const int INF = 1e9;
const ll INFLONG = 1e18;

int main(){
  ll n;
  cin >> n;
  vector<ll> vec(n);
  rep(i,n){
    cin >> vec[i];
  }
  ll ans = 0;
  rep(i,n){
    if(i % 2 == 0 && vec[i] % 2 == 1){
      ans++;
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 3596
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
int main(){
  ll N,M,K;
  cin>>N>>M>>K;
  vector<ll>A(N);
  vector<ll>B(M);
  for(ll i=0;i<N;i++)cin>>A[i];
  for(ll i=0;i<M;i++)cin>>B[i];
  
  vector<ll>C(M+1,0);
  for(ll i=0;i<M;i++){
    C[i+1]=C[i]+B[i];
  }

  ll t=0;
  ll ans=0;
  for(ll i=0;i<=N;i++){
    if(i!=0){
      t+=A[i-1];
    }
    if(t>K)break;
    ll l = -1;
    ll r = M + 1;
    while (r - l > 1) {
      ll m = (l + r) / 2;
      if (t + C[m] <= K) {
          l = m;
      } else {
          r = m;
      }
    }
    ans = max(ans, i + l);
  }
  cout<<ans<<endl;
}

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

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

    vector<ll> b(n, 0);
    for(ll i = 1; i < n; i++){
        cin >> b[i];
    }

    ll ans = b[1];
    for(ll i = 1; i < n - 1; i++){
        ans += min(b[i], b[i+1]);
    }
    ans += b[n-1];

    cout << ans << endl;

    return 0;
}

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

int main() {
    int n; cin >> n;
    string s; cin >> s;
  
    ll r=0, g=0, b=0;
    rep(i,n) {
        if(s[i]=='R') r++;
        if(s[i]=='G') g++;
        if(s[i]=='B') b++;
    }  
    ll  ans = r*g*b;

    for(int d = 1; 2*d < n; d++) {
        for(int i = 0; i + 2*d<n;i++){
            if(s[i]!=s[i+d] && s[i]!=s[i+2*d] && s[i+d]!=s[i+2*d]){
                ans--;
            }
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3608
import java.io.PrintWriter

fun next() = readLine()!!
fun nextInt() = next().toInt()
fun nextLong() = next().toLong()
fun nextDouble() = next().toDouble()
fun nextList() = next().split(" ")
fun nextIntList() = nextList().map(String::toInt)
fun nextLongList() = nextList().map(String::toLong)
fun nextDoubleList() = nextList().map(String::toDouble)

val pw = PrintWriter(System.out)
fun print(s: Any = "") = pw.print(s)
fun println(s: Any = "") = pw.println(s)

fun <T> Iterable<T>.join(separator: CharSequence = ", ", prefix: CharSequence = "", postfix: CharSequence = "") = joinToString(separator, prefix, postfix)
fun <T> Array<T>.join(separator: CharSequence = ", ", prefix: CharSequence = "", postfix: CharSequence = "") = joinToString(separator, prefix, postfix)

fun main(args: Array<String>) {
    main()
    pw.flush()
}

fun main() {
    val (N, M) = nextIntList()
    var L = 0
    var R = Int.MAX_VALUE
    repeat(M) {
        val (l, r) = nextIntList()
        L = L.coerceAtLeast(l)
        R = R.coerceAtMost(r)
    }
    println((R - L + 1).coerceAtLeast(0))
}

Measured memory_bytes: 59600
def gccd(a, b, c):
    while b:
        a, b = b, a % b
    while c:
        a, c = c, a % c
    return a

def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

n = int(input())
ans = n * (n+1) //2
for i in range(1,n+1):
    for j in range(i+1,n+1):
        ans += gcd(i,j) * 6
if n >2:
    for i in range(1,n+1):
        for j in range(i+1,n+1):
            for k in range(j+1,n+1):
                ans += gccd(i,j,k) * 6
print(ans)

Measured memory_bytes: 9220
#include<bits/stdc++.h> 
using namespace std;
int main(){
   int n;
   cin>>n;
   vector<int> a(n);
   for(int i=0;i<n;i++)cin>>a.at(i);
   sort(a.begin(),a.end());
   cout<<a.at(n/2)-a.at(n/2-1)<<endl;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n, x, i, j, k, l;
  for(i = 0; ;i++){
    int count = 0;
    scanf("%d %d", &n, &x);
    if(n == 0 && x == 0)break;
    for(j = 1; j < n - 1 ;j++){
      for(k = j + 1; k < n; k++){
        for(l = k + 1; l < n + 1; l++){
          if(j + k + l == x) count++;
        }
      }
    }
      printf("%d\n", count);
  }
}


Measured memory_bytes: 3208
//#pragma GCC optimize("Ofast")
//#pragma GCC target("avx,avx2,fma")
#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define ull unsigned long long
#define db long double
#define pb push_back
#define ppb pop_back
#define fi first
#define se second
#define mp make_pair
#define all(x) (x).begin(), (x).end()

#define int long long

void dout() { cerr << '\n'; }

template <typename Head, typename... Tail>
void dout(Head H, Tail... T) {
    cerr << " " << H;
    dout(T...);
}

#ifdef LOCAL
    #define dbg(...) cerr << #__VA_ARGS__, dout(__VA_ARGS__)
#else
    #define dbg(...) ;
#endif

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
typedef pair <int, int> pii;

const int N = 2e5 + 123;
int n, k, c;
string s;

pii pr[N], suf[N];

signed main() {
    ios_base::sync_with_stdio(false), cin.tie(NULL);
    #ifdef LOCAL
        freopen("input.txt", "r", stdin);
    #endif

    cin >> n >> k >> c;
    cin >> s;
    pr[0] = {0, -1};
    for (int i = 1; i <= n; i++) {
        pr[i] = pr[i - 1];
        if (s[i - 1] == 'x') {
            continue;
        }
        if (pr[i].fi == 0) {
            pr[i].fi = 1;
            pr[i].se = i;
            continue;
        }
        if (pr[i].se + c < i) {
            pr[i].se = i;
            pr[i].fi++;
        }
    }
    suf[n + 1] = {0, -1};
    for (int i = n; i >= 1; i--) {
        suf[i] = suf[i + 1];
        if (s[i - 1] == 'x') {
            continue;
        }
        if (suf[i].fi == 0) {
            suf[i].fi = 1;
            suf[i].se = i;
            continue;
        }
        if (suf[i].se - c > i) {
            suf[i].se = i;
            suf[i].fi++;
        }
    }
    for (int i = 1; i <= n; i++) {
        int res = pr[i - 1].fi + suf[i + 1].fi;
        if (pr[i - 1].fi > 0 && suf[i + 1].fi > 0) {
            if (suf[i + 1].se - pr[i - 1].se < c) {
                res--;
            }
        }
        if (res < k) {
            cout << i << '\n';
        }
    }
}


Measured memory_bytes: 8084