akhauriyash/Code-Regression huggingface dataset:
/*
    Created by Rahul Goel.
*/
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
/*******************************************************************************/
using namespace std;
using namespace __gnu_pbds;
template < typename T >
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
/*******************************************************************************/
using ll = long long;
using ld = long double;
const ll MOD = 1000000007;
// const ll MOD = 998244353;
const int INF = 1e9;
const ll LINF = 1e18;
/*******************************************************************************/
ll mod_sum() { return 0LL; }
template < typename T, typename... Args >
T mod_sum(T a, Args... args) { return ((a + mod_sum(args...))%MOD + MOD)%MOD; }
/*******************************************************************************/
ll mod_prod() { return 1LL; }
template< typename T, typename... Args >
T mod_prod(T a, Args... args) { return (a * mod_prod(args...))%MOD; }
/*******************************************************************************/
#ifdef ONLINE_JUDGE
#define endl '\n'
#endif
#define fastio          ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define all(c)          (c).begin(), (c).end()
#define present(c,x)    ((c).find(x) != (c).end())
#define cpresent(c,x)   (find(all(c),x) != (c).end())
#define uniq(c)         (c).resize(distance((c).begin(), unique(all(c))))
#define min_pq(t)       priority_queue < t, vector < t >, greater < t > >
#define max_pq(t)       priority_queue < t >
#define pb              push_back
#define ff              first
#define ss              second
/*******************************************************************************/
using pii = pair < ll, ll >;
using vi = vector < ll >;
using vb = vector < bool >;
using vvi = vector < vector < ll > >;
using vvb = vector < vector < bool > >;
using vpii = vector < pii >;
using vvpii = vector < vector < pii > >;
/*******************************************************************************/
//.-.. . -. -.- .- .. ... .-.. --- ...- .
/*
    Code begins after this.
*/

ll solve() {
    ll n;
    cin >> n;
    vi vec(n);
    for (ll i = 0; i < n; i++) {
        ll x, y;
        cin >> x >> y;
        vec[i] = (x == y);
    }
    bool flag = false;
    for (ll i = 2; i < n; i++) {
        flag |= (vec[i] && vec[i - 1] && vec[i - 2]);
    }
    cout << (flag ? "Yes" : "No") << endl;
    return 0;
}

signed main() {
    fastio;

    ll t = 1;
    while (t--) {
        solve();
    }
    return 0;
}


Measured memory_bytes: 3648
#include <stdio.h>
#include <stdbool.h>
typedef unsigned long long ull;

int main()
{
    ull n;
    ull a[1000][1000];

    scanf("%lld", &n);
    for (size_t i = 0; i < n; i++)
    {
        for (size_t j = 0; j < n - 1; j++)
        {
            scanf("%lld", &a[i][j]);
            a[i][j]--;
        }
    }

    ull day = 0;
    ull next[1000] = {};

    while (1)
    {
        day++;
        bool done_today[1000] = {};
        bool flag = false;
        bool rest_exists = false;

        for (size_t i = 0; i < n; i++)
        {
            if (done_today[i] || next[i] == n - 1)
            {
                continue;
            }

            rest_exists = true;

            const ull enemy = a[i][next[i]];

            if (a[enemy][next[enemy]] == i && !done_today[enemy])
            {
                done_today[i] = true;
                done_today[enemy] = true;
                flag = true;
                next[i]++;
                next[enemy]++;
            }
        }

        if (!rest_exists)
        {
            printf("%lld\n", day - 1);
            return 0;
        }
        else if (!flag)
        {
            printf("-1\n");
            return 0;
        }
    }
}

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

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

    string s;
    cin >> s;

    int n = s.size();

    string t = "";
    for(int i = 0; i < n - 1; i++){
        if(s[i] == 'B' and s[i + 1] == 'C'){
            t += 'X';
            i++;
        }else{
            t += s[i];
        }
    }

    long long ans = 0, cnt = 0;
    for(int i = 0; i < t.size(); i++){
        if(t[i] == 'A') cnt++;
        else if(t[i] == 'X') ans += cnt;
        else cnt = 0;
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3892
/*
 * author: calgagi
 *         Calvin Gagliano 
 */
#include <bits/stdc++.h>
 
using namespace std;
 
#define long long long
#define double double double
#define ulong unsigned long long
#define ii pair<int, int>
#define ll pair<long long, long long>
#define ar array
#define f first
#define s second
 
long lcm(long a, long b) {
    return (a*b)/__gcd(a, b);
}
 
void solve() {
    int n, m;
    cin >> n >> m;
    vector<int> a(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    
    long l = 1;
    int num_twos = -1;
    for (int i = 0; i < n; i++) {
        l = lcm(a[i], l);

        int twos = 0;
        while (!(a[i] & 1)) {
            a[i] /= 2;
            twos++;
        }
        if (num_twos == -1) {
            num_twos = twos;
        }

        if (twos != num_twos) {
            cout << 0 << endl;
            return;
        }
        if (l > 2LL*m) {
            cout << 0 << endl;
            return;
        }
    }
 
    l /= 2;
    int ans = m / l;
    cout << (ans+1) / 2 << endl;
 
    return;
}
 
int main() {
    ios_base::sync_with_stdio(false);  
    cin.tie(NULL);
    srand(chrono::steady_clock::now().time_since_epoch().count()); 
    
    int t = 1;
    /* cin >> t; */
    while (t--) {
        solve();
    }
 
    return 0;
}


Measured memory_bytes: 3764
#include <bits/stdc++.h>
#define rep(i,n) for(long long i=0; i<n; i++)
#define Rep(i,n) for(long long i=1; i<n; i++)
#define ll long long
#include <math.h>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <numeric>
#include <queue>
#include <set>
#include <vector>


using namespace std;
#define PI acos(-1)
using P =pair<int,int>;

ll ketasu(ll a){
   ll num=1;
   while(a/10){
       num++;
       a/=10;
   }
   return num;
}

ll gcd(ll a,ll b){return b ? gcd(b,a%b) :a;}
ll lcm(ll a,ll b){return a*b/gcd(a,b);}

ll kosuu(ll a){
    ll sum=0;
    for(ll i=1;i*i<=a;i++){
        if(a%i==0){
            if(a!=1&&i*i!=a){
            sum+=2;
            }else{
             sum++;   
            }
        }
    }
    return sum;
}





int main()
{
ll n;
cin>>n;
set<string>st;
rep(i,n){
    string a;
    cin>>a;
    st.insert(a);
}
cout<<st.size()<<endl;
}



Measured memory_bytes: 19044
def solve():
  mod = 10**9+7
  query = 'abcdefghijklmnopqrstuvwxyz'
  n = int(input())
  s = input()
  ans = 1
  for i in range(26):
    if s.count(query[i])>= 1:
     ans *= 1+s.count(query[i])
     ans %= mod
  print((ans-1)%mod)
solve()

Measured memory_bytes: 3188
#include<iostream>
#include<algorithm>
#include<vector>
#include<map>
#include<set>
#include<string>
#include<cstring>
#include<queue>
#include<stack>
#include<numeric>
using namespace std;
#define INF (1 << 30) - 1
#define LINF 1LL << 60
const int MOD = 1000000007;
using ll = long long;
using P = pair<int, int>;

int main(){
  int n, m;
  cin >> n >> m;
  vector<int> ans(n, -1);
  int flg = 1;
  for(int i = 0; i < m; ++i){
  	int s, c;
  	cin >> s >> c;
  	--s;
  	if(ans[s] == -1)ans[s] = c;
  	else if(ans[s] != c)flg = 0;
  }

  if(ans[0] == -1){
  	if(n == 1)ans[0] = 0;
  	else ans[0] = 1;
  }
  else if(ans[0] == 0){
  	if(n >= 2)flg = 0;
  }
  for(int i = 1; i < n; ++i){
  	if(ans[i] == -1)ans[i] = 0;
  }

  if(flg){
  	for(int i = 0; i < n; ++i)cout << ans[i];
  	cout << endl;
  }
  else cout << -1 << endl;
  return 0;
}


Measured memory_bytes: 384
//1.includes
#include<iostream>
#include<algorithm>
#include<functional>
#include<queue>
#include<vector>
#include<tuple>
using namespace std;
//2.defines
#define INF 1000000000000000000LL//(10^18)
#define MAX_N 300000
#define MAX_C 3
#define BLACK 2
#define GRAY 1
#define WHITE 0
//3.variables
priority_queue<tuple<long long, long long, long long>, vector<tuple<long long, long long, long long> >, greater<tuple<long long, long long, long long> > >Q;
vector<pair<long long, long long> >X[MAX_N];
long long dist[MAX_N][MAX_C];
long long color[MAX_N][MAX_C];
long long N, M, A, B, C;
//4.functions
void _memset() {
	for (int i = 0; i < MAX_N; i++) {
		for (int j = 0; j < MAX_C; j++) {
			dist[i][j] = 0;
			color[i][j] = 0;
		}
	}
	for (int i = 0; i < MAX_N; i++) {
		X[i].clear();
	}
	while (!Q.empty()) {
		Q.pop();
	}
}
long long dijkstra(long long s, long long t) {
	for (int i = 0; i < MAX_N; i++) {
		for (int j = 0; j < MAX_C; j++) {
			dist[i][j] = INF;
		}
	}
	color[s][0] = GRAY;
	Q.push(make_tuple(0, 0, s));//Q.first=dist,second=time,third=place
	dist[s][0] = 0;
	while (!Q.empty()) {
		tuple<long long, long long, long long>tup = Q.top();
		Q.pop();
		long long a1 = get<0>(tup);
		long long a2 = get<1>(tup);
		long long a3 = get<2>(tup);
		for (int i = 0; i < X[a3].size(); i++) {
			long long a4 = X[a3][i].first;
			long long a5 = X[a3][i].second;
			if (a2 == 0) {
				if (dist[a4][0] > a1 + a5) {
					dist[a4][0] = a1 + a5;
					Q.push(make_tuple(dist[a4][0], 0, a4));
				}
				if (dist[a4][1] > a1) {
					dist[a4][1] = a1;
					Q.push(make_tuple(dist[a4][1], 1, a4));
				}
			}
			if (a2 == 1) {
				if (dist[a4][2] > a1) {
					dist[a4][2] = a1;
					Q.push(make_tuple(dist[a4][2], 2, a4));
				}
			}
			if (a2 == 2) {
				if (dist[a4][2] > a1 + a5) {
					dist[a4][2] = a1 + a5;
					Q.push(make_tuple(dist[a4][2], 2, a4));
				}
			}
		}
	}
	long long minx = INF;
	minx = min(minx, dist[t][0]);
	minx = min(minx, dist[t][2]);
	return minx;
}
//5.main
int main() {
	while (true) {
		_memset();
		cin >> N >> M;
		if (N == 0 && M == 0) { break; }
		for (int i = 1; i <= M; i++) {
			cin >> A >> B >> C;
			X[A].push_back(make_pair(B, C));
			X[B].push_back(make_pair(A, C));
		}
		long long dist2 = dijkstra(1, N);
		if (dist2 >= INF) { dist2 = -1; }
		cout << dist2 << endl;
	}
	return 0;
}

Measured memory_bytes: 24152
#include <stdio.h>
int main() {
    char RB[8][9],i,j;while (scanf("%s",&RB[0])!=EOF) {for (i=1;i<8;scanf("%s",&RB[i++]));
        for (i=0;i<8;i++) for (j=0;j<8;j++) if (RB[i][j]=='1') {if (j<=4 && RB[i][j+1]=='1' && RB[i][j+2]=='1' && RB[i][j+3]=='1') puts("C"); else if (i<=4 && RB[i+1][j]=='1' && RB[i+2][j]=='1' && RB[i+3][j]=='1') puts("B"); else if (i<7 && j<7 && RB[i+1][j]=='1' && RB[i][j+1]=='1' && RB[i+1][j+1]=='1') puts("A");
        else if (i<6 && RB[i+2][j-1]=='1') puts("D"); else if (RB[i+1][j-1]=='1') puts("G"); else if (j<6 && RB[i+1][j+2]=='1') puts("E"); else puts("F"); i=10,j=10;}}return 0;}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N, K;
  cin >> N >> K;
  vector<double> p(N);
  for(int i = 0; i < N; ++i){
    double tmp;
    cin >> tmp;
    p.at(i) = ((1.0 + tmp) * 0.5);
  }
  
  for(int i = 1; i < N; ++i){
    p.at(i) += p.at(i-1);
  }
  
  
  double kitaichi = p.at(K-1);
  for(int i = K; i < N; ++i){
    kitaichi = max(kitaichi, p.at(i) - p.at(i-K));
  }
  
  cout << setprecision(7) << fixed << kitaichi << endl;
  return 0;
}

Measured memory_bytes: 1920
#include<iostream>
#include<queue>
#include<string>
#include<stdio.h>
using namespace std;
int main()
{
	string cmd;
	priority_queue<int> Q; 
	int k;
	while(cin >> cmd && cmd != "end")
	{
		if(cmd == "insert")
		{
			scanf("%d",&k);
			Q.push(k);
		}
		else if(cmd == "extract")
		{
			printf("%d\n",Q.top());
			Q.pop();
		}
	}
	return 0;
}

Measured memory_bytes: 7160
#include <bits/stdc++.h>
using namespace std;
int main(){
	int a[3];
	int f=0;
	int s=0;
	cin >> a[0] >> a[1] >> a[2];
	for(int i=0;i<3;i++){
		if(a[i]==5){
			f++;
		}else if(a[i]==7){
			s++;
		}
	}
	if(f==2&&s==1){
		cout << "YES" << endl;
	}else {
		cout << "NO" << endl;
	}
	return 0;
}

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

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            var vals = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
            var X = vals[0];
            var Y = vals[1];

            Console.WriteLine(X + Y / 2);
        }
    }

}


Measured memory_bytes: 13396
INF = 1<<30
while 1:
    n = input()
    if n == 0: break
    l = [[INF]*n for _ in range(n)]
    for i in range(n): l[i][i] = 0
    cnt = [0]*n
    ans = 0
    for _ in range(n-1):
        a, b, t = map(int, raw_input().split())
        a -= 1; b -= 1
        cnt[a] += 1; cnt[b] += 1
        l[a][b] = l[b][a] = t
        ans += 2*t
    for i in range(1,n):
        if cnt[i] == 1:
            for j in range(n):
                if l[i][j] != INF:
                    ans -= 2 * l[i][j]
                    l[i][j] = l[j][i] = 0
    for k in range(n):
        for i in range(n):
            for j in range(n):
                l[i][j] = min(l[i][j], l[i][k]+l[k][j])
    print ans - max(l[0])

Measured memory_bytes: 6268
#include<bits/stdc++.h>
#define ll long long
#define rep(i,n) for(ll i=0;i<n;i++)
using namespace std;
signed main(){
  ll n,f=0;
  cin>>n;
  rep(i,n){
    rep(j,n){
      if(i*4 + j*7 == n){
        f = 1;
        break;
      }
    }
  }
  if(f>0){
    cout<<"Yes\n";
  }else{
    cout<<"No\n";
  }
  return 0;
}

Measured memory_bytes: 256
// ALDS1_11_A: Graph
#include <iostream>
#include <vector>
#include <algorithm>
bool debug = false;

std::vector<std::vector<int>> graph;

int main() {
    int total; std::cin >> total;
    graph.resize(total);
    for (int i=0; i<graph.size(); i++) {
        graph.at(i).resize(total);
    }
    for (int i=0; i<graph.size(); i++) {
        for (int j=0; j<graph.at(i).size(); j++) {
            graph.at(i).at(j) = 0;
        }
    }
    
    int vertex, outdegree;
    for (int i=0; i<total; i++) {
        std::cin >> vertex >> outdegree;
        for (int j=0; j<outdegree; j++) {
            int adjacent_vertex;
            std::cin >> adjacent_vertex;
            graph.at(vertex-1).at(adjacent_vertex-1) = 1; 
        }
    }

    for (int i=0; i<graph.size(); i++) {
        for (int j=0; j<graph.at(i).size(); j++) {
            std::cout << graph.at(i).at(j) << (j==graph.at(i).size()-1 ? "\n" : " ");
        }
    }
}


Measured memory_bytes: 3128
#include<bits/stdc++.h>
#define sz(a) int((a).size()) 
#define pb push_back 
#define all(c) (c).begin(),(c).end() 
#define tr(c,i) for(auto i = (c).begin(); i != (c).end(); i++) 
#define present(c,x) ((c).find(x) != (c).end()) 
#define cpresent(c,x) (find(all(c),x) != (c).end())
#define F(i,n) for(int i=0;i<n;i++)
#define VE(i,v) for(int i = 0;i < (v).size();i++)
using namespace std;
typedef vector<int> vi; 
typedef vector<vi> vvi; 
typedef pair<int,int> ii;
typedef vector<ii> vii;
typedef long long ll;
typedef unsigned int ui;
typedef vector<ll> vl; 
typedef vector<vl> vvl; 
typedef pair<ll,ll> pll;
typedef vector<pll> vpll; 
vi cnt(100002, -1); 
int arr[100002];
int N;
int calc(int x)
{
	if(cnt[x]==-1)
	{
		if(x+2<=N)
		{
			cnt[x] = min(abs(arr[x]-arr[x+1]) + calc(x+1), abs(arr[x]-arr[x+2]) + calc(x+2));
		}
		else if(x+1==N)
			cnt[x] = abs(arr[x]-arr[x+1]) + calc(x+1);
		else
			cnt[x] = 0;
	}
	//cout<<x<<" "<<cnt[x]<<"\n";
	return cnt[x];
}
int main()
{
	//std::ios::sync_with_stdio(false);
	cin.tie(NULL);
	int T=1;
	
	
	

	for(int tc = 0; tc < T; tc++)
	{
		cin >> N;
		for(int i =1 ; i <= N; i++)
			cin >> arr[i];
		cout<<calc(1)<<"\n";
	}

 
 
 
	return 0;
}
 
 


Measured memory_bytes: 3328
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		FastScanner in = new FastScanner(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskC solver = new TaskC();
		solver.solve(1, in, out);
		out.close();
	}

	static class TaskC {
		public void solve(int testNumber, FastScanner in, PrintWriter out) {
			char[] s = in.next().toCharArray();
			int ans = 0;
			for (int i = 1; i < s.length; i++) {
				if (s[i] != s[i - 1]) {
					++ans;
				}
			}
			out.println(ans);
		}

	}

	static class FastScanner {
		private BufferedReader in;
		private StringTokenizer st;

		public FastScanner(InputStream stream) {
			in = new BufferedReader(new InputStreamReader(stream));
		}

		public String next() {
			while (st == null || !st.hasMoreTokens()) {
				try {
					st = new StringTokenizer(in.readLine());
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
			return st.nextToken();
		}

	}
}



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

const int MAX = 600600;
const ll MOD = 1000000007;
ll fac[MAX], finv[MAX], inv[MAX];

void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i-1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD/i) % MOD;
        finv[i] = finv[i-1] * inv[i] % MOD;
    }
}

ll COM(int n, int k){
    if (n < 0 || k < 0 || n < k) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

ll solve(ll a, ll n, ll m) {
    ll ans = 0;
    for (ll i = 1; i <= a; i++) {
        for (ll j = 0; j <= n - m; j++) {
            ll num = a - m * i - j * i;
            if (num < 0) break;
            ll add = ( COM(n + num, n) - COM(n + num - m, n) + MOD) % MOD;
            add = add * COM(n - m, j) % MOD;
            if (j % 2 == 0) ans = ( ans + add ) % MOD;
            else ans = ( ans - add + MOD ) % MOD;
        }
    }
    ans = ans * COM(n, m) % MOD;
    return ( COM(n + a, n) - ans + MOD ) % MOD;
}

int main() {
    ll n, m, l , r; cin >> n >> m >> l >> r;
    COMinit();
    cout << ( solve(r, n, m) - solve(l - 1, n, m) + MOD ) % MOD << endl;
    return 0;
}

Measured memory_bytes: 17716
#include <iostream>
#include <iomanip>
#include <cmath>
#include <queue>
#include <map>
#include <cstdlib>
#include <algorithm>
#include <utility>
#include <queue>
#include <string>
#include <functional>
#define rep(i, a, b) for(int i=a;i<b;++i)
#define MOD 1000000007
#define RAND 1000
using namespace std;

int main(void)
{
	int a, b, c, tmpa, tmpb;
	long long int cnt = 0;
	cin >> a >> b >> c;
	
	while (a % 2 == 0 && b % 2 == 0 && c % 2 == 0) {
		if (a == b && b == c) {
			cout << -1 << endl;
			return 0;
		}
		tmpa = a;
		tmpb = b;
		a = b / 2 + c / 2;
		b = tmpa / 2 + c / 2;
		c = tmpa / 2 + tmpb / 2;
		++cnt;
	}
	cout << cnt << endl;

	//system("pause");
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<stack>
#include<queue>
#include<set>
using namespace std;
int main()
{
	int a, b, c, d, e,f,g,h, i, j, k, l, m, n, o, p, q, r,s,t,u;
	cin >> a;
	cin >> b;
	cin >> c;
	cin >> d;
	a += b;
	a += c;
	a += d;
	e = a / 60;
	a = a % 60;

	cout << e << endl;
	cout << a << endl;

	return 0;
}

Measured memory_bytes: 1160
#define S scanf("%d",
c[];main(n,m,i,j,k){for(;S&n),S&m),n;printf("%d\n",j>m?i:j)){for(i=3;i--;)for(S&j);j--;c[n-k]=i)S&k);for(i=n;i--;k+=c[i])j-=pow(3,i)*abs(k*2%4-c[i]);j=fmin(~j,pow(3,n)+j);}}

Measured memory_bytes: 644
#include <iostream>
#include <iomanip>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <array>
#include <tuple>
#include <string>
#include <algorithm>
#include <functional> // greater など
#include <cmath>      // abs など
#include <numeric>    // accumulate, gcd など
#include <cassert>    // assert
#include <stdexcept>
#include <bitset>
using namespace std;

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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;
// typedef int128_t ll;
// typedef cpp_int ll;

// GCC, 配列のアクセスなど
#define _GLIBCXX_DEBUG
// Clang, 配列のアクセスなど
#define _LIBCPP_DEBUG 0

//////////////// //////////////// //////////////// //////////////// ////////////////
//////////////// //////////////// //////////////// //////////////// ////////////////

// constexpr inline ll mod = 1'000'000'007;
// constexpr int max_n = 200'000 + 5;

int main()
{
    // 高速な入出力
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << setprecision(15); // 浮動小数の表示の精度

    int n; cin>>n;
    int res = 0;
    rep(i, n) {
        int a; cin >> a;
        if (i % 2 == 1) { continue; }
        res += (a % 2);
    }
    cout << res << '\n';

    return 0;
}


Measured memory_bytes: 3608
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

import itertools
import numpy as np

N = int(readline())
info = []
for i in range(N):
    A = int(readline())
    for _ in range(A):
        x,y = map(int,readline().split())
        info.append((i,x-1,y))
        
A = np.array(list(itertools.product([0,1],repeat=N)),np.bool)
for i,x,y in info:
    bl = (~A[:,i]) | (A[:,x] == bool(y))
    A = A[bl]

answer = A.sum(axis = 1).max()
print(answer)


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

int main() {
  int K, A ,B;
  cin >> K >> A >> B;
  
  string ans = "NG";
  for(int i = A; i < B + 1; ++i){
    if(i % K == 0){
      ans = "OK";
      break;
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 3620
#include<iostream>
#include<cmath>
#include<algorithm>
#include<string>
#include<vector>
#include<stack>
#include<queue>
#include<set>
#include<map>
#include<iomanip>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<ll,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define fi first
#define sc second
#define rep(i,x) for(ll i=0;i<x;i++)
#define repn(i,x) for(ll i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())

const int MAX = 510000;
const int MOD = 1000000007;

int main(){
  ll N, Q; cin>>N>>Q;
  vector<ll> a(N);
  vector<ll> x(N);
  rep(i,N) cin>>a[i];
  rep(i,Q) cin>>x[i];


  rep(i,Q){
    ll ans = 0;
    ll s = 0, t = 0;
    ll tmp = 0;
    rep(j,N){
      //尺取
      while(tmp <= x[i]){
        tmp += a[t++];
      }
      //change s
      t = min(t, N+1);
      // cout<<j<<" "<<t<<endl;
      ans += t - j - 1;
      tmp -= a[j];
    }
    cout<<ans<<endl;
  }

}



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

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

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

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>

int LCSLength(char *X, char *Y){
  int m = strlen(X), n = strlen(Y);
  int i, j;
  int c[m+1][n+1];

  for(i=1; i<=m; i++){
    c[i][0] = 0;
  }

  for(j=0; j<=n; j++){
    c[0][j] = 0;
  }

  for(i=1; i<=m; i++){
    for(j=1; j<=n; j++){
      if(X[i-1] == Y[j-1]){
	c[i][j] = c[i-1][j-1] + 1;
      }else if(c[i-1][j] >= c[i][j-1]){
	c[i][j] = c[i-1][j];
      }else{
	c[i][j] = c[i][j-1];
      }
    }
  }

  return c[m][n];

}

int main(){

  int q, i;
  char X[1001], Y[1001];

  scanf("%d", &q);

  for(i=0; i<q; i++){
    scanf("%s", X);
    scanf("%s", Y);
    printf("%d\n", LCSLength(X, Y));
  }

  return 0;

}

Measured memory_bytes: 4524
n = int(input())

class Node:
    def __init__(self, idd, neighbors):
        self.idd = idd
        self.neighbors = neighbors
        self.foundAt = 0
        self.completeAt = 0
        
    def __repr__(self):
        return "{0} {1} {2}".format(self.idd, self.foundAt, self.completeAt)

Nodes = [None] * n
for i in range(n):
    row = [int(tt) for tt in input().split()]
    Nodes[row[0]-1] = Node(row[0], [ row[j + 2] for j in range(row[1])])
        
def depthSearch(Nodes):
    stack = [Nodes[0]]
    
    time = 2
    current = stack[-1]
    current.foundAt = 1
    while len(stack) > 0 or any([node.foundAt==0 for node in Nodes]):
        if(len(stack)==0):
            newStart = [node for node in Nodes if node.foundAt==0][0]
            newStart.foundAt = time
            stack.append(newStart)
            time += 1
        current = stack[-1]
        if(len(current.neighbors) > 0):
            next_n = Nodes[current.neighbors.pop(0)-1]
            if(next_n.foundAt != 0):
                continue
            next_n.foundAt = time
            stack.append(next_n)
        else:
            current.completeAt = time
            stack.pop(-1)
        time += 1
    return Nodes
Nodes = depthSearch(Nodes)
for node in Nodes:
    print(node)


Measured memory_bytes: 5624
n,m,v,p = map(int, input().split())
a = list( map(int, input().split()))

a.sort(reverse=True)

def isok(i):

    if i <= (p-1):
        return True

    points = a.copy()

    points[i] += m

    adding_point = m*v-m*p

    if points[i] < points[p-1]:
        return False

    j = n-1
    while adding_point > 0:

        if j <= p-2:
            return False

        if i == j:
            j -= 1
            continue
        adding_point -= min(m, points[i]- points[j])

        j -= 1

    return True

if isok(n-1):
    print(n)
    exit()

ok = p-1
ng = n-1

while ng - ok > 1:
    mid = (ok+ng)//2

    if isok(mid):
        ok = mid
    else:
        ng = mid
print(ok+1)



Measured memory_bytes: 14484
n, *a = map(int, open(0).read().split())
mod = 10 ** 9 + 7

s = [0] * n

for i in range(n - 1, 0, -1):
    s[i - 1] = s[i] + a[i]

ans = 0
for i in range(n):
    ans = (ans + a[i] * (s[i])) % mod
print(ans)


Measured memory_bytes: 31748
#include <stdio.h>

int main() {
    int a, b;
    int valor;
    scanf("%d %d", &a, &b);
    if (a > 12) {
        valor = b;
    }
    else if (a > 5 && a <13){
        valor = b/2;
    }
    else {
        valor = 0;
    }
    
    printf("%d", valor);

    return 0;
}

Measured memory_bytes: 128
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.List;
import java.util.Scanner;
import java.util.ArrayList;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Ki solver = new Ki();
        solver.solve(1, in, out);
        out.close();
    }

    static class Ki {
        List<List<Integer>> graph;
        long[] cost;

        public void solve(int testNumber, Scanner in, PrintWriter out) {

            int n = in.nextInt();
            int q = in.nextInt();

            graph = new ArrayList<>();
            for (int i = 0; i <= n; i++) {
                graph.add(new ArrayList<>());
            }

            cost = new long[n + 1];

            for (int i = 1; i <= n - 1; i++) {
                int a = Integer.parseInt(in.next());
                int b = Integer.parseInt(in.next());
                graph.get(a).add(b);
                graph.get(b).add(a);
            }

            for (int i = 0; i < q; i++) {
                int p = Integer.parseInt(in.next());
                long x = Long.parseLong(in.next());
                cost[p] = cost[p] + x;
            }

            dfs(1, 0);
            for (int i = 1; i <= n; i++) {
                out.print(cost[i] + " ");
            }
        }

        public void dfs(int src, int parent) {
            for (Integer dst : graph.get(src)) {
                if (dst != parent) {
                    cost[dst] += cost[src];
                    dfs(dst, src);
                }
            }
        }

    }
}



Measured memory_bytes: 104856
#include <iostream>
#include <iomanip>
#include <vector>
#include <utility>
#include <map>
#include <algorithm>
#include <queue>
#include <cmath>
#include <numeric>

using namespace std;
struct aaa{aaa(){cin.tie(nullptr); ios::sync_with_stdio(false); cout<<fixed<<setprecision(20);};}aaa;

typedef long long int64;


int main() {
    vector<int> haiku(3);
    for (int i=0; i<3; i++) cin >> haiku[i];
    sort(haiku.begin(), haiku.end());

    if (haiku[0] == 5 && haiku[1] == 5 && haiku[2] == 7)
        cout << "YES" << endl;
    else
        cout << "NO" << endl;
}

Measured memory_bytes: 256
if __name__ == '__main__':
	S = input()
	T = input()

	T_length = len(T)
	head = -1
	for i in range(len(S)-T_length+1):
		counter = 0
		for j in range(T_length):
			if(S[i+j]==T[j] or S[i+j]=='?'):
				counter += 1
		if(counter == T_length):
			head = i
				
	ans = ''
	i=0
	if(head == -1):
		print("UNRESTORABLE")
	else :
		while i < len(S):
			if(i!=head and S[i]=='?'):
				ans += 'a'
				i += 1
			elif(i==head):
				ans += T
				i += T_length
			else :
				ans += S[i]
				i+=1

		print(ans)

Measured memory_bytes: 3064
#include<iostream>
#include<string>
using namespace std;
int main(void)
{
    string s;
    cin >> s;
    int ans=0;
    for(int i=0;i<s.size();i++){
        if(i%2==0){
            if(s[i]=='0'){
                ans++;
            }
        }
        else {
            if(s[i]=='1'){
                ans++;
            }
        }
    }
    if((s.size() - ans)<=ans){
        ans = s.size() - ans;
    }
    cout << ans << endl;
    return 0;
}

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

using namespace std;

void fastio() {
	cin.tie(nullptr);
	cin.sync_with_stdio(false);
}

using LL = long long;
using LD = long double;

const LL MOD = 1e9+7;
const LL INF = LLONG_MAX;
const LL N = 1e6+1;

#define F first
#define S second

int main() {
	fastio();
	
	string s, t;
	cin >> s >> t;

	LL ns = s.size(), nt = t.size();

	LL mncnt = 1e6;
	for (LL i = 0; i <= ns-nt; ++i) {
		LL cnt = 0;
		for (LL j = i; j < i+nt; ++j) {
			if (s[j] != t[j-i]) {
				cnt++;
			}
		}
		mncnt = min(mncnt, cnt);
	}

	cout << mncnt << "\n";
}

Measured memory_bytes: 3644
import numpy as np

H, W = map(int,input().split(' '))

# 回数の最大値はH+W
max_value = H+W
values =[]
 
# マス目に回数を入れる。黒なら0、白なら最大値を入れておく
for i in range(H):
    values.append([0 if i == '#' else max_value for i in list(input())])
    
# print(values)
# numpy配列に
values = np.array(values)
 
# print(values)
# print()

# numpyで各次元のスライスはカンマで区切って指定する。[行について, 列について]
# 例： 3行、4列でarangeした行列 A について print(A[1:, 1:3]) とすると下記となる。
#  [[ 5  6]
#   [ 9 10]]
#
# (あるセルの値+1) と、(その右側のセルの値) のminを 右側のセルに書く作業を
# 一番左の列から右に向けてやる
for x in range(W-1):
    values[:,x+1] = np.minimum(values[:,x]+1,values[:,x+1])
#    print('case1: x = ', x)
#    print(values)

# print()
# (あるセルの値+1) と、(その左側のセルの値) のminを 左側のセルに書く作業を
# 一番右の列から左に向けてやる
for x in range(W-1,0,-1):
    values[:,x-1] = np.minimum(values[:,x-1],values[:,x]+1)
#    print('case2: x = ', x)
#    print(values)

# print()
# (あるセルの値+1) と、(その下側のセルの値) のminを 下側のセルに書く作業を
# 一番上の行から下に向けてやる
for x in range(H-1):
    values[x+1,:] = np.minimum(values[x,:]+1,values[x+1,:])
#    print('case3: x = ', x)
#    print(values)

# print()
# (あるセルの値+1) と、(その上側のセルの値) のminを 上側のセルに書く作業を
# 一番下の行から上に向けてやる
for x in range(H-1,0,-1):
    values[x-1,:] = np.minimum(values[x,:]+1,values[x-1,:])
#    print('case4: x = ', x)
#    print(values)
    
# print()
print(np.max(values))


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

int main() {
    int n;
    cin >> n;
    int d = n % 10;
    if(d == 2 || d == 4 || d == 5 || d == 7 || d == 9) {
        cout << "hon" << endl;
    } else if(d == 0 || d == 1 || d == 6 || d == 8) {
        cout << "pon" << endl;
    } else {
        cout << "bon" << endl;
    }
    return 0;
}

Measured memory_bytes: 3636
#![allow(unused_imports)]
use proconio::{
   fastout, input,
   marker::{Bytes, Isize1, Usize1},
};

#[fastout]
fn main() {
   input! {
      h: usize,
      w: usize,
      mut c: [[usize; 10]; 10],
      a: [[i32; w]; h]
   }
   for k in 0..10 {
      for i in 0..10 {
         for j in 0..10 {
            c[i][j] = std::cmp::min(c[i][j], c[i][k] + c[k][j]);
         }
      }
   }

   let mut ans = 0;
   for i in 0..h {
      for j in 0..w {
         if a[i][j] != -1 {
            ans += c[a[i][j] as usize][1];
         }
      }
   }
   println!("{}", ans);
}


Measured memory_bytes: 2348
#include <cassert>
#include <cstdio>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <sstream>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <numeric>
#include <algorithm>

using namespace std;
using lint = long long;
constexpr int MOD = 1000000007, INF = 1010101010;
constexpr lint LINF = 1LL << 60;

template <class T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
	for (const auto &e : vec) os << e << (&e == &vec.back() ? "\n" : " ");
	return os;
}

#ifdef _DEBUG
template <class T>
void dump(const char* str, T &&h) { cerr << str << " = " << h << "\n"; };
template <class Head, class... Tail>
void dump(const char* str, Head &&h, Tail &&... t) {
	while (*str != ',') cerr << *str++; cerr << " = " << h << "\n";
	dump(str + (*(str + 1) == ' ' ? 2 : 1), t...);
}
#define DMP(...) dump(#__VA_ARGS__, __VA_ARGS__)
#else 
#define DMP(...) ((void)0)
#endif

int main() {

	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	int N, M;
	cin >> N >> M;

	vector<int> H(N);
	for (int i = 0; i < N; i++) cin >> H[i];


	vector<vector<int>> edges(N);
	for (int i = 0; i < M; i++) {
		int u, v;
		cin >> u >> v;
		u--, v--;
		edges[u].emplace_back(v);
		edges[v].emplace_back(u);
	}

	int ans = 0;
	for (int i = 0; i < N; i++) {

		ans += all_of(edges[i].begin(), edges[i].end(), [&](auto ind) { return H[i] > H[ind]; });

	}

	cout << ans << "\n";

	return 0;
}

Measured memory_bytes: 8744
#ABC168c

import math

a, b, h, m = map(int, input().split())

rad_h = math.radians(30) * h + (math.radians(30) / 60) * m
pos_a_x = a * math.sin(rad_h)
pos_a_y = a * math.cos(rad_h)

rad_m = math.radians(360/60) * m
pos_b_x = b * math.sin(rad_m)
pos_b_y = b * math.cos(rad_m)

x = pos_a_x - pos_b_x
y = pos_a_y - pos_b_y

l = math.sqrt(x ** 2 + y ** 2)
print(l)


Measured memory_bytes: 9496
#include <iostream>
#include <algorithm>
#include <complex>
#include <vector>
#include <queue>
using namespace std;

typedef complex<double> P;

struct Edge {
  int to;
  double cost;
  Edge() {}
  Edge(int to, double cost) : to(to), cost(cost) {}
};

const int MAX_N = 10005;
int N;
P Ps[MAX_N];
vector<Edge> E[MAX_N];
double allEdge;

void init() {
  for(int i = 0; i < MAX_N; ++i)
    E[i].clear();
  allEdge = 0.0;
}

void addEdge(int p, int q) {
  double cost = abs(Ps[p]-Ps[q]);
  E[p].push_back(Edge(q,cost));
  E[q].push_back(Edge(p,cost));
  allEdge += cost;
}

double mst(int st) {
  priority_queue<pair<double,int> > que;
  bool vis[MAX_N];
  double sum = 0.0;
  fill(vis, vis+N, false);
  que.push(make_pair(0.0, st));
  while(!que.empty()) {
    pair<double,int> p = que.top();
    que.pop();
    if(vis[p.second]) continue;
    vis[p.second] = true;
    sum += p.first;
    for(int i = 0; i < E[p.second].size(); ++i) {
      Edge& e = E[p.second][i];
      if(vis[e.to]) continue;
      que.push(make_pair(e.cost, e.to));
    }
  }
  return sum;
}

void dfs(int p, bool vis[]) {
  vis[p] = true;
  for(int i = 0; i < E[p].size(); ++i) {
    Edge& e = E[p][i];
    if(vis[e.to]) continue;
    dfs(e.to, vis);
  }
}

double solve() {
  bool vis[MAX_N];
  double sum = 0.0;
  fill(vis,vis+MAX_N,false);
  for(int i = 0; i < N; ++i) {
    if(vis[i]) continue;
    dfs(i, vis);
    sum += mst(i);
  }
  return allEdge - sum;
}

int main() {
  init();
  int m;
  cin >> N >> m;
  for(int i = 0; i < N; ++i)
    cin >> Ps[i].real() >> Ps[i].imag();
  for(int i = 0; i < m; ++i) {
    int p, q;
    cin >> p >> q;
    --p; --q;
    addEdge(p,q);
  }
  printf("%.3f\n", solve());
  return 0;
}

Measured memory_bytes: 2612
use proconio::input;

fn main() {
    input!{
        k: i32,
    }

    if k % 2 == 0 || k % 5 == 0 {
        println!("-1");
        return ();
    }

    let mut i = 1;
    let mut m = 7;
    while i <= 1000000 {
        if m % k == 0 {
            println!("{}", i);
            return ();
        }
        m = (m % k) * 10 + 7;
        i += 1;
    }
    println!("-1");
}


Measured memory_bytes: 2164
#include <bits/stdc++.h>
#define ll long long
using namespace std;
 
void solve(){
    int n,k;
    cin>>n>>k;
    vector<int> arr(n),dp(n);
    for(int i=0;i<n;i++)
        cin>>arr[i];
    dp[0]=0;
    for(int i=1;i<n;i++){
        dp[i]=INT_MAX;
        for(int j=max(0,i-k);j<i;j++)
            dp[i]=min(dp[i],dp[j]+abs(arr[i]-arr[j]));
    }
    cout<<dp[n-1];
}

int main(){
    ios::sync_with_stdio(false); cin.tie(0);
    solve(); cout<<endl;
    return 0;
}

Measured memory_bytes: 3944
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <stdio.h>
#include <queue>
#include <deque>
#include <cstdio>
using namespace std;
int main() {
	string s, t, u;
	int a, b;
	cin >> s >> t >> a >> b >> u;
	if (s == u) {
		cout << a - 1 << " " << b << endl;
	}
	else {
		cout << a << " " << b - 1 << endl;
	}
	return 0;
}






Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<set>
#include<queue>
#include<stack>
#include<bitset>
using namespace std;
int p = 1000000007;
#define int long long
#define vel vector<long long>
#define vvel vector<vel>
#define rep(i,n) for(long long i=0;i<n;i++)
#define sor(v) sort(v.begin(),v.end())
#define mmax(a,b) a=max(a,b)
#define mmin(a,b) a=min(a,b)
#define mkp make_pair
#define pin pair<int,int>
#define V vector
#define Endl endl
#define veb vector<bool>
#define sq(a) (a)*(a)
#define rev(s) reverse(s.begin(),s.end())
#define end_program(s) cout << s <<endl;return 0
int kai_size = 120001;
vel kai(kai_size, 1);
vel ink(kai_size, 1);
vel dist;
int RE() {
	vel v(3, 2);
	return v.at(4); 
}
int ru(int a, int r) {
	if (r == 0) { return 1; }
	int ans = ru(a, r / 2);
	ans *= ans; ans %= p;
	if (r % 2 == 1) { ans *= a; }
	return ans % p;
}
int inv(int a) {
	return ru(a, p - 2);
}
void make_kai() {
	rep(i, kai_size-1) { kai[i + 1] = (kai[i] * (i + 1)) % p; }
	rep(i, kai_size) { ink[i] = inv(kai[i]); }
}
int com(int n, int r) {
	int ans = kai[n] * ink[r];
	ans %= p; ans *= ink[n - r]; ans %= p;
	return ans;
}
vel dis(int mid1, vvel &way) {
	int n = way.size();
	vel dist(n, -1); dist[mid1] = 0;
	queue<int> q;
	q.push(mid1);
	while (!q.empty()) {
		int st = q.front(); q.pop();
		rep(i, way[st].size()) {
			int to = way[st][i];
			if (dist[to] == -1) {
				dist[to] = dist[st] + 1;
				q.push(to);
			}
		}
	}
	return dist;
}
pin most_far(int now, int n, vvel &way) {
	vel dist1 = dis(now, way);
	pin ans = mkp(-1, 0);
	rep(i, n) {
		if (dist1[i] > ans.first) { ans = mkp(dist1[i], i); }
	}
	return ans;
}

int per(int a, int b) {
	int ans = a % b;
	if (ans < 0) { ans += b; }
	return ans;
}
V<pin> uni(V<pin> &v) {
	sor(v);
	V<pin> ans(1, v[0]);
	for (int i = 1; i < v.size(); i++) {
		if (v[i] != v[i-1]) { ans.push_back(v[i]); }
	}
	v = ans;
	return v;
}
int s_gcd(int a, int b) {
	if (b == 0) { return a; }
	return s_gcd(b, a%b);
}
int gcd(int a, int b) {
	if (a < b) { swap(a, b); }
	return s_gcd(a, b);
}
bool win_first(vel &a) {
	int n = a.size();
	int sum = 0;
	vel odd;
	rep(i, n) {
		sum += a[i] - 1;
		if (a[i] % 2 == 1) { odd.push_back(i); }
	}
	if (sum % 2 == 1) { return true; }
	if (odd.size() == 1) {
		if (a[odd[0]] != 1) {
			a[odd[0]]--;
			int gcd0 = a[0];
			for (int i = 1; i < n; i++) {
				gcd0 = gcd(gcd0, a[i]);
			}
			rep(i, n) { a[i] /= gcd0; }
			return !win_first(a);
		}
	}
	return false;
}
signed main() {
	int n; cin >> n;
	if (n == 3) { cout << 2 << " " << 5 << " " << 63 << endl; return 0; }
	vel a = { 3,9,4,8,2,10,6,12 };
	int m = n / 8;
	vel ans;
	rep(i, m) {
		rep(j, 8) {
			ans.push_back(12 * i + a[j]);
		}
	}
	int ex = n % 8;
	int pl = 12 * m;
	rep(j, (ex / 2) * 2) {
		ans.push_back(pl + a[j]);
	}
	if (ex % 2 == 1) {
		ans.push_back(pl + 6);
	}
	rep(i, n-1) {
		cout << ans[i] << " ";
	}
	cout << ans[n - 1] << endl;
	return 0;
}

Measured memory_bytes: 2560
import sys
sys.setrecursionlimit(10000000)
import numpy as np
from heapq import heapify, heappop, heappush
import copy
from math import gcd, ceil
from collections import deque
# queueとして使う場合 push, popleftを使う
from bisect import bisect_left, bisect_right
# bisect_left: 配列の順序関係が崩れない条件で挿入することができる一番左の点
# bisect_right: 配列の順序関係が崩れない条件で挿入することができる一番右の点
# A = [1, 1, 1, 2, 2, 2, 4]
# print(bisect_left(A, 2))  # 3
# print(bisect_right(A, 2))  # 6
# print(bisect_left(A, 3))  # 6
# print(bisect_right(A, 3))  # 6


def main():
    H1, M1, H2, M2, K = map(int, input().split())
    left = (H2 - H1) * 60 + (M2 - M1)
    print(left - K)


if __name__ == '__main__':
    main()


Measured memory_bytes: 27184
#include <iostream>
#include <cmath>
#include <vector>
using namespace std;
vector<int> v;
int ans = 100000;
int main() {
	int n;
	cin >> n;
	int i, j, tmp;
	int Al = 0;
	for (i = 1; i <= n; ++i) {
		cin >> tmp;
		Al += tmp;
		v.push_back(tmp);
	}
	int s1 = 0, s2 = Al, w;
	for (i = 0; i < n; ++i) {
		w = abs(s1 - s2);
		if (w < ans) {
			ans = w;
		}
		else break;
		s1 += v[i];
		s2 -= v[i];
	}
	cout << ans << endl;
	return 0;
}

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

int main(){
  int N;
  cin >> N;
  int n = N;
  int a[10];
  int ds = 0;
  for(int i = 0; i < 10; i++){
    a[i] = n % 10;
    n /= 10;
    ds += a[i];
  }
  cout << ((N % ds == 0)? "Yes": "No") << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rt "\n"
#define sp " "
#define test1 cout << "test1" << endl;
#define test2 cout << "test2" << endl;
#define fixprecision(n) fixed; cout << setprecision(n)
#define kyopro ios::sync_with_stdio(false);cin.tie(NULL);
#define MOD 1000000007
#define rep(i, s, N) for(ll i{s}; i < N; i++)
using namespace std;
using ll = long long;
using iikae = ll&;
using ld = long double;
using P = pair<ll,ll>;

int main(){
  kyopro;
  ll A, B;
  cin >> A >> B;
  if(A > 12) cout << B << rt;
  else if(A > 5) cout << B/2 << rt;
  else cout << 0 << rt;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>

#define N_num 1000
#define D_num 4000
#define Quota 1000000

int input[N_num+1];
int Data[D_num+1];

void Initialize(){
	int i;
	for(i=0;i<N_num+1;i++) input[i]=-1;
	for(i=0;i<D_num+1;i++) Data[i]=0;
}

int main(void){
	int i,j,count;
	int n,e,p,q;	
	
	while(scanf("%d",&n)!=EOF){
		if(n==0) break;
		count = 0;
		Initialize();
		for(i=0;i<n;i++){
			scanf("%d %d %d",&e,&p,&q);
			for(j=0;j<N_num+1;j++){
				if(input[j]==-1){
					input[j]=e;
					break;
				}else if(input[j]==e){
					break;
				}
			}
			Data[input[j]]+=p*q;
			if(Data[input[j]]>=Quota) count++;
		}
		if(count==0) printf("NA\n");
		else{
			for(i=0;i<N_num+1;i++){
				if(input[i]==-1) break;
				else{
					if(Data[input[i]]>=Quota){
						printf("%d\n",input[i]);
					}
				}
			}
		}
	}

	return 0;
}

Measured memory_bytes: 632
from scipy.sparse.csgraph import floyd_warshall
h,w=map(int,input().split())
n=10
d=[]
for i in range(n):
    d.append(list(map(int,input().split())))
a=[]
for i in range(h):
    a.append(list(map(int,input().split())))

d=floyd_warshall(d).tolist()
cnt=0
for i in range(h):
    for j in range(w):
        if a[i][j]==-1:continue
        cnt+=d[a[i][j]][1]
print(int(cnt))


Measured memory_bytes: 15824
from heapq import heappush, heappop

def dijkstra1(V, n, source):
    # O(ElogV)

    inf = float("inf")
    dist = [inf] * (n+1)
    dist[source] = 0
    q = [(0, source)]

    while q:
        cost, u = heappop(q)
        if dist[u] < cost:
            continue
        for c, v in V[u]:
            if dist[v] > dist[u] + c:
                dist[v] = dist[u] + c
                heappush(q, (dist[v], v))

    return dist


if __name__ == "__main__":
    N, M = map(int, input().split())
    V = {i:[] for i in range(1, 3*N+1)}
    for _ in range(M):
        u, v = map(int, input().split())
        V[u].append((1, v+(N)))
        V[u+(N)].append((1, v+(2*N)))
        V[u+(2*N)].append((1, v))

    S, T = map(int, input().split())
    dist = dijkstra1(V, 3*N, S)[T]
    print(-1 if dist==float("inf") else dist//3)

Measured memory_bytes: 120288
#include<bits/stdc++.h>
using namespace std;	
#pragma GCC optimize("Ofast") 
#define int long long
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);
#define pb push_back 
#define eb emplace_back
#define fn for(int i =0 ;i <n;i++)	
#define fn1 for( int i =1;i<=n;	i++)
#define fm for(int j =0 ;j <m;j++)
#define fm1 for(int j =1;j<=m;j++)
#define fi first
#define se second
#define endl '\n'
#define PI  3.14159265358979323846
#define MOD 1000000007
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
const int N = 2e6+5;	
const int INF = 1e18L;
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << ": " << arg1 << " |";
  __f(comma + 1, args...);
}
int ar[N];
int dp[N];
signed main(){
	#ifndef ONLINE_JUDGE
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
	#endif
	IOS;
	int T=1;
	// cin >> T;
	while(T--){
		string s;
		cin >> s;
		int i =0 ,ans= 0, n =3, l=0;
		while(i<n){
			if(s[i]=='R'){
				while(i<n&&s[i]=='R'){
					++l;
					i++;
				}
			}else
			i++;
			ans = max(ans,l);
			l =0 ;
		}
		cout<<ans;

	
	
	}
	return 0;
}

Measured memory_bytes: 3604