akhauriyash/Code-Regression huggingface dataset:
/*     ####   ####  #               ####  #        ##   #    # #    # ###### #####
		  #      #    # #              #      #       #  #  ##  ## ##  ## #      #    #
		   ####  #    # #               ####  #      #    # # ## # # ## # #####  #    #
			   # #  # # #                   # #      ###### #    # #    # #      #####
		  #    # #   #  #              #    # #      #    # #    # #    # #      #   #
		   ####   ### # ###### #######  ####  ###### #    # #    # #    # ###### #    #
	*/
	 
	#include<bits/stdc++.h>
	using namespace std;
	 
	typedef long long LL;
	typedef vector<LL> VLL;
	typedef vector<string> VS;
	typedef vector<pair<LL, LL> > VP;
	 
	 
	#define For(in) for (LL i = 0; i < (n); i++)
	#define FOR(in) for(LL i=1; i <= (n); i++)
	#define pb push_back
	#define sr(v) sort(v.begin(), v.end())
	#define rev(v) reverse(v.begin(), v.end())
	#define uniq(v) v.erase(unique(v.begin(), v.end()), v.end());
	#define exit(); return 0;
	#define no "NO"
	#define yes "YES"
	#define con continue;
	 
	 
	LL concate(LL a, LL b)
	{
		ostringstream os;
		os <<a <<b;
		istringstream is(os.str());
		LL c;
		is>> c;
		return c;
	}
	 
	 
	LL check(char c)
	{
		return c=='a' || c=='e' || c=='i' || c=='o' || c=='u';
	}
	LL mod = 1e9+7;
	 
	 
	int main()
	{
		LL q,t;
		//cin>>t;
		//while(t--)
		//{
		   LL a=0,b=0,c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,r=0,u=0,w=0,x=0,y=0,z=0;
			LL aa[1000];
			LL flag=0, flag1=0, co=0, co1=0, co2=0, co3=0, x1=0, x2=0, y1=0, y2=0, z1=0, z2=0;
			LL ma=0, mi=100000000;
			LL mid=0, temp=0, stop=0, start=0;
			double pi= 3.141592653589793;
			double d1=0.0, d2, d3, d4;
			VLL v,v1,v2,v3,v4,v5,v6,v7,v8,v9,v10;
			VS vs, vs1, vs2, vs3, vs4;
			VP vp, vp1,vp2;
			char ch, ch1, ch2[1001];
			string str, str1, str2, str3, str4, str5;
			pair<LL, LL> pa;
			list<LL> li, li1;
			map<LL, LL> mp, mp1;
			set<LL> st;
			map<LL ,LL> :: iterator imll;
			VLL :: iterator ivll;
			set<LL> :: iterator isll;
			VP :: iterator ivp;
	 
			
			cin>>ch>>ch1;
			if(ch=='H')cout<<ch1<<endl;
			else 
			{
				if(ch1=='H')cout<<'D'<<endl;
				else cout<<'H'<<endl;
			}
			
		 //}
	 
		exit()
	 
	 
	}


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

using namespace std;
using ll = long long;
using vec = vector<ll>;
using mat = vector<vec>;
using pll = pair<ll,ll>;

#define INF (1LL << 60)
#define MOD 1000000007
#define PI 3.14159265358979323846

#define REP(i,m,n) for(ll (i)=(m),(i_len)=(n);(i)<(i_len);++(i))
#define FORR(i,v) for(auto (i):v)
#define ALL(x) (x).begin(), (x).end()
#define PR(x) cout << (x) << endl
#define PS(x) cout << (x) << " "
#define SZ(x) ((ll)(x).size())
#define MAX(a,b) (((a)>(b))?(a):(b))
#define MIN(a,b) (((a)<(b))?(a):(b))
#define REV(x) reverse(ALL((x)))
#define ASC(x) sort(ALL((x)))
#define DESC(x) ASC((x)); REV((x))
#define pb push_back
#define eb emplace_back

int main()
{
    ll N, M;
    cin >> N >> M;
    vector<pll>  P(M);
    REP(i,0,M) cin >> P[i].second >> P[i].first;
    
    ASC(P);
    ll cnt = 1;
    ll k = 0, l = 1;
    while(l < M) {
        if(P[k].first <= P[l].second) {
            ++cnt;
            k = l;
        }
        ++l;
    }
    PR(cnt);

    return 0;
}

/*



*/

Measured memory_bytes: 4820
#include <iostream>
#include <string>
#include <algorithm>

using namespace std;

int main(){
    string s;
    cin >> s;
    string result = "bon";
    reverse(s.begin(), s.end());
    if(s[0] == '2' ||s[0] == '4' || s[0] == '5' || s[0] == '7' || s[0] == '9'){
        result = "hon";
    }
    else if(s[0] == '0' || s[0] == '1' || s[0] == '6' || s[0] == '8'){
        result = "pon";
    }
    cout << result << endl;
}

Measured memory_bytes: 3624
using System;
using System.Collections.Generic;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split(' ');
            int n = int.Parse(input[0]);
            int m = int.Parse(input[1]);
            string[] numbers = Console.ReadLine().Split(' ');
            long total = 0;
            List<int> number = new List<int>();
            for (int i=0;i<n;i++)
            {
                number.Add(int.Parse(numbers[i]));
                total += number[i];
            }
            number.Sort((a, b) => b.CompareTo(a));
            if (number[m - 1] >= total / 4.0 / m)
                Console.WriteLine("Yes");
            else
                Console.WriteLine("No");
        }
    }
}


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

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef vector<ld> vd;
typedef vector<ll> vll;
typedef vector<string> vstr;
typedef vector<vector<ll>> vvll;
typedef vector<pair<ll, ll>> vpll;
typedef priority_queue<ll, vector<ll>, greater<ll>> spqll;  // 小さい順に取り出し
typedef priority_queue<ll, vector<ll>, less<ll>> bpqll;     // 大きい順に取り出し

#define REP(i, n) for (ll i = 0; i < (ll)(n); i++)
#define FOR(i, a, b) for (ll i = (ll)a; i < (ll)b; i++)
#define IREP(i, v) for (auto i = (v).begin(); i != (v).end(); i++)
#define FI first
#define SE second
#define MP make_pair
#define MT make_tuple
#define PB push_back
#define TS to_string
#define NP next_permutation
#define ALL(v) (v).begin(), (v).end()
#define SZ(x) (ll) x.size()
#define SP(x) setprecision((ll)x)


ll INF = 1e9;
ll NIL = -1;
ll MOD = 1000000007;
ll LINF = 1e18;
ld EPS = 1e-9;
ld PI = M_PI;
vll dx = {1, 0, -1, 0, 1, -1, -1, 1};
vll dy = {0, 1, 0, -1, 1, 1, -1, -1};
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a;} //最大公約数
ll lcm(ll a, ll b) { return a / gcd(a, b) * b;}     //最小公倍数

void yes(){ cout << "Yes" << endl;}
void no(){ cout << "No" << endl;}

//-----------------------------------------
string s, t;
const ll L_MAX = 3000+10;

ll dp[L_MAX][L_MAX]; // dp[i][j] = (s[i],t[j]までの最長共通部分列長)

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

    cin >> s >> t;

    ll n = SZ(s);
    ll m = SZ(t);

    for(ll i=0;i<=n;i++){
        dp[i][0] = 0;
    }
    for(ll j=0;j<=m;j++){
        dp[0][j] = 0;
    }
    for(ll i=1;i<=n;i++){
        for(ll j=1;j<=m;j++){
            if(s[i-1]==t[j-1]) dp[i][j] = dp[i-1][j-1] + 1;
            else dp[i][j] = max(dp[i-1][j],dp[i][j-1]);
        }
    }

    string ans = "";

    while(n!=0 && m!=0){
        if(s[n-1]==t[m-1]){
            ans += s[n-1];
            n--;
            m--;
        }
        else{
            if(dp[n-1][m]>=dp[n][m-1]){
                n--;
            }
            else m--;
        }
    }
    reverse(ALL(ans));

    cout << ans << endl;

    return 0;
}



Measured memory_bytes: 74200
n, m = map(int, input().split())
inf = float("inf")
edges = [[inf]*n for _ in range(n)]
path = [[inf]*n for _ in range(n)]
edges_list = []
for _ in range(m):
    a, b, c = map(int, input().split())
    a -= 1
    b -= 1
    edges[a][b] = c
    edges[b][a] = c
    path[a][b] = c
    path[b][a] = c
    edges_list.append((a, b))

for i in range(n):
    path[i][i] = 0

for k in range(n):
    for i in range(n):
        for j in range(n):
            path[i][j] = min(path[i][j], path[i][k] + path[k][j])

count = 0
for a, b in edges_list:
    if path[a][b] < edges[a][b]:
        count += 1

print(count)

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

#define N 32

typedef struct {
  int parent;
  int left;
  int right;
  int depth;
  int height;
} node_t;

void dfs(node_t *array, int id, int d) {
  int left, right;

  if (id == -1)
    return;

  left = array[id].left;
  right = array[id].right;
  array[id].depth = d;

  if (left != -1)
    dfs(array, left, d+1);
  if (right != -1)
    dfs(array, right, d+1);

  // calculate height
  if (left == -1 && right == -1)
    array[id].height = 0;
  else if (left != -1 && right == -1)
    array[id].height = array[left].height + 1;
  else if (left == -1 && right != -1)
    array[id].height = array[right].height + 1;
  else {
    if (array[right].height < array[left].height)
      array[id].height = array[left].height + 1;
    else
      array[id].height = array[right].height + 1;
  }
}

int main(void) {
  int i, n, pid, left, right, degree, parent, sibling;
  char *type;
  node_t array[N];
  memset(array, -1, sizeof(array));

  // input
  scanf("%d", &n);
  for (i = 0; i < n; i++) {
    scanf("%d", &pid);
    scanf("%d %d", &left, &right);
    if (left != -1)
      array[left].parent = pid;
    if (right != -1)
      array[right].parent = pid;
    array[pid].left = left;
    array[pid].right = right;
  }

  // calculate depth
  for (i = 0; i < n; i++) {
    if (array[i].parent == -1) {
      dfs(array, i, 0);
      break;
    }
  }

  // output
  for (i = 0; i < n; i++) {
    parent = array[i].parent;

    // determination a sibling node
    if (i == array[parent].right)
      sibling = array[parent].left;
    else if (i == array[parent].left)
      sibling = array[parent].right;
    else
      sibling = -1;
    
    // calculate degree
    if (array[i].left == -1 && array[i].right == -1)
      degree = 0;
    else if(array[i].left != -1 && array[i].right != -1)
      degree = 2;
    else
      degree = 1;

    // determination a node type
    if (parent == -1)
      type = "root";
    else if (degree == 0)
      type = "leaf";
    else
      type = "internal node";
    
    printf("node %d: parent = %d, sibling = %d, degree = %d, depth = %d, height = %d, %s\n", i, parent, sibling, degree, array[i].depth, array[i].height, type);
  }

  return 0;
}

Measured memory_bytes: 600
import java.util.Scanner;

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

	public static void solve(Scanner s) {
		System.out.println((s.nextInt() + s.nextInt()) * s.nextInt() / 2);
	}
}


Measured memory_bytes: 10068
fn main() {
    let c = read::<char>();

    if 'A' <= c && c <= 'Z' {
        println!("A");
    } else {
        println!("a");
    }
}

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}


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

int main()
{
  ios::sync_with_stdio(0);
  cin.tie(0);
  int x[5];
  for(int i=0;i<5; i++){
    cin>>x[i];
    if(x[i]==0){cout<<i+1;}
  }
    return 0;
}

Measured memory_bytes: 3608
#include <stdio.h>
#define MAX 123456

int p[2*MAX+1];

void prime(){
int i,j;
for(i=0; i <= 2*MAX; i++) p[i] = 1;
for(i=2; i<= MAX; i++){
if(p[i] == 0) continue;
j = i+i;
while(j <= 2*MAX){
p[j] = 0;
j += i;
}
}
}

int main(){
int n,cnt,i;

prime();
while(1){
scanf("%d", &n);
if(n == 0) break;
cnt = 0;
for(i=n+1; i <= 2*n; i++)
cnt += p[i];
printf("%d\n",cnt);
}
}

Measured memory_bytes: 1992
#include <bits/stdc++.h>
/*...
  ...
  author 
  @
  Aman Kothari
  .....
  .....*/
using namespace std;
#define ll long long
#define dl double

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
	ll x,k,d;
	cin>>x>>k>>d;
	x=abs(x);
	if(x/d>=k){
		ll ans=x-(k*d);
		cout<<ans<<"\n";
	}
	else{
		ll moved=x/d;
		x-=moved*d;
		k-=moved;
		if(k%2==0){
			cout<<abs(x)<<"\n";
		}
		else{
			cout<<min(abs(x-d),abs(x+d))<<"\n";
		}
	}
    return 0;
}

Measured memory_bytes: 3560
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int K;
  int count=0;
  cin >> K;
  vector<int> judge(K);
  for(int i=0; i<K; i++)
    judge.at(i)=i+1;
  for(int i=0; i<K; i++){
    for(int j=0; j<K; j++){
      if(judge.at(i)%2==0 && judge.at(j)%2!=0)
        count++;
    }
  }
  cout << count << endl;
}

      

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

// varibable settings
#define infile "../test/sample-1.in"
#define int long long //{{{
const int INF=1e18;
const int MOD=1e9+7; //}}}

// define basic macro {{{
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define _rrep(i,n) rrepi(i,0,n)
#define rrepi(i,a,b) for(int i=(int)((b)-1);i>=(int)(a);--i)
#define rrep(...) _overload3(__VA_ARGS__,rrepi,_rrep,)(__VA_ARGS__)
#define each(i,a) for (auto&& i : a)
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define pb(a) push_back(a)
#define mp(a, b) make_pair(a, b)
#define ceil(a,b) ((a)+(b)-1)/(b)
#define uni(x) sort(all(x));x.erase(unique(all(x)),x.end())
#define ub upper_bound
#define lb lower_bound
#define posl(A, x) (lower_bound(all(A), x)-A.begin())
#define posu(A, x) (upper_bound(all(A),x)-A.begin())
template<class T> inline void chmax(T &a, const T &b) { if((a) < (b)) (a) = (b); }
template<class T> inline void chmin(T &a, const T &b) { if((a) > (b)) (a) = (b); }

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef long double ld;
typedef pair<int,int> pii;
typedef tuple<int,int,int> iii;

template<typename T> using PQ = priority_queue<T, vector<T>, greater<T>>;
struct Fast { Fast(){ std::cin.tie(0); ios::sync_with_stdio(false); } } fast;

#if defined(PCM) || defined(LOCAL)
  #include "lib/dump.hpp"
#else
  #define dump(...) 42
  #define dump_1d(...) 42
  #define dump_2d(...) 42
#endif
//}}}

int solve(){
  int n,q;cin>>n>>q;

  vi s(n),t(n),x(n);
  vector<tuple<int, int, int>> ks;
  rep(i,n){
    cin>>s[i]>>t[i]>>x[i];
    ks.emplace_back(x[i], s[i]-x[i], t[i]-x[i]-1);
  }
  sort(all(ks));
  dump(ks);

  set<int> d;
  vector<int> D;
  rep(i, q){
    int t;cin>>t;
    d.insert(t);
    D.pb(t);
  }
  d.insert(-INF);
  d.insert(INF);

  map<int, int> ans;

  rep(i,n){
    int l = get<1>(ks[i]);
    int r = get<2>(ks[i]);
    auto it = d.lower_bound(l);
    while(true){
      if ((*it)<=r) {
        ans[*it] = get<0>(ks[i]);
        it = d.erase(it);
      }
      else{
        break;
      }
    }
  }
  dump(ans);
  each(el, D){
    dump(el);
    if (ans.find(el)!=ans.end()){
      cout << ans[el] << endl;
    }
    else{
      cout << -1 << endl;
    }
  }
  return 0;
}

signed main() { //{{{
#ifdef INPUT_FROM_FILE
  std::ifstream in(infile);
  std::cin.rdbuf(in.rdbuf());
#endif
  solve();
  return 0;
} //}}}


Measured memory_bytes: 26988
using System;
using System.Collections.Generic;
using System.Linq;

namespace ABC167_C
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] firstInputs = Console.ReadLine()
                .Split(' ')
                .Select(s => int.Parse(s))
                .ToArray();

            int N = firstInputs[0];
            int M = firstInputs[1];
            int X = firstInputs[2];

            int[] C = new int[N];
            int[][] A = new int[N][];

            for (int n = 0; n < N; n++)
            {
                IEnumerable<int> line = Console.ReadLine()
                    .Split(' ')
                    .Select(s => int.Parse(s));

                C[n] = line.First();
                A[n] = line.Skip(1).ToArray();    
            }

            int minCost = C.Sum();
            bool isFound = false;

            for (uint bit = 0; bit < (1 << N); bit++)
            {
                int cost = 0;
                int[] understand = Enumerable.Repeat<int>(0, M).ToArray();

                for (int i = 0; i < N; i++)
                {
                    if (((bit >> i) & 1) == 1)
                    {
                        cost += C[i];
                        for (int m = 0; m < M; m++)
                        {
                            understand[m] += A[i][m];
                        }
                    }
                }

                if (understand.All(i => (i >= X)))
                {
                    isFound = true;
                    minCost = Math.Min(cost, minCost);
                }
            }
            if (isFound)
            {
                Console.WriteLine(minCost);
            }
            else
            {
                Console.WriteLine(-1);
            }
        }
    }
}

Measured memory_bytes: 28904
//
//  main.cpp
//  ABC118-c
//
//  Created by hiroaki on 2019/02/16.
//  Copyright © 2019年 hiroaki. All rights reserved.
//

#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

int main(){
    int n;
    cin>>n;
    vector<int> a;
    for (int i=0; i<n; i++) {
        int x;
        cin >>x;
        a.push_back(x);
    }
    
    int m=*min_element(a.begin(), a.end());
    vector<int> v;
    for (int i=0; i*i<m; i++) {
        if (m%(i+1)==0) {
            v.push_back(i+1);
            v.push_back(m/(i+1));
        }
    }
    sort(v.begin(), v.end());
    int gcd=1;
    for (int i=0; i<v.size(); i++) {
        int c=0;
        for (int j=0; j<n;j++) {
            if (a[j]%v[i]==0) {
                c++;
            }
            if (c==n) {
                gcd=v[i];
            }
        }
    }
    cout<<gcd<<endl;
    return 0;
}


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

#K回範囲を選択して反転、を繰り返し、1の連続数を最大にする
#連続した0を１度しか含まないK+1個の1の連続を探して範囲を出力する……？

change = [0]
for i in range(1,N):
    if S[i] == '1' and S[i-1] != '1':
        change.append(i)
    elif S[i] == '0' and S[i-1] != '0':
        change.append(i)

result = 0
for i, point in enumerate(change):
    if S[point] == '1':
        if i + 2 + K*2 > len(change):
            if result < N - point:
                result = N - point
            break
        if result < change[i + 1 + K*2] - 1 - point:
            result = change[i + 1 + K*2] - 1 - point
    else:
        if i + 1 + K*2 > len(change):
            if result < N - point:
                result = N - point
            break
        if i == 0:
            result = change[i + K*2]
        if result < change[i + K*2] - change[i-1]:
            result = change[i + K*2] - change[i-1]
print(result)

Measured memory_bytes: 7112
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int n, sum=0;
int A[20], B, C[20];

int main(){
  cin >> n;
  for(int i=0; i<n; i++){
    cin >> A[i];
  }
  for(int i=0; i<n; i++){
    cin >> B;
    sum+=B;
  }
  for(int i=0; i<n; i++){
    cin >> C[i];
  }
  for(int i=0; i<n-1; i++){
    if(A[i]+1==A[i+1]){
      sum+=C[A[i]-1];
    }
  }
  cout << sum << endl;
  return 0;
}

Measured memory_bytes: 256
package main

import (
	"fmt"
)

func main() {
	var n int
	fmt.Scan(&n)

	list := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Scan(&list[i])
	}

	result := "YES"
	m := make(map[int]int)
	for i := 0; i < n; i++ {
		m[list[i]]++
		if m[list[i]] > 1 {
			result = "NO"
			break
		}
	}

	fmt.Println(result)
}


Measured memory_bytes: 13696
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<cstdlib>
#include<cmath>
#include<cstring>
#include<set>
#include<map>
#include<queue>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);++i)
#define rrep(i,n) for(int (i)=(n)-1;(i)>=0;--i)
#define rep1(i,n) for(int (i)=1;(i)<=(n);++i)
#define rrep1(i,n) for(int (i)=(n);(i)>=1;--i)
#define pb push_back
#define fr first
#define sc second
typedef long long ll;
typedef pair<int,int> P;
typedef pair<long long,long long> LP;
typedef double db;
using namespace std;

int extgcd(int a,int b,int& x,int& y){
  int d=a;
  if(b != 0){
    d = extgcd( b , a%b, y, x);
    y -= (a/b)*x;
  } else{
    x=1; y=0;
  }
  return d;
}

int mod_inverse(int a,int m){
  int x,y;
  extgcd(a,m,x,y);
  return (m+x%m) %m;
}

ll pows[15];

ll calc(ll n){
  ll res = 0;
  rep(i,14){
    res += (n/pows[i])%10LL;
  }
  return res;
}
ll M = ll(1e+15);

vector<ll> ans;
ll K;
ll pos = 1;
ll id = 0;

int main()
{
  cin>>K;
  pows[0]=1;
  rep(i,14){
    pows[i+1]=pows[i]*10;
  }
  //ans.pb(pos);
  while(pos < M){
    //cout<<pos<<" "<<calc(pos)<<endl;
    while( double(pos+pows[id])/calc(pos+pows[id]) > double(pos+2*pows[id])/calc(pos+2*pows[id]) ){
      id++;
    }
    ans.pb(pos);
    pos += pows[id];
    //cout<<pos<<endl;
  }
  rep(i,K){
    cout<<ans[i]<<endl;//<<double(ans[i])/calc(ans[i])<<endl;
  }
  return 0;
}


Measured memory_bytes: 256
import bisect

MOD=10**9+7
N=int(input())

clist=[]
for i in range(N):
  c=int(input())
  clist.append(c)  
#print(clist)

c2list=clist[:1]
for i in range(1,N):
  if clist[i]!=c2list[-1]:
    c2list.append(clist[i])
#print(c2list)
N2=len(c2list)

cldic={}
dp=[0]*(N2-1)+[1]
for i in range(N2):
  c=c2list[i]
  dp[i]=dp[i-1]
  if c in cldic:
    dp[i]+=dp[cldic[c]]      
  cldic[c]=i
    
#print(dp)
print(dp[-1]%MOD)

Measured memory_bytes: 761712
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0, i##_len = (n); i < i##_len; i++)
#define reps(i, s, n) for(ll i = (s), i##_len = (n); i < i##_len; i++)
#define rrep(i, n) for(ll i = (n) - 1; i >= 0; i--)
#define rreps(i, e, n) for(ll i = (n) - 1; i >= (e); i--)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) ((ll)(x).size())
#define len(x) ((ll)(x).length())
#define endl "\n"

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    // ifstream in("input.txt");
    // cin.rdbuf(in.rdbuf());
    ll n;
    cin >> n;
    vector<ll> a(n);
    rep(i, n) cin >> a[i];
    ll ans = 0;
    rep(i, n) {
        if ((i % 2 == 0) && (a[i] % 2 == 1)) {
            ans++;
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3580
#pragma region include
#include <iostream>
#include <iomanip>
#include <stdio.h>

#include <sstream>
#include <algorithm>
#include <cmath>
#include <complex>

#include <string>
#include <cstring>
#include <vector>
#include <tuple>
#include <bitset>

#include <queue>
#include <complex>
#include <set>
#include <map>
#include <stack>
#include <list>

#include <fstream>
#include <random>
//#include <time.h>
#include <ctime>
#pragma endregion //#include
/////////
#define REP(i, x, n) for(int i = x; i < n; ++i)
#define rep(i,n) REP(i,0,n)
/////////
#pragma region typedef
typedef long long LL;
typedef long double LD;
typedef unsigned long long ULL;
#pragma endregion //typedef
////定数
const int INF = (int)1e9;
const LL MOD = (LL)1e9+7;
const LL LINF = (LL)1e18;
const double PI = acos(-1.0);
const double EPS = 1e-9;
/////////
using namespace::std;

void solve(){
	int N,M;
	cin >> N >> M;
	vector< vector<int> > que(M,vector<int>(3) );//R,L,X
	for(int i=0;i<M;++i){
		cin >> que[i][1] >> que[i][0] >> que[i][2];
	}
	sort( que.begin(), que.end() );
	vector< vector<LL> > now(N+1,vector<LL>(N+1,0));
	vector< vector<LL> > next(N+1,vector<LL>(N+1,0));
	vector< vector<LL> > zero(N+1,vector<LL>(N+1,0));
	
	int queNo = 0;
	now[0][0] = 1;
	for(int POS=1; POS<=N;++POS ){//POS番目を作る
		//条件は後で判定する。
		//配るだけ配る
		int k = POS-1;
		for(int i=0;i<=k;++i){
			for(int j=i;j<=k;++j){
				//i<=j<k
				if( now[i][j] ){
					LL val = now[i][j];
					next[i][j] += val;
					next[j][k] += val;
					next[i][k] += val;
					next[i][j] %= MOD;
					next[j][k] %= MOD;
					next[i][k] %= MOD;
				}
			}
		}

		//条件のチェック
		while( queNo < M && que[queNo][0] < POS ){
			++queNo;
		}
		for(int i=0;i<POS;++i){
			for(int j=i;j<POS;++j){
				bool flag = true;
				for(int Q=queNo;Q<M&& que[Q][0] == POS;++Q){
					int L = que[Q][1];
					int val = que[Q][2];
					int num = 1;
					if( L <= i ) ++num;
					if( L <= j ) ++num;

					if( num != val ){
						flag = false;
						break;
					}
				}
				if( flag == false ){
					next[i][j] = 0;
				}
			}
		}
		
		//次への処理
		now = next;
		next = zero;
	}

	//nowを数える。
	LL ans = 0;
	for(int i=0;i<N;++i){
		for(int j=i;j<N;++j){
			ans += now[i][j];
			ans %= MOD;
		}
	}
	cout << ans << endl;
}
#pragma region main
signed main(void){
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	std::cout << std::fixed;//小数を10進数表示
	cout << setprecision(16);//小数点以下の桁数を指定//coutとcerrで別	
	
	solve();
}
#pragma endregion //main()


Measured memory_bytes: 2432
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file 
#include <ext/pb_ds/tree_policy.hpp> 
#include <functional> // for less 
#define pb push_back
#define For(i,s,e) for (ll i=(s); i<(e); i++)
#define Debug_array(a,n) for (ll i=(0); i<(n); i++) cout<<a[i]<<" "
#define Foe(i,s,e) for (ll i=(s); i<=(e); i++)
#define Fod(i,s,e) for (ll i=(s)-1; i>=(e); i--)
#define pii pair<ll,ll>
#define fi first
#define se second
#define endl "\n"
#define mp make_pair
#define big_prime 15486277
#define bigger_prime 179424697
#define biggest_prime 32416188691
//#define random_shuffle(indices.begin(), indices.end());
//std::random_device rd;
//std::mt19937 g(rd());
//std::shuffle(v.begin(), v.end(), g);
using namespace __gnu_pbds; 
using namespace std;
template <class T> ostream& operator << (ostream &os, const vector<T> &v) { for (T i : v) os << i << ' '; return os; }
template <class T> ostream& operator << (ostream &os, const set<T> &v) { for (T i : v) os << i << ' '; return os; }
template <class T, class S> ostream& operator << (ostream &os, const pair<T, S> &v) { os << v.first << ' ' << v.second; return os; }
// template <class T, class S> ostream& operator << (ostream &os, const unordered_map<T, S> &v) { for (auto i : v) os << '(' << i.first << "=>" << i.second << ')' << ' '; return os; }
 
#ifndef ONLINE_JUDGE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template <class Arg1> void __f(const char* name, Arg1&& arg1) { cerr << name << " : " << arg1 << endl; }
    template <class Arg1, class... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args) {
        const char* sep = strchr(names + 1, ',');
        cerr.write(names, sep - names) << " : " << arg1 << "  ";
        __f(sep + 1, args...);
    }
#else
#define trace(...) 0
#define _CRT_SECURE_NO_WARNINGS
#endif // ifndef ONLINE_JUDGE


typedef long long ll;
typedef tree<ll, null_type, less<ll>, rb_tree_tag,tree_order_statistics_node_update> ordered_set; 

#define Mod 1000000007
#define MAX 5002

int main(){
	ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
	
	string s;cin>>s;
	ll n = s.size()+1;
	ll a[n],b[n];
	a[0]=0;
	b[n-1]=0;
	For(i,0,n-1){
		if(s[i]=='<'){
			a[i+1]=1;
			b[i]=0;
		}else{
			a[i+1]=0;
			b[i]=1;
		}
	}
	ll prefix[n];
	prefix[0]=0;
	For(i,1,n){
		if(a[i]==1) prefix[i] = (prefix[i-1]+1);
		else prefix[i]=0;
	}
	ll suffix[n];
	suffix[n-1]=0;
	Fod(i,n-1,0){
		if(b[i]==1) suffix[i] = (suffix[i+1]+1);
		else suffix[i]=0;
	}

	ll sum = 0;
	For(i,0,n){
		sum += max(prefix[i],suffix[i]);
		// ll c = max(prefix[i],suffix[i]);
		// trace(c);
	}
	cout<<sum<<endl;




























	
}

Measured memory_bytes: 16540
import java.util.*;
public class Main {
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		if(a == b && b == c) {
			System.out.println(1);
			return;
		}
		if(a == b || b == c || a == c) {
			System.out.println(2);
			return;
		}
		System.out.println(3);
	}
}


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

using namespace std;
using ll = long long;
using vl = vector<ll>;
using pll = pair<ll, ll>;

#define rep(i, n) for (ll i = 0, xxx_rep_end = (n); i < xxx_rep_end; ++i)
#define all(x) (x).begin(), (x).end()

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

constexpr ll INF = 0x3f3f3f3f3f3f3f3fLL;
constexpr ll mod = 1000000007;

int main() {
    string S;
    cin >> S;
    if (S[0] == S[1] && S[1] == S[2]) {
        cout << "No" << endl;
        return 0;
    }
    cout << "Yes" << endl;
}

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

typedef long long ll;
#define REP(i,n) for(int i=0,_n=(int)(n);i<_n;++i)
#define ALL(v) (v).begin(),(v).end()
#define CLR(t,v) memset(t,(v),sizeof(t))
template<class T1,class T2>ostream& operator<<(ostream& os,const pair<T1,T2>&a){return os<<"("<<a.first<<","<<a.second<< ")";}
template<class T>void pv(T a,T b){for(T i=a;i!=b;++i)cout<<(*i)<<" ";cout<<endl;}
template<class T>void chmin(T&a,const T&b){if(a>b)a=b;}
template<class T>void chmax(T&a,const T&b){if(a<b)a=b;}


int nextInt() { int x; scanf("%d", &x); return x;}

int main2() {
  int A = nextInt();
  int B = nextInt();
  int C = nextInt();
  cout << max(0, C - (A-B)) << endl;
  return 0;
}

int main() {

#ifdef LOCAL
  for (;!cin.eof();cin>>ws)
#endif
    main2();
  return 0;
}


Measured memory_bytes: 256
# B
s = gets
h = s[0..1].to_i
t = s[2..3].to_i
m = 1..12
case
when (h >= 0 && m.include?(t)) && (t >= 0 && m.include?(h))
  puts 'AMBIGUOUS'
when h >= 0 && m.include?(t)
  puts 'YYMM'
when t >= 0 && m.include?(h)
  puts 'MMYY'
else
  puts 'NA'
end


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

int main() {
  int N;
  cin >> N;
  
  int Answer=1;
  
  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());
  
  for (int i=0; i<N-1; i++){
    if(vec.at(i)!=vec.at(i+1)){
      Answer++;
    }
  }
  
  cout << Answer << endl;
}


Measured memory_bytes: 3616
#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(), (x).end()
#define SZ(X) ((int)(X).size())
#define endl "\n";
int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	// freopen("input.txt", "r", stdin);
	// freopen("output.txt", "w", stdout);
	int n,a,max=0, min=10001;
	cin>>n;
	for (int i = 0; i < n; ++i)
	{
		cin>>a;
		if(a>max){
			max=a;
		}
		if(a<min){
			min=a;
		}
	
	}
	cout<<max-min;

   return 0;
}


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

int main() {
  int N;
  cin >> N;
  
  vector<int> a(N), b(N), c(N);
  for (int i = 0; i < N; i++) {
    cin >> a.at(i) >> b.at(i) >> c.at(i);
  }
  
  vector<vector<int>> dp(N, vector<int>(3, -1));
  dp.at(0) = {a.at(0), b.at(0), c.at(0)};
  for (int i = 1; i < N; i++) {
    for (int j = 0; j < 3; j++) {
      int x = a.at(i);
      if (j == 1) x = b.at(i);
      if (j == 2) x = c.at(i);
      
      dp.at(i).at(j) = max(dp.at(i).at(j), dp.at(i - 1).at((j + 1) % 3) + x);
      dp.at(i).at(j) = max(dp.at(i).at(j), dp.at(i - 1).at((j + 2) % 3) + x);
    }
  }
  
  int ans;
  for (int i = 0; i < 3; i++) {
    ans = max(dp.at(N - 1).at(0), dp.at(N - 1).at(1));
    ans = max(ans, dp.at(N - 1).at(2));
  }
  
  cout << ans << endl;
  
  return 0;
}

Measured memory_bytes: 6912
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.Design;
using System.IO.Compression;
using System.Linq;
using System.Numerics;
using System.Text;

namespace Atcoder
{
    class Program
    {
        private const long COMDIV = 1000000007;
        static void Main(string[] args)
        {
            var X = long.Parse(Console.ReadLine());
            double cal = 100;
            int count = 0;
            while (X > cal)
            {
                cal += Math.Truncate(cal * 0.01);
                count++;
            }

            Console.WriteLine(count);
        }
        
    }
}

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

int main() {
  string S,T,U;
  int a,b;
  cin >> S >> T;
  cin >> a >> b;
  cin >> U;
  if(U == S)a--;
  else if(U == T)b--;
  cout << a <<" "<< b << endl;
}


Measured memory_bytes: 256
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author aajisaka
 */

#include<bits/stdc++.h>

using namespace std;

void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

#define SPEED ios_base::sync_with_stdio(false);cin.tie(nullptr)
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define all(v) v.begin(), v.end()
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

using ll = long long;
using P = pair<ll, ll>;

constexpr long double PI = 3.14159265358979323846264338327950288L;
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());

class FSilverFoxVsMonster {
public:
    void solve(istream& cin, ostream& cout) {
      SPEED;
      ll n, d, a; cin >> n >> d >> a;
      vector<P> vec(n);
      rep(i, n) {
        cin >> vec[i].first >> vec[i].second;
      }
      sort(all(vec));
      ll ans = 0;
      vector<ll> x(n);
      rep(i, n) x[i] = vec[i].first;

      vector<ll> imos(n+1);
      rep(i, n) {
        ll now = imos[i];
        ll h = vec[i].second;
        h -= a*now;
        if (h > 0) {
          ll cnt = (h+a-1)/a;
          ans += cnt;
          imos[i] += cnt;
          auto it = upper_bound(all(x), x[i]+2*d);
          auto pos = distance(x.begin(), it);
          imos[pos] -= cnt;
        }
        imos[i+1] += imos[i];
      }

      cout << ans << endl;
    }
};

signed main() {
  FSilverFoxVsMonster solver;
  std::istream& in(std::cin);
  std::ostream& out(std::cout);
  solver.solve(in, out);
  return 0;
}

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

int main() {

    int N;
    cin >> N;

    string S;
    cin >> S;

    ll ans = 0;
    ll r = 0;
    ll w = 0;
    rep(i, N) {
        if (S[i] == 'R') r++;
        else w++;
    }

    ll cnt_r = 0;
    ll cnt_w = 0;
    rep(i, N) {
        if (i < r && S[i] == 'W') cnt_w++;
        if (i >= r && S[i] == 'R') cnt_r++;
    }

    cout << max(cnt_r, cnt_w) << endl;

    return 0;
}


Measured memory_bytes: 3716
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int H = sc.nextInt();
    int W = sc.nextInt();
    long[][] table = new long[H][W];
    for(int i = 0; i < table.length; i++){
      Arrays.fill(table[i], -1L);
      String str = sc.next();
      for(int j = 0; j < table[i].length; j++){
        table[i][j] = (str.charAt(j) == '#') ? 0L : table[i][j];
      }
    }
    System.out.println(solve(table));
  }
  
  public static long solve(long[][] table){
    boolean flag = false;
    for(int i = 1; i < table[0].length; i++){
      if(flag || table[0][i] == 0L){
        table[0][i] = 0;
        flag =true;
      }else{
        table[0][i] = 1L;
      }
    }
    flag = false;
    for(int i = 1; i < table.length; i++){
      if(flag || table[i][0] == 0L){
        table[i][0] = 0L;
        flag =true;
      }else{
        table[i][0] = 1L;
      }
    }
    for(int i = 1; i < table.length; i++){
      for(int j = 1; j < table[i].length; j++){
        if(table[i][j] == -1L){
          table[i][j] = (table[i][j-1] + table[i-1][j]) % (1000000000 + 7);
        }
      }
    }
    return table[table.length-1][table[0].length-1];
  }
}

Measured memory_bytes: 37856
#include<iostream>
#include<stdio.h>
using namespace std;
int main()
{
    int a,b,c,d,ar1,ar2;
    scanf("%d%d%d%d",&a,&b,&c,&d);
    ar1=a*b;
    ar2=c*d;
    if(ar1>ar2)
        printf("%d",ar1);
    else if(ar2>ar1)
        printf("%d",ar2);
    else
        printf("%d",ar1);
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <climits>

using namespace std;

long long int N;

vector<pair<long long int,int>> decompose(long long int number) {
    vector<pair<long long int,int>> results;

    for (long long int i = 2; i*i <= number; i++) {
        int count = 0;
        while (number % i == 0) {
            count++;
            number /= i;
        }

        if (count)
            results.push_back(make_pair(i, count));
    }

    if (number != 1)
        results.push_back(make_pair(number, 1));

    return results;
}

long long int power(long long int base, int times) {

    if (times == 0)
        return 1;

    if (times == 1)
        return base;

    long long int half = power(base, times/2);

    if (times % 2)
        return half*half*base;
    else
        return half*half;
    
}


long long int minimum;

void find (long long int multi, int index, vector<pair<long long int,int>>& elements) {

    if (index == elements.size()) {
        long long int value = multi + (N/multi);
        if (value < minimum)
            minimum = value;
        return; 
    }

    auto element = elements[index];
    for (int num = 0; num <= element.second; num++) {
        long long int value = power(element.first, num);
        find(multi*value, index+1, elements);
    }
}

int main(){
   
    cin >> N;

    auto elements = decompose(N);

    minimum = LLONG_MAX; 

    find((long long int)1, 0, elements);
    
    cout << minimum-2 << "\n";

    return 0;
}


Measured memory_bytes: 256
#pragma GCC optimize ("O2")
#pragma GCC target ("avx2")
//#include<bits/stdc++.h>
#include<iostream>
#include<algorithm>
#include<cstring>
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 chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#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;
}
const int dm = 1400000;
char dn[dm], * di = dn;
const int MAX = 20000;
class unko {
public:
	char C[MAX * 6 + 10];
	int K[MAX + 10];
	constexpr unko() : C(), K() {
		auto di = C + 1;
		C[0] = '0';
		K[0] = 0;
		K[1] = 1;
		rep1(i, MAX) {
			int X = i;
			int keta = 0;
			char c[10] = {};
			while (X) {
				*(c + keta) = '0' + X % 10;
				X /= 10;
				keta++;
			}
			for (int j = keta - 1; j >= 0; j--)* di++ = (*(c + j));
			K[i + 1] = K[i] + keta;
		}
	}
};
constexpr unko f;
inline void putint(ll X) {
	if (X > 20000) {
		int ue = X / 10;
		for (int i = f.K[ue]; i < f.K[ue + 1]; i++)* di++ = f.C[i];
		*di++ = '0' + (X - ue * 10);
	}
	else for (int i = f.K[X]; i < f.K[X + 1]; i++)* di++ = f.C[i];
	*di++ = '\n';
}

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


	int N = getint(), K = getint();

	int A[200001];
	rep(i, N) A[i] = getint();
	ll owa = ll(N) * N;

	rep(p, K) {
		int B[200001] = {};
		rep(i, N) {
			B[max(0, i - A[i])]++;
			B[min(N, i + A[i] + 1)]--;
		}
		ll kei = B[0];
		A[0] = B[0];
		rep1(i, N - 1) {
			kei +=(A[i] = A[i - 1] + B[i]);
		}
		if (kei == owa) break;
	}

	rep(i, N) putint(A[i]);
	fwrite(dn, 1, di - dn, stdout);

	Would you please return 0;
}

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

#define pout(n)  printf ("%d\n", n)

#define rep(i,a,n) for (int i = a;i < n;i++)
#define per(i,n,a) for (int i = n-1;i >= a;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());

const int d4x[4] = {1, 0, -1, 0};
const int d4y[4] = {0, 1, 0, -1};
const int d8x[8] = { 1,1,0,-1,-1,-1,0,1 };
const int d8y[8] = { 0,1,1,1,0,-1,-1,-1 };

#define MAX_N (int)2e5+20
#define INF 1e12+20

typedef long long ll;
using namespace std;

string s;
int main() {
	cin >> s;
	int count = 0;
	rep(i,0,s.size()){
		if(s[i] == '1') count++;
	}
	pout(count);
	return 0;
}

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

int main(void) {

	int n, r;

	scanf("%d %d", &n, &r);

	int rate = 0;

	if(n < 10) {
		rate = r + 100*(10-n);
	} else {
		rate = r;
	}

	printf("%d\n", rate);

	return 0;

}


Measured memory_bytes: 128
from collections import deque
import sys

input()
lst = deque()

for s in sys.stdin:
    if s[0] == 'i':
        lst.appendleft(s[7:-1])

    else:
        a = s[6]
        if a == ' ':
            try:
                lst.remove(s[7:-1])
            except:
                pass

        elif a == 'F':
                lst.popleft()

        else:
            lst.pop()

print(*lst)


Measured memory_bytes: 69732
*aa,n = map(int, open(0).read().split())

n *= 1000

bb = [250,500,1000,2000]

for i in range(1,4):
    aa[i] = min(aa[i], aa[i-1]*2)

ans = 0
for b,a in zip(bb[::-1], aa[::-1]):
    ans += n // b * a
    n %= b

print(ans)

Measured memory_bytes: 61860
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
using namespace std;
#define ll long long
#define rep(i, n) for(int i = 0; i < n; i++)
int main() {
    ll n, m, k;
    cin >> n >> m >> k;
    vector<ll> a(n), b(m);
    rep(i, n) cin >> a[i];
    rep(i, m) cin >> b[i];
    vector<ll> a_sum(n+1);
    vector<ll> b_sum(m+1);
    a_sum[0] = 0;//a[0];
    b_sum[0] = 0;//b[0];
    int a_flag = 0;
    for(int i = 1; i < n+1; i++) {
        a_sum[i] = a_sum[i-1]+a[i-1];
    }
    for(int i = 1; i < m+1; i++) {
        b_sum[i] = b_sum[i-1]+b[i-1];
    }
    for(int i = 0; i < n+1; i++) {
        if(a_sum[i] <= k) {
            a_flag = i;
        }
    }
    
    ll ans = 0;
    ll time = 0;
    int b_flag = 0;
    for(int i = a_flag; i >= 0; i--) {
        for(int j = b_flag; j < m+1; j++) {
            if(a_sum[i]+b_sum[j] <= k) {
                time = max(time, a_sum[i]+b_sum[j]);
                ll ij = i+j;
                ans = max(ans, ij);
                b_flag = j;
            }
            else {
                break;
            }
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 9600
#include <stdio.h>

int main(void) {
	// your code goes here
	
	int W,H,x,y,r;
	
	scanf("%d%d%d%d%d",&W,&H,&x,&y,&r);
	if(W-r >= x&& H-r >= y &&r<=x&&r<=y){
		printf("Yes\n");
	}else{
		printf("No\n");
	}
	return 0;
}



Measured memory_bytes: 2140
/// DONOT COPY PASTA WITHOUT AUTHOR'S PERMISSION ///
 ///                   S S S                      ///
///                1 7 0 7 0 5 3                 ///

#include<bits/stdc++.h>
#include<string>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <stdlib.h>
#include<string>
///STL
#define mp make_pair
#define ss second
#define ff first
#define pb push_back
#define ist insert
///ONLINE JUDGE
#define io ios_base::sync_with_stdio;cin.tie(0);cout.tie(0)
#define READ freopen("input.txt","r", stdin)
#define case(i) "Case "<<i++<<": "
#define nscase(i) "Case "<<i++<<":"
///c shortcuts
#define sns(s) scanf("%s",&s)
#define snc(c) scanf("%c",&c)
#define snd(a) scanf("%d",&a)
#define snl(a) scanf("%lld",&a)
#define snul(a) scanf("%ull",&a)
///Loops
#define mem(a,b) memset(a, b, sizeof(a))
#define rep(i,k,n) for(int i=k;i<n;i++)
#define rev(j,n,k) for(int j=n;j>=k;j--)
#define TC int tc;cin>>tc;while(tc--)

///GCD LCM
#define gcd(a, b) __gcd(a, b)
#define lcm(a, b) ((a / __gcd(a, b) ) * b)

///CONSTANTS
#define PI 2*acos(0.0)
#define MAX 1000000000
#define inf 1e18

///functions
#define base(n,b) floor(log(n)/log(b))+1
#define onecnt(x) __builtin_popcount(x)
#define to_binary(n,b) bitset<b>(n).to_string()

#define endl '\n'
#define esc cout<<"\n"

/*------------------------------Graph Moves----------------------------*/
///const int fx[]= {+1,-1,+0,+0};
///const int fy[]= {+0,+0,+1,-1};
///const int fx[]= {+0,+0,+1,-1,-1,+1,-1,+1};  // Kings Move
///const int fy[]= {-1,+1,+0,+0,+1,+1,-1,-1}; // Kings Move
///const int fx[]={-2, -2, -1, -1,  1,  1,  2,  2};  // Knights Move
///const int fy[]={-1,  1, -2,  2, -2,  2, -1,  1}; // Knights Move
/*---------------------------------------------------------------------*/

using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<long,long> pll;
typedef std::map<long long,int> mli;
typedef std::map<long long,long long> mll;
typedef std::map<int,int> mii;

///PBDS
using namespace __gnu_pbds;
typedef tree<
ll,
null_type,//set to another type while using map
less<ll>,
rb_tree_tag,
tree_order_statistics_node_update> ordered_set;

template <typename T>
std::string toString( T Number )
{
    std::ostringstream ss;
    ss << Number;
    return ss.str();
}

///constants
const ll ten5=100000;
const ll ten6 =1000000;
const ll ten7 =10000000;
const ll ten8 =100000000;
const ll ten9 =1000000000;
const ll mod=ten9+7;



int main()
{
    io;

    int n;
    cin>>n;

    string s;
    cin>>s;

    int cnt=1;

    bool pos=true;

    for(int i=1;i<n;i++){
        if(s[i]!=s[i-1]){
            cnt++;
        }
    }

    cout<<cnt<<endl;


}



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

using namespace std;
typedef unsigned long long int ull;
typedef long long int ll;
typedef long double ld;
#define fr(i,a,b) for(ll i=a; i<b; i++)
#define rf(i,a,b) for(ll i=a; i>=b; i--)
#define pb push_back
#define mp make_pair
#define show(a) for(auto el:a)cout<<el<<" "
#define ff first
#define ss second
#define pairv vector<pair<ll,ll>>
#define vec vector <ll> 
#define all(a) a.begin(),a.end()
#define fam(v,i) for(auto i=v.begin();i!=v.end();i++)
#define fai(v,i) for(auto i : v)
#define mo 1000000007

#define nn cout<<"\n";
ll pow1(ll n,ll p)
{
if(p==0) return 1;
ll x=pow1(n, p/2);
x=(x*x)%mo;
if(p%2==0)
return x;
else
return (x*n)%mo;
}
bool sortbysec(const pair<ll,ll> &a, 
const pair<ll,ll> &b) 
{ 
return (a.second < b.second); 
} 
bool compare(const pair<ll, ll>&p1, const pair<ll,ll>&p2)
{
if(p1.ff < p2.ff) return true;
if(p1.ff == p2.ff) return p1.ff < p2.ss;
return false;
}
 
ll gcd(ll a, ll b) 
{ 
    if (b == 0) 
        return a; 
    return gcd(b, a % b);  
      
} 
ll findlcm(ll arr[], ll n) 
{ 
    ll ans = arr[0]; 
   ll ma=1e+18;
    for (ll i = 1; i < n; i++) 
      {  ans = (((arr[i] * ans)) / 
                (gcd(arr[i], ans))); 
                if(ans>ma)
                {
                    ans=-1;
                    break;
                }
      }
  
    return ans; 
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
  
     ll n,i;
     cin>>n;
     ll c=1;
     map<char,ll>m;
     string s;
     char e;
     fr(i,0,n)
     {
         cin>>s;
         e=s[0];
         if(e=='M' || e=='A' || e=='R' || e=='C' || e=='H')
         m[e]++;
     }
     ll l=m.size();
     ll a[l];
     i=0;
       fam(m,it)
   {
       a[i]=it->second;
       i++;
   }
     if(l==3)
     {
   fam(m,it)
   {
       c=c*(it->second);
   }
   
     }
     else if(l==4)
     {
       c=a[0]*a[1]*a[2]+a[1]*a[2]*a[3]+a[2]*a[3]*a[0]+a[3]*a[2]*a[0]; 
       //cout<<c;
     }
     else
     {
        c= c=a[0]*a[1]*a[2]+a[1]*a[2]*a[3]+a[3]*a[2]*a[0]+a[3]*a[0]*a[1]+a[2]*a[3]*a[4]+a[3]*a[4]*a[0]+a[4]*a[0]*a[1]+a[1]*a[2]*a[4]+a[1]*a[3]*a[4]+a[4]*a[0]*a[2];
     }
     if(l<3)
     cout<<0;
     else
   cout<<c;
   nn
   
    
     return 0;
}


Measured memory_bytes: 3660
#include <algorithm>
#include <iostream>
#include <cstring>
#include <cstdio>
#include <vector>
#include <queue>
#include <map>

int n, m, c, ans;
int b[110];
int a[110][110];

int main()
{
	std::ios::sync_with_stdio(0);
	std::cin.tie(0), std::cout.tie(0);
	std::cin >> n >> m >> c;
	for (int i = 1; i <= m; ++i)
		std::cin >> b[i];
	for (int i = 1; i <= n; ++i)
		for (int j = 1; j <= m; ++j)
			std::cin >> a[i][j];
	for (int i = 1; i <= n; ++i)
	{
		int cur = 0;
		for (int j = 1; j <= m; ++j)
			cur += a[i][j] * b[j];
		if (cur > -c)
			++ans;
	}
	std::cout << ans << "\n";
	return 0;
}

Measured memory_bytes: 256