akhauriyash/Code-Regression huggingface dataset:
//∵∴∵

#include<iostream>
#include<string.h>
using namespace std;

int main (){
    string O,E,Ans = "";
    cin >> O >> E;
    for(size_t i = 0;i < O.size();i++){
        Ans = Ans + O[i];
        if(E.size()==i){}else{
            Ans = Ans + E[i];
        }
    }
    cout << Ans << endl;
    return 0;
}

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

int A[200005];
ll psum[200005];

int main()
{
    int n;
    cin>>n;
    ll ans=0;
    set<ll>st;
    for(int i=1;i<=n;i++){
        cin>>A[i];
        psum[i]=psum[i-1]+1LL*A[i];
       st.insert(psum[i]);
    }
    sort(psum+1,psum+1+n);

    for(auto it=st.begin();it!=st.end();it++){
        ll val=*it;
        int cnt=upper_bound(psum+1,psum+1+n,val)-lower_bound(psum+1,psum+1+n,val);
        ans+=1LL*cnt*(cnt-1)/2;

    }
    for(int i=1;i<=n;i++)
        if(psum[i]==0)ans++;
    cout<<ans;

}

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

g = [["#"]*100 for _ in range(50)] + [["."]*100 for _ in range(50)]

for i in range(A-1):
    x, y = (i%50)*2, (i//50)*2
    g[y][x] = "."
for i in range(B-1):
    x, y = (i%50)*2, 51+(i//50)*2
    g[y][x] = "#"

print(100, 100)
for g_i in g:
    print("".join(g_i))


Measured memory_bytes: 3064
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <tuple>
using namespace std;
typedef long long ll;

int main(){

    int a, b, c; cin >> a >> b >> c;

    if(a - b > c){
        cout << 0;
    }
    else{
        cout << c - (a - b);
    }

    return 0;
}

Measured memory_bytes: 256
from collections import Counter
n = int(input())
a = list(map(int, input().split()))
x = list(Counter(a).items())
ans = 0
for i in range(len(x)):
    if x[i][0] <= x[i][1]:
        ans += x[i][1] - x[i][0]
    else:
        ans += x[i][1]
print(ans)


Measured memory_bytes: 21228
#include<iostream>
#include<string>
using namespace std;
int main() {
  string s;
  cin >> s;
  int counter = 0;
  if (s[0] == '1') ++counter;
  if (s[1] == '1') ++counter;
  if (s[2] == '1') ++counter;
  cout << counter << endl;
  return 0;
}


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

using namespace std;

int main() {
  string s;
  cin >> s;
  int n = (int)s.size();
  for (int i=0; i<n; i+=2) {
    if (i == n-1 || s.at(i) != 'h' || s.at(i+1) != 'i') {
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <queue>
#include <map>
#include <unordered_map>
#include <set>
#include <bitset>
#include <functional>
using namespace std;

typedef long long ll;

pair<int, int> ab[100003];
ll cnt[13];
set<pair<int, int>> s;

int main() {
	ll h, w; int n; cin >> h >> w >> n;
	for (int i = 0; i < n; ++i) {
		cin >> ab[i].first >> ab[i].second;
		--ab[i].first; --ab[i].second;
		s.insert(ab[i]);
	}

	for (int t = 0; t < n; ++t) {
		int posi = ab[t].first - 2, posj = ab[t].second - 2;
		for (int i = 0; i < 3; ++i) {
			for (int j = 0; j < 3; ++j) {
				if (!(0 <= posi + i && posi + i + 2 < h && 0 <= posj + j && posj + j + 2 < w)) continue;
				int c = 0;
				for (int ii = 0; ii < 3; ++ii) {
					for (int jj = 0; jj < 3; ++jj) {
						c += s.count({ posi + i + ii, posj + j + jj });
					}
				}
				++cnt[c];
			}
		}
	}
	ll sum = 0;
	for (ll i = 1; i <= 9; ++i) {
		cnt[i] /= i;
		sum += cnt[i];
	}
	cnt[0] = (h - 2)*(w - 2) - sum;
	for (int i = 0; i <= 9; ++i) cout << cnt[i] << endl;
	return 0;
}

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

using namespace std;

int n,k;
int temp;
int absolute(int a)
{
	if(a<0)return -a;
	return a;
}
int minimum(int a, int b)
{
	if(a<b)return a;
return b;

}
int Frog(vector<int>&h)
{
	//cout<<"heights : ";
	
	vector<int>cost(n,INT_MAX);
	cost[0]=0;
    
	cost[1] = absolute(h[0]-h[1]);
	

	for(int i=1;i<n;i++)
	{
		for(int j=1;j<=k;j++)
		{
			if(i-j>=0)
			cost[i]=minimum( cost[i] , cost[i-j]+absolute(h[i]-h[i-j]));
		//cout<<cost[i]<<" ";
		}
		
	}
	//cout<<endl;
	return cost[n-1];
}
int main()
{
	#ifdef patil
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    #endif
     
   cin>>n>>k;
   vector<int>h;

   for(int i=0;i<n;i++)
   {
   	cin>>temp;
   	h.push_back(temp);
   }

   cout<<Frog(h);

	return 0;
}

Measured memory_bytes: 3916
#include <bits/stdc++.h>
using namespace std;
 
string S; map<string,long long>M[3]; long long mod=998244353;
 
string AND(string A1,string A2){
	for(int i=0;i<(int)A1.size();i++){
		if(A2[i]=='0') A1[i]='0';
	}
	return A1;
}
long long bitsum(string W){
	long long I=1;
	for(int i=0;i<(int)W.size();i++) {if(W[i]=='0')continue;I*=2;I%=mod;}
	return I;
}
long long solve(string V, int state) {
	if(M[state][V]>=1) {
		//cout<<"! "<<state<<" "<<V<<" "<<M[state][V]-1<<endl;
		return M[state][V]-1;
	}
	if(V.size()==1) {
		if(state==1) return 0;
		return bitsum(V);
	}
	long long sum=0;
	if(state==2){
		long long dp[109];
		for(int i=0;i<=(int)V.size();i++) {dp[i]=0;}
		dp[0]=1;
		for(int i=0;i<(int)V.size();i++){
			string G="";
			for(int j=i+1;j<=(int)V.size();j++){
				G+=V[j-1];
				if(i==0 && j==(int)V.size()) continue;
				dp[j]+=dp[i]*solve(G,1);
				if(j-i==1) dp[j]+=dp[i]*solve(G,2);
				dp[j]%=mod;
			}
		}
		sum+=dp[V.size()];
	}
	else {
		for(int i=1;i<(int)V.size();i++){
			if(V.size()%i!=0) continue;
			string F=V.substr(0,i);
			for(int j=0;j<(int)V.size();j+=i){
				F=AND(F,V.substr(j,i));
			}
			long long P=solve(F,2)+solve(F,1); sum+=P; sum%=mod;
		}
	}
	M[state][V]=sum+1;
	return sum;
}
 
int main() {
	cin>>S;
	cout<<(solve(S,1)+solve(S,2))%mod<<endl;
	return 0;
}

Measured memory_bytes: 8960
#include <iostream>
#include <vector>

using namespace std;

#define rep(i, n) for (int i = 0; i < int(n); ++i)

int solve(const vector<int>& skd) {
    vector<long long> hand(skd.size());
    rep(i, skd.size()) hand[i] |= 1LL << i;
    for (int day = 1; day <= 30; ++day) {
        long long x = 0;
        rep(i, skd.size()) if (skd[i] >> day & 1) x |= hand[i];
        rep(i, skd.size()) if (skd[i] >> day & 1) hand[i] |= x;
        rep(i, skd.size()) if (hand[i] == (1LL << skd.size()) - 1) return day;
    }
    return -1;
}

int main() {
    for (int n; cin >> n, n;) {
        vector<int> skd(n);
        rep(i, n) {
            int f;
            cin >> f;
            for (int x; f--; skd[i] |= 1 << x) cin >> x;
        }
        cout << solve(skd) << endl;
    }
    return 0;
}

Measured memory_bytes: 1196
def gcd(a, b):
    if a > b:
        a, b = b, a
    while a % b != 0:
        a, b = b, a % b
    return b
def lcm(a, b):
    return a * b // gcd(a, b)

n = int(input())
A = list(map(int, input().split()))

l = 1
for a in A:
    l = lcm(l, a)

print(sum((l - 1) % a for a in A))

Measured memory_bytes: 3316
import java.io.PrintWriter;
        import java.util.ArrayList;
        import java.util.Collections;
        import java.util.List;
        import java.util.Scanner;

public class Main {
    static private Scanner scan = new Scanner(System.in);
    public static void main(String args[]) {
        int int1 = Integer.parseInt(scan.next());
        int int2 = Integer.parseInt(scan.next());
        int int3 = Integer.parseInt(scan.next());
        int int4 = Integer.parseInt(scan.next());
        String ans = null;
        int ans_int = 0;
        if(int1 < int2){
            ans_int += int1;
        }else{
            ans_int += int2;
        }

        if(int3 < int4){
            ans_int += int3;
        }else{
            ans_int += int4;
        }
        PrintWriter out = new PrintWriter(System.out);
        out.println(ans_int);
        out.flush();
        scan.close();
    }
}


Measured memory_bytes: 23124
#if 1
#include <iostream>
#include <cmath>
#include <string>
#include <vector>
#include <climits>
#include <algorithm>
#include <unordered_set>
#include <unordered_map>
#include <functional>
#include <set>
#include <map>
#include <numeric>
#include <cassert>

using namespace std;
#define int long long
#define uint unsigned long long
constexpr int MOD = 1000000007;
constexpr int INF = 1145141919810;

#define LOADVEC(type,name,N) std::vector<type>name(N); \
for (int nnn = 0; nnn < N; ++nnn) { \
	cin >> name[nnn]; \
}

#define LOADVEC2(type,name0,name1,N) std::vector<type>name0(N),name1(N); \
for (int nnn = 0; nnn < N; ++nnn) { \
	cin >> name0[nnn];cin >> name1[nnn]; \
}

#define LOADVEC3(type,name0,name1,name2,N) std::vector<type>name0(N),name1(N),name2(N); \
for (int nnn = 0; nnn < N; ++nnn) { \
	cin >> name0[nnn];cin >> name1[nnn];cin >> name2[nnn]; \
}

#define LOAD(type,name) type name; \
cin >> name;


void proc();

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

/*
--------------------------------------------------------
--------------------------------------------------------
---------------    template      ----------------------
--------------------------------------------------------
--------------------------------------------------------
*/



void proc() {
	LOAD(int, N);
	LOADVEC(int, A, N);
	int parity = 1;
	int m = INF;
	int sum = 0;
	for (int i = 0; i < N; i++) {
		if (A[i] < 0) {
			parity *= -1;
		}
		sum += abs(A[i]);
		if (m > abs(A[i]))m = abs(A[i]);
	}
	if (parity == -1) {
		sum -= 2 * m;
	}
	cout << sum << endl;
}


#endif


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

int main() {
    int N, M, a, ans=0, flag=-1, tmp;
    cin  >> N;
    priority_queue<int, vector<int>> asc;
    priority_queue<int, vector<int>, greater<int>> desc;
    vector<int> ansX(N), ansY(N);
    

    for(int i=0; i<N; i++){
	cin >> a;
	desc.push(a);
	asc.push(a);
    }

    if(asc.top()<=0)
	flag = 1;
    else if(desc.top() >=0)
	flag = 2;
    else
	flag = 3;

    

    for(int i=0; i<N-1; i++){
	if(flag ==1){
	    ansX[i] = asc.top();
	    ansY[i] = desc.top();
	    a = asc.top() - desc.top() ;
	    	    
	    desc.pop();
	    asc.pop();
	    desc.push(a);
	    asc.push(a);


	}
	else if(flag == 2){
	    ansX[i] = desc.top();
	    ansY[i] = asc.top();
	    a = desc.top() - asc.top() ;
	    	    
	    desc.pop();
	    asc.pop();
	    desc.push(a);
	    asc.push(a);

	    
	}
    }
    if(flag == 3){
	tmp = asc.top();
	asc.pop();    	
    }
    if(flag == 3){
	for(int i=0; i<N-1; i++){
	    if(asc.top() > 0 && flag ==3){
		a = desc.top() - asc.top() ;				
		ansX[i] = desc.top();
		ansY[i] = asc.top();		
	    }
	    else{
		flag =1;
		asc.push(tmp);
		a = asc.top() - desc.top();
		ansX[i] = asc.top();
		ansY[i] = desc.top();


	    }
	    desc.pop();
	    asc.pop();
	    desc.push(a);
	    asc.push(a);

	}
    }


    if(flag == 2)
	swap(ansX[N-2], ansY[N-2]);
    
    ans =ansX[N-2] - ansY[N-2];
    cout << ans << endl;
    
    for(int i=0; i<N-1; i++){
	cout << ansX[i] << " "<< ansY[i] << endl;
    }

    


}




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

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

Measured memory_bytes: 256
import Data.List.Split

main = do
  ns <- getNums
  let sorted = quickSort ns
  printList sorted

printList [] = putStrLn ""
printList (x:[]) = putStrLn $ show x
printList (x:xs) = putStr (show (x) ++ " ") >> printList xs

quickSort :: Ord a => [a] -> [a]
quickSort [] = []
quickSort (c:as) = quickSort smaller ++ c : quickSort bigger
  where
    smaller = [a | a <- as, a <  c]
    bigger  = [a | a <- as, a >= c]

getNums :: IO ([Int])
getNums = do
  s <- getLine
  return $ map read $ splitOn " " s



Measured memory_bytes: 3652
n=gets.to_i
 
 
arr=gets.split.map(&:to_i)
sum=arr.inject(:+)
 
 
group1=arr[0]
group2=arr[1]
group3=arr[2]
group4=sum-arr[0]-arr[1]-arr[2]
 
 
 
 
j=3
loop{
   
   if  (group4-group3).abs>(group4-arr[j]-group3-arr[j]).abs
       group3+=arr[j]
       group4-=arr[j]
       j+=1
       
     else 
         break
     end
}
 
 
left2=1
left3=2
left4=j
ans=[group1,group2,group3,group4].max-[group1,group2,group3,group4].min
 
 
(n-4).times{
    
    
    
    group2+=arr[left3]
    group3-=arr[left3]
    left3+=1
    
    loop{
        if (group2-group1).abs>(group2-arr[left2]-group1-arr[left2]).abs
            group2-=arr[left2]
            group1+=arr[left2]
            left2+=1
            
            
            
            
        else
            break
        end
        }
    
    
    
    
    
    loop{
        
        if (group4-group3).abs>(group4-arr[left4]-group3-arr[left4]).abs
            group4-=arr[left4]
            group3+=arr[left4]
            left4+=1
            
            
            
            
        else
            break
        end
        
        
        
        
        
        
    }
    
ans=[[group1,group2,group3,group4].max-[group1,group2,group3,group4].min,ans].min
    
    
    
    
    
}
 
p ans

Measured memory_bytes: 20500
// 入力マクロ
// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8 より
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        s: String
    }
    let n = s.len();
    let mut s: (String, usize) = (s, n);

    let mut ans = "YES";
    while !s.0.is_empty() {
        if s.0.ends_with("dream") {
            s.0 = s.0[..s.1-5].to_string();
            s.1 -= 5
        }
        else if s.0.ends_with("dreamer") {
            s.0 = s.0[..s.1-7].to_string();
            s.1 -= 7;
        }
        else if s.0.ends_with("erase") {
            s.0 = s.0[..s.1-5].to_string();
            s.1 -= 5;
        }
        else if s.0.ends_with("eraser") {
            s.0 = s.0[..s.1-6].to_string();
            s.1 -= 6;
        }
        else {
            ans = "NO";
            break;
        }
    }
    println!("{}", ans);
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long
#define all(x) (x).begin(),(x).end()
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

int ord2(int x){
    int ans = 0;
    while (x%2 == 0){
        x /= 2;
        ans++;
    }
    return ans;
}

int main() {
    int N;
    cin >> N;
    int nax = 0;
    int nid = 1;
    for (int i=1; i<=N; i++){
        if (nax < ord2(i)){
            nid = i;
            nax = ord2(i);
        }
    }
    cout << nid << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll,ll> l_l;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
typedef pair<ll,l_l> lll;
#define pb push_back
#define sz(x) (int)(x).size()
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
const int INF=1001001000;
const int mINF=-1001001000;
const ll LINF=1010010010010010000;
template<class T> inline bool chmin(T& a, T b) {
if (a > b) {
a = b;
return true;
}
return false;
}
template<class T> inline bool chmax(T& a, T b) {
if (a < b) {
a = b;
return true;
}
return false;
}
//グリッド：（典型）dp,dfs,bfs,最短経路,その他
const ll maxs=10000;
vector<lll> path[55];
ll dp[55][10010];
ll n,m,s;
ll c[55],d[55];
void Dijkstra(){
    rep(i,55){
        rep(j,maxs+1){
            dp[i][j]=LINF;
        }
    }
    dp[0][s]=0;
    priority_queue<lll,vector<lll>,greater<lll>> pq;
    pq.push({0,{0,s}});
    while(pq.size()){
        auto it=pq.top();pq.pop();
        ll nowpos=it.se.fi;
        ll nowcost=it.fi;
        ll nows=it.se.se;
        for(auto nxt:path[nowpos]){
            ll nxtpos=nxt.fi;
            ll nxtcost=nxt.se.se+nowcost;
            ll nxts=nows-nxt.se.fi;
            if(nxts>=0){
                if(chmin(dp[nxtpos][nxts],nxtcost)){
                    pq.push({nxtcost,{nxtpos,nxts}});
                }
            }
        }
        ll pluss=min(maxs,nows+c[nowpos]);
        ll pluscost=nowcost+d[nowpos];
        if(chmin(dp[nowpos][pluss],pluscost)){
            pq.push({pluscost,{nowpos,pluss}});
        }
    }
    return;
}
int main(){
    cin>>n>>m>>s;
    chmin(s,maxs);
    rep(i,m){
        ll u,v,a,b;cin>>u>>v>>a>>b;
        u--;v--;
        path[u].pb({v,{a,b}});
        path[v].pb({u,{a,b}});
    }
    rep(i,n){
        cin>>c[i]>>d[i];
    }
    Dijkstra();
    ll ans=LINF;
    for(int i=1;i<n;i++){
        ll ans=LINF;
        for(int j=0;j<=maxs;j++){
            chmin(ans,dp[i][j]);
        }
        cout<<ans<<endl;
    }
    //cout<<dp[1][0]<<endl;
    return 0;
}

Measured memory_bytes: 19672
#include<iostream>
#include<vector>
#include<string>
#include<map>
#include<algorithm>
using namespace std;

int main(){
    string s;
    cin>>s;
    vector<int>a(26);
    for(int i=0;i<s.size();i++){
        a[s[i]-'a']++;
    }
    bool flag=true;
    for(int i=0;i<26;i++){
        if(a[i]%2!=0)flag=false;
    }
    if(flag==true)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}

Measured memory_bytes: 3576
/*########  IN THE NAME OF ALLAH   ##########*/

#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define MAX 999999999999999999
#define nl printf("\n")
#define  r0 return 0
#define  r1 return 1
#define sf1(x)  scanf("%lld",&x)
#define sf2(x,y)  scanf("%lld %lld",&x,&y)
#define sf3(x,y,z)  scanf("%lld %lld %lld",&x,&y,&z)
#define pf1(x)  printf("%lld\n",x)
#define pf2(x,y)  printf("%lld %lld\n",x,y)
#define pf3(x,y,z)  printf("%lld %lld %lld\n",x,y,z)
#define yes  printf("YES\n")
#define no  printf("NO\n")
#define pc(x)  printf("Case %lld :",x)
#define pb push_back
#define mp make_pair
#define pa pair<ll,ll>
#define mem(a,b) memset(a,b,sizeof(a))
#define MIN  -99999999999999999
#define READ(f) freopen(f,"r",stdin)
#define WRITE(f) freopen(f,"w",stdout)
#define pi 2.0*acos(0.0)
#define sp printf(" ")
#define vs(v) (v.begin(),v.end())
ll max(ll a,ll b) {if(a>b) return a; else return b;} ll min(ll a,ll b) {if(a<b) return a; else return b;}
ll power(ll B,ll P){ if(P==0) return 1; ll X=power(B,P/2); if(P%2==0) return X*X; else return B*X*X;}
ll fx[]={1,-1,0,0}; ll fy[]={0,0,1,-1};

ll A[3000005],B[3000005],C[3000005],visited[3000005],level[3000005];
char CH[1000][1000];
vector<ll>V,G;

int main()
{
   ll T,N,E,u,Q,v,i,j,k,sum=0,ck=0,x,y,cs=0;

   string S,S1;

   double d1,d2,d3;ll ar[]={1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
    cin>>N;
    cout<<ar[N-1]<<endl;


 /************ALEYA YOUSUF ************/


 /************ALLAH IS ALMIGHTY ************/
return 0;

}


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

char change(char num) {
    if(num == '1') {
        return '9';
    } else if(num == '9') {
        return '1';
    } else {
        return num;
    }
    return ' ';
}
int main() {
    // ifstream in("data1.txt");
    // cin.rdbuf(in.rdbuf());
    string n;
    cin >> n;
    cout << change(n[0]);
    cout << change(n[1]);
    cout << change(n[2]);
    cout << endl;
}


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

int main() {
  int N, M;
  string S;
  cin >> N >> S >> M;
  vector<bool> V(N, false);

  for (int i = 0; M && i < N; i++) {
    if (S[i] == '0') {
      S[i] = '1';
      M--;
      V[i] = true;
    }
  }
  
  for (int i = N - 1; M && i >= 0; i--) {
    if (!V[i] && S[i] == '1') {
      S[i] = '0';
      M--;
    }
  }

  cout << S << endl;

  return 0;
}

Measured memory_bytes: 1204
var weights = [];
for (var i = 0; i < 10; i++) {
	weights[i] = 1 << i;
}

var input = require('fs').readFileSync('/dev/stdin', 'utf8');
var lines = input.trim().split('\n');

var line;
while (line = lines.shift()) {
	var w = +line;
	var result = [];
	for (var i = 0; i < weights.length; i++) {
		if (w & weights[i])
			result.push(weights[i]);
	}
	console.log(result.length == 0 ? 0 : result.join(' '));
}

Measured memory_bytes: 7904
#include <bits/stdc++.h>
#define rep(i, to) for (int i = 0; i < (to); ++i)
#define repf(i, from, to) for (int i = (from); i < (to); ++i)
#define unless(cond) if (!(cond))
using namespace std;
using ll = long long;
template <typename T>
using V = vector<T>;
template <typename T, typename U>
using P = pair<T, U>;

int main() {
  int n, k;
  cin >> n >> k;

  if(n == 1) {
    cout << k << endl;
    return 0;
  }
  ll ans = k;
  repf(i, 1, n) {
    ans *= k - 1;
  }
  cout << ans << endl;
}

Measured memory_bytes: 3596
N,K=map(int,input().split())
dlist=[]
Alist=[]
myset1=set([])

for i in range(K):
    d=int(input())
    dlist.append(d)
    templist=list(map(int,input().split()))
    for j in range(len(templist)):
        Alist.append(templist[j])
    
    
    
myset1=set(Alist)    
#print(dlist)
#print(Alist)
#print(myset1)


print(N-len(myset1))

Measured memory_bytes: 9108
#pragma GCC optimize ("O3")
#pragma GCC target ("avx")
#include <bits/stdc++.h>

using namespace std;

/**
 * main
 */
int main () {
  string l1, l2;
  cin >> l1 >> l2;

  reverse(l1.begin(), l1.end());

  cout << ((l1 == l2) ? "YES" : "NO") << '\n';
}


Measured memory_bytes: 256
#include <stdlib.h>
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
using ll=long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
inline constexpr ll gcd(ll a,ll b){if(!a||!b)return 0;while(b){ll c=b;b=a%b;a=c;}return a;}
inline constexpr ll lcm(ll a,ll b){if(!a||!b)return 0;return a*b/gcd(a,b);}

int main() {
   long long a,b;
   cin>>a>>b;
   if(a<10&&b<10){
      cout<<a*b<<endl;
   }
   else{
      cout<<-1<<endl;
   }
}



Measured memory_bytes: 256
// #define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define rep(i, n) for (int i = 0; i < n; ++i)
#define REP(i, n) for (int i = 0; i < n; ++i)
#define range(i,a,b) ((a)<=(i) && (i)<(b))
#define debug(x) cout << #x << ' ' << '=' << ' ' << (x) << endl;
#define fs first
#define sc second
#define pb push_back
typedef long long ll;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> T;
typedef priority_queue<ll> PQI;
typedef priority_queue<P> PQP;
typedef vector<vector<P>> pvec;
typedef vector<vector<ll>> vvec;
typedef vector<ll> vec;
const vector<int> dx = {0, -1, 0, 1, 1, 1, -1, -1};
const vector<int> dy = {1, 0, -1, 0, 1, -1, 1, -1};
const int MOD = (1000000007);
// const int MOD = (998244353);
// const int INF = (1 << 30);
const int INF = (1LL << 60);
const double EPS = (1 >> 30);
template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return 1;} return 0;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return 1;} return 0;}



signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(15);
    //---------------------------------------------
    
    int a,b,c;
    cin>>a>>b>>c;
    int x=0;
    for(int i=a;i<=b;i++){
        if(c%i==0){
            x++;
        }
    }
    cout<<x<<endl;

}


Measured memory_bytes: 3216
#include<bits/stdc++.h>
#define ll long long int
#define ff first
#define ss second
#define eps 1e-9

using namespace std;


int main()
{

    ll t,n,m,f,a,b,c,l,r,q,k,x,y,z,ans,mn,mx,sum=0;

    cin>>n;


    vector< ll > arr(n+1),hr(n);

    for(int i=0; i<=n; i++)
    {
        cin>>arr[i];
    }

    for(int i=0; i<n; i++)
    {
        cin>>hr[i];
    }
    ans=0;
    for(int i=0; i<n; i++)
    {
        if(arr[i]<hr[i])
        {
            ans+= arr[i];
            hr[i]-=arr[i];

            mn = min(hr[i],arr[i+1]);
            ans+= mn;
            arr[i+1]-=mn;
        }
        else
        {
            ans+= hr[i];
        }

    }
    cout<<ans<<endl;
}


Measured memory_bytes: 4824
#include "bits/stdc++.h"
#include <sys/timeb.h>
#include <fstream>

using namespace std;

#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define replrev(i,a,b) for(int i=(int)(b)-1;i>=(int)(a);i--)
#define reprev(i,n) replrev(i,0,n)
#define repi(itr,ds) for(auto itr=ds.begin();itr!=ds.end();itr++)
#define all(a) a.begin(),a.end()
#define mp make_pair
#define mt make_tuple
#define INF 2000000000
#define INFL 1000000000000000000LL
#define EPS 1e-9
#define MOD 1000000007
#define PI 3.1415926536
#define RMAX 4294967295

typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<P> vP;
typedef vector<vector<int> > vvi;
typedef vector<vector<bool> > vvb;
typedef vector<vector<ll> > vvll;
typedef vector<vector<char> > vvc;
typedef vector<vector<double> > vvd;
typedef vector<vector<P> > vvP;
typedef priority_queue<int, vector<int>, greater<int> > pqli;
typedef priority_queue<ll, vector<ll>, greater<ll> > pqlll;
typedef priority_queue<P, vector<P>, greater<P> > pqlP;
typedef pair<int, pair<int, int> > Edge;
typedef vector<Edge> vE;
typedef priority_queue<Edge, vector<Edge>, greater<Edge> > pqlE;

template<typename T>
using v = vector<T>;

int main() {
	int r, g, b;
	cin >> r >> g >> b;
	if ((10 * g + b) % 4 == 0) {
		cout << "YES" << endl;
	}
	else {
		cout << "NO" << endl;
	}

	return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int n,match[6060],slen[6060],nlen;
char s[6060],suf[6060][6060],now[6060];
bool used[6060];
bool cmp(char a[],char b[],int lena,int lenb)
{
	for(int i=1;i<=lena&&i<=lenb;++i)
		if(a[i]!=b[i])return a[i]>b[i];
	return lena>lenb;
}
int main()
{
	scanf("%d %s",&n,s+1);
	int t1=1,t2=1;
	for(int i=1;i<=n;++i)
	{
		while(s[t1]!='a')++t1;
		while(s[t2]!='b')++t2;
		match[t1]=t2,match[t2]=t1;
		++t1,++t2;
	}
	for(int i=2*n;i;--i)
	{
		memcpy(suf[i]+1,suf[i+1]+1,slen[i]=slen[i+1]);
		if(i<match[i])
		{
			if(s[i]=='a')
			{
				memcpy(now+3,suf[match[i]+1]+1,slen[match[i]+1]);nlen=slen[match[i]+1]+2;
				now[1]='a',now[2]='b';
			}
			else
			{
				int r=match[i];
				memset(used,0,sizeof(used));used[i]=used[match[i]]=1;
				for(int j=i+1;j<=r;++j)
					if(s[j]=='b'&&j<match[j])used[j]=used[match[j]]=1,r=match[j];
				nlen=0;
				for(int j=i;j<=r;++j)if(used[j])now[++nlen]=s[j];
				memcpy(now+nlen+1,suf[r+1]+1,slen[r+1]);nlen+=slen[r+1];
			}
		//	printf("%d:\n",i);
		//	for(int j=1;j<=nlen;++j)putchar(now[j]);putchar('\n');
			if(cmp(now,suf[i],nlen,slen[i]))memcpy(suf[i]+1,now+1,slen[i]=nlen);
		}
	//	for(int j=1;j<=slen[i];++j)putchar(suf[i][j]);putchar('\n');
	}
	for(int i=1;i<=slen[1];++i)putchar(suf[1][i]);
	return 0;
}


Measured memory_bytes: 35456
#include<bits/stdc++.h>
using namespace std ;
typedef long long  ll;
const ll inf = 1e18 + 10;
const ll N = 2e5 + 10;
ll n ;
ll a[N], dp[N];
ll check(ll ind)
{
    ll sum = 0;
    if(ind > n) return INT_MAX;
    if(ind == n)    return 0;
    if(dp[ind] != -1)   return dp[ind];
    sum += min(abs(a[ind] - a[ind + 1]) + check(ind + 1)  , abs(a[ind] - a[ind + 2]) + check(ind + 2));
    dp[ind] = sum;
    return sum;
}
void solve()
{
   cin >> n;
   for(ll i = 1 ; i <= n ; i ++)    cin >> a[i];
   memset(dp , -1 , sizeof dp);
   cout << check(1);
}
int main()
{
    ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
    ll t;
    t = 1;
    //cin >> t ;
    while(t --)
        solve();
    return 0;
}

Measured memory_bytes: 8296
#include<bits/stdc++.h>
#define M 200005
using namespace std;
int n,A[M],la[M];
int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++)scanf("%d",&A[i]);
	la[n]=A[n];
	for(int i=n-1;i>=1;i--)la[i]=max(la[i+1],A[i]);
	int mx=0;
	for(int i=1;i<=n;i++){
		printf("%d\n",max(la[i+1],mx));	
		mx=max(mx,A[i]);
	}
	return 0;
}

Measured memory_bytes: 3200
#include<stdio.h>
int main(){
    int a,h,m,s;
    
    scanf("%d",&a);
     
    h=a/3600;
    m=a%3600/60;
    s=a%3600%60;
    
    printf("%d:%d:%d\n",h,m,s);
    return 0;
}   




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

int n,m;
int v[1000][1000]={};
int w[1000][1000]={};

signed main(){
  cin>>n>>m;

  rep(i,n+1){
    rep(j,n+1){
      if(i==j)
        v[i][j]=0;
      else
        v[i][j]=INF;
      w[i][j]=v[i][j];
    }
  }

  rep(i,m){
    int a,b,c;
    cin>>a>>b>>c;
    v[a][b]=c;
    v[b][a]=c;
    w[a][b]=c;
    w[b][a]=c;
  }

  int ans =0;
  
  rep(k,n+1){
    rep(i,n+1){
      rep(j,n+1){
        if(i==j||j==k||k==i) continue;
        if(v[i][j]>v[i][k]+v[k][j]){
          v[i][j]=v[i][k]+v[k][j];
        }
      }
    }
  }

  rep(i,n+1){
    rep(j,n+1){
      if(i==j) continue;
        if(v[i][j]!=w[i][j]&&w[i][j]!=INF){
          ans++;
        }
      }
    }

  cout<<ans/2<<endl;
}

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

using namespace std;

#define llong long long int
#define ldouble long double
#define rep(i, n) for (int i = 0; i < n; ++i)
#define REP(i, k, n) for (int i = k; i < n; ++i)
#define fore(i,a) for (auto &i : a)
#define repr(i, n) for (int i = n; i >= 0; --i)
#define stl_rep(itr, x) for (auto itr = x.begin(); itr != x.end(); ++itr)
#define all(x) x.begin(), x.end()
#define allr(x) x.rbegin(), x.rend()

const static int mod = 1000000000 + 7;
const static int inf = INT_MAX / 2;
const static llong INF = LLONG_MAX / 2;
const static double eps = 1e-10;
const static int dx[] = {1, 0, -1, 0};
const static int dy[] = {0, 1, 0, -1};

signed main (int argc, char *argv[]) {
    int n;
    cin >> n;
    vector<int> A(n);
    int cnt_minus = 0;
    llong sum = 0;
    rep(i, n) {
        cin >> A[i];
        if (A[i] < 0) ++cnt_minus;
        sum += abs(A[i]);
    }
    
    if (cnt_minus % 2 == 0) {
        cout << sum << endl;
    } else {
        int minimum = inf;
        rep(i, n) {
            minimum = min(abs(A[i]), minimum);
        }

        cout << sum - 2 * minimum << endl;
    }

    return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  char a, b;
  cin >> a >> b;
  
  if(a == 'H'){
    if(b == 'H'){
      cout << 'H' << endl;
    }
    else{
      cout << 'D' << endl;
    }
  }
  
  if(a == 'D'){
    if(b == 'H'){
      cout << 'D' << endl;
    }
    else{
      cout << 'H' << endl;
    }
  }

}
             
 

Measured memory_bytes: 3628
#include<bits/stdc++.h>
using namespace std;
 int main()
 {
     int n,W,i,j;
     cin>>n>>W;
     long long dp[n+1][W+1];
     int w[n],v[n];
     for(i=0;i<n;i++)
     {
         cin>>w[i]>>v[i];
     }
     for(i=0;i<=n;i++)
     {
         for(j=0;j<=W;j++)
         {
             if(i==0)
             {
                 dp[i][j]=0;
             }
             else
             {
                 if(j-w[i-1]>=0)
                 {
                 dp[i][j]=max(dp[i-1][j],dp[i-1][j-w[i-1]]+v[i-1]);
                 }
                 else
                 {
                     dp[i][j]=dp[i-1][j];
                 }
             }
         }
     }
     cout<<dp[n][W];
     return 0;
 }

Measured memory_bytes: 79104
using System;
using static System.Console;
using System.Linq;

namespace Main
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] tmp = ReadLine().Split(' ').Select(int.Parse).ToArray();
            WriteLine(tmp[0] < 9 && tmp[1] < 9 ? "Yay!" : ":(");
        }
    }
}

Measured memory_bytes: 11220
#include<bits/stdc++.h>
using namespace std;
#define fraction() cout.unsetf(ios::floatfield); cout.precision(10); cout.setf(ios::fixed,ios::floatfield);
#define file() freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
#define faster() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
const long long int infLL = 9000000000000000000;
#define mem(a,b) memset(a, b, sizeof(a) )
#define all(a) (a).begin(),(a).end()
#define mx_int_prime 999999937
const int inf = 2000000000;
const double PI = acos(-1);
const double eps = 1e-9;
typedef long double ld;
#define MOD 1000000007
typedef long long ll;
const int mx=2e5+125;
ll p[mx],a[mx],b[mx];
#define PB push_back
#define endl '\n'
#define S second
#define F first
int main()
{
    faster();
    int m1,d1;
    cin>>m1>>d1;
    int m2,d2;
    cin>>m2>>d2;
    if(m1==1 && d1==31)
    {
        cout<<1<<endl;
        return 0;
    }
    if(m1==1 && d1==31)
    {
        cout<<1<<endl;
        return 0;
    }
    if(m1==2 && d1==28)
    {
        cout<<1<<endl;
        return 0;
    }
    if(m1==3 && d1==31)
    {
        cout<<1<<endl;
        return 0;
    }
    if(m1==4 && d1==30)
    {
        cout<<1<<endl;
        return 0;
    }
    if(m1==5 && d1==31)
    {
        cout<<1<<endl;
        return 0;
    }
    if(m1==6 && d1==30)
    {
        cout<<1<<endl;
        return 0;
    }
    if(m1==7 && d1==31)
    {
        cout<<1<<endl;
        return 0;
    }
    if(m1==8 && d1==31)
    {
        cout<<1<<endl;
        return 0;
    }
    if(m1==9 && d1==30)
    {
        cout<<1<<endl;
        return 0;
    }
    if(m1==10 && d1==31)
    {
        cout<<1<<endl;
        return 0;
    }
    if(m1==11 && d1==30)
    {
        cout<<1<<endl;
        return 0;
    }
    if(m1==12 && d1==31)
    {
        cout<<1<<endl;
        return 0;
    }
    else
        cout<<0<<endl;

    return  0;
}


Measured memory_bytes: 3612
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<(n); ++i)
#define chmin(x,y) x = min(x,y)
#define chmax(x,y) x = max(x,y)
using namespace std;
using Graph = vector<vector<int>>;
typedef long long ll;
typedef pair<int, int> P;
const int inf = 1 << 21;
const ll INF = 1LL << 60;
const ll mod = 1e9+7;
const int dx[4] = {-1, 0, 1, 0};
const int dy[4] = {0, -1, 0, 1};

int h, w, k;
char s[15][10005];

int main() {
    cin >> h >> w >> k;
    rep(i, h)rep(j, w) cin >> s[i][j];
    int ans = inf;

    // hを分解
    for(int bit=0; bit<1<<h-1; bit++){
        bool flag = true;
        vector<int> id(h);
        int g = 0;
        rep(i, h){
            id[i] = g;
            if (bit>>i & 1) g++;
        }
        g++;

        int cnts[15][10005];
        rep(i, g)rep(j, w) cnts[i][j] = 0;
        rep(i, h)rep(j, w) cnts[id[i]][j] += (s[i][j] - '0');

        int t_ans = g-1;
        vector<int> now(g);
        rep(j, w){
            bool ff = true;
            rep(i, g) now[i] += cnts[i][j];
            rep(i, g){
                if(now[i] > k){
                    ff = false;
                }
            }
            if (!ff){
                t_ans++;
                rep(i, g) now[i] = cnts[i][j];
                rep(i, g){
                    if(now[i] > k){
                        flag = false;
                    }
                }
                if (!flag){
                    t_ans = inf;
                    break;
                }
            }
            if (!flag) break;
        }
        chmin(ans, t_ans);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 384
#include<iostream>
#include<string>
#define ll long long
using namespace std;
string a;
ll gap[200010];
int main()
{
	cin >> a;
	ll cnt = 0;
	int t = a.size();
	ll xx = 0;
	ll dap = 0;
	for (int i = t-1; i >=0; i--) {
		if (i&&a[i] == 'C'&&a[i - 1] == 'B') {
			xx++;
			i--;
		}
		else if (a[i] == 'A') {
			dap += xx;
		}
		else xx = 0;
	}
	printf("%lld\n", dap);
}

Measured memory_bytes: 644
#include<bits/stdc++.h>
using namespace std;
long long arr[1000000],arr1[1000000],val[1000000],val1[1000000];
long long int mmm(long long int x,long long int y)
{
	if (x>y)
	{
		return x;
	}
	else
	{
		return y;
	}
}
int main()
{
    ios_base::sync_with_stdio(false); 
    cin.tie(NULL);   
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    long long x,y,z,i,j,k,n,sm,mx,kk,xxx,xx,pp,qq,ppp;
    vector <long long > v;
    z=-100000000000;
    y=-100000000000;
    cin>>n>>k;
    for (i=1;i<=n;i++)
    {
    	cin>>arr1[i];
	}
	for (i=1;i<=n;i++)
	{
		cin>>arr[i];
	}
	for (i=1;i<=n;i++)
	{
		x=0;
		mx=-10000000000000000;
		kk=k;
		for (j=0;j<=n;j++)
		{
			val1[j]=0;
		}
		j=arr1[i];
		val[i]=0;
		//cout<<i<<endl;
		if (j==i)
		{
			xxx=(k)*arr[j];
			xx=arr[j];
			xx=mmm(xx,xxx);
			v.push_back(xx);
			continue;
		}
		sm=1;
		ppp=0;
		while (1)
		{
			if (kk<=0)
			{
				break;
			}
			sm++;
			val[j]=x;
			x=x+arr[j];
			val1[j]=sm;
			mx=mmm(x,mx);
			kk--;
			if (arr1[j]==j)
			{
				if (arr[j]<0)
				{
					break;
				}
				else
				{
					x=x+arr[j]*(kk);
					mx=mmm(mx,x);
				}
				break;
			}
			if (val1[arr1[j]]>0 && ppp==0)
			{
				xxx=val1[j]-val1[arr1[j]]+1;
				xx=x-val[arr1[j]];
				if (xx<=0)
				{
					break;
				}
				//cout<<xxx<<" "<<xx<<" "<<kk<<" "<<x<<endl;
				pp=kk/xxx -1;
				qq=kk%xxx + xxx;
				x=x+pp*xx;
				kk=qq;
				mx=mmm(mx,x);
				ppp=1;
			}
			j=arr1[j];
		}
		v.push_back(mx);
	}
	
	for (i=0;i<v.size();i++)
	{
		z=max(z,v[i]);
	}
	cout<<z<<endl;
}

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

#define MAXN 51
int mutton[MAXN];
int plate[MAXN];

int main()
{
    int N,K,res=0;
    cin>>N>>K;
    
	for(int i=0;i<N;i++)
		cin>>mutton[i];
	
	int bound=min(N,K);
	for(int l=0;l<=bound;l++)
	{
		for(int r=0;r<=bound-l;r++)
		{
			int i,j;
			for(i=0;i<l;i++)
				plate[i]=mutton[i];
			for(j=0;j<r;j++)
				plate[i+j]=mutton[N-j-1];

			sort(plate,plate+l+r);

			int k=0,temp=0;
			while(k+l+r<K&&plate[k]<0)
				k++;
			while(k<l+r)
			{
				temp+=plate[k];
				k++;
			}
			
			res=max(res,temp);
		}
	}
	cout<<res<<endl;
    return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
//#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void _main()
{
    int a, b, c;
    cin >> a >> b >> c;
    cout << a + b + c - max({a, b, c}) << endl;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
struct node{
  int key;
  int cost;
  struct node *next;
};
typedef struct node *GG;
  
GG G[10001];
GG MNode(int,int,GG);
void Insert(int,int,int);
int main()
{
  int i,j,n,count=0,v,c,c1,v1;
  int color[10001],d[10001],pi[10001],mincost,ii;
  GG GGG;
  scanf("%d",&n);
  for(i=0;i<n;i++)G[i]=MNode(0,0,NULL);
  for(i=0;i<n;i++){
    scanf("%d%d",&v,&c);
    for(j=0;j<c;j++){
      scanf("%d%d",&v1,&c1);
      Insert(i,v1,c1);
    }
  }
  for(i=0;i<n;i++){
    color[i]=0;
    pi[i]=-1;
    d[i]=10000001;
  }
  d[0]=0;
   
  while(1){
    mincost=10000001;
    for(i=0;i<n;i++){
      if(color[i]!=2 && d[i]<mincost){
        mincost=d[i];
        ii=i;
      }
    }
    if(mincost==10000001)break;
    color[ii]=2;
    for(GGG=G[ii];GGG!=NULL;GGG=GGG->next){
      if(color[GGG->key]!=2 && (GGG->cost+d[ii])<d[GGG->key]){
    pi[GGG->key]=ii;
    d[GGG->key]=GGG->cost+d[ii];
    color[GGG->key]=1;
      }
    }
  }
  for(i=0;i<n;i++)printf("%d %d\n",i,d[i]);
   
  return 0;
}
  
GG MNode(int key,int cost,GG Node)
{
  GG n;
  n=(GG)malloc(sizeof(struct node));
  n->key=key;
  n->cost=cost;
  n->next=Node;
  return n;
}
void Insert(int s,int t,int u)
{
  GG GGG;
  GGG=MNode(t,u,G[s]->next);
  G[s]->next=GGG;
}


Measured memory_bytes: 17356
# -*- coding: utf-8 -*-
import sys;
import string;
sys.setrecursionlimit(20000) # 再起呼び出しの最大数をセット

import copy
import math
import itertools

from functools import lru_cache
#@lru_cache(maxsize = None)

PPP = 1000000007

# 整数の入力
n = int(input())

# スペース区切りの入力
#n, x = input().split()

# スペース区切りの整数の入力
#a, b = map(int, input().split())
#n, x = map(int, input().split())
#print("sp", n, k, file=sys.stderr)
a = [int(x) for x in input().split()]
b = [int(x) for x in input().split()]
#print("a", a, file=sys.stderr)
#p, q, r = map(int, input().split())
#s = [int(x) for x in input().split()]
#t = [int(x) for x in input().split()]

# 改行区切りの整数の入力
#a = []
#for x in range(n):
#  a.append(int(input()))
#  a.append([int(x) for x in input().split()])
#b = []
#for x in range(m):
#  b.append([int(x) for x in input().split()])
#p = [int(x) for x in input().split()]
#a.sort()
#print(l, file=sys.stderr)

# 文字列の入力
#s = input()

# 出力
#print("{} {}".format(a+b+c, s))
#a.sort()
#print(set(a), file=sys.stderr)
#print(len(set(a)))

#cache = dict()

import re
import fractions

def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)

def ton(n, k, x):
  s = ""
  while n > 0:
    s = str(n%k) + s
    n //= k
  return s


#print("a", a, file=sys.stderr)
#print("b", b, file=sys.stderr)

def getEnergy():
  for y in b:
    yield y

def doit():
  begin = 0
  end = n
  ng = 0
  total = 0
  for i in range(n):
    ab = min(a[i], b[i])
    total += ab
    a[i] -= ab
    b[i] -= ab
    ba = min(a[i+1], b[i])
    total += ba
    a[i+1] -= ba
    b[i] -= ba
  
  for i in range(n):
    i2 = n-1-i
    ab = min(a[i2+1], b[i2])
    total += ab
    a[i2+1] -= ab
    b[i2] -= ab
    ba = min(a[i2], b[i2])
    total += ba
    a[i2] -= ba
    b[i2] -= ba
  
  return total

def yn():
  if doit():
    return "YES"
  else:
    return "NO"

#print(doit([0] * 4))
#doit(a)
#print(doit())
try:
  #doit()
  print(doit())
  #print(yn())
except Exception as e:
  print("e", e, file=sys.stderr)


Measured memory_bytes: 19284
#include <iostream>

using namespace std;

int main()
{
    int a , b , time = 0 , ans = 0;
    double t;
    cin >> a >> b >> t;
    while (time <= t + 0.5){
        if (time + a > t + 0.5){
            break;
        }
        ans += b;
        time += a;
    }
    cout << ans;
    return 0;
}


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

int main(){
int N,j,M;
  cin>>N>>M;
  j=0;
  vector<long long>a(N),b(N);
  for(int i=0;i<M;i++){
    cin>>a[i];
  }
  if(N==1){
    cout<<1<<endl;
  }
else if(N==2){
    if(M==1){
      cout<<1<<endl;
    }
    else{
      cout<<2<<endl;
    }
}
  else {

    if(a[0]==1&&a[1]==2){
      cout<<0<<endl;
      return 0;
    }
    else if(a[0]==2){
      b[0]=1;
      b[1]=0;
      j=1;
    }
    else if(a[0]==1){
      b[0]=0;
      b[1]=1;
      j=1;
    
    }
    else{
      b[0]=1;
      b[1]=2;
    }
    for(int i=2;i<N;i++){
  if(a[j]==i+1){
    b[i]==0;
    j++;
  }
      else{
        b[i]=(b[i-1]+b[i-2])%1000000007;
      }
    
  }
      cout<<b[N-1]<<endl;
}
}

Measured memory_bytes: 1792
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
using namespace std;
typedef long long ll;


int main() {
	int a, b;
	cin >> a











		>> b;
	if (a*b%2==1) {
		puts("Yes");
	}
	else {
		puts("No");
	}
}

Measured memory_bytes: 256
#pragma GCC optimize("O3")
#define first x
#define second y
#include <bits/stdc++.h>

using namespace std;

enum {MOD0 = 1000000000, MOD7 = 1000000007, MOD9 = 1000000009};
typedef unsigned short ushort;typedef unsigned int uint;typedef long long ll;typedef unsigned long long ull;
#ifndef CrafterKolyan
#define endl '\n'
#endif

signed main() {
#ifndef CrafterKolyan
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
#endif
    string a, b;
    cin >> a >> b;
    const int n = a.size();
    for (int i = 0; i < a.size(); ++i) {
        bool g = true;
        for (int j = 0; j < b.size(); ++j) {
            if (a[(i + j) % n] != b[j]) {
                g = false;
                break;
            }
        }
        if (g) {
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <typeinfo>
#include <vector>
#include <stack>
#include <cmath>
#include <set>
#include <map>
#include <string>
#include <algorithm>
#include <cstdio>
#include <queue>
#include <iomanip>
#include <cctype>
#include <random>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<char> vc;
typedef vector<vc> vvc;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const ll INF=1ll<<57;
const double pi=acos(-1);
const double eps=1e-6;
const ll mod=1e9+7;
const int dx[4]={0,1,0,-1},dy[4]={1,0,-1,-0};
const int DX[8]={-1,-1,-1,0,1,1,1,0},DY[8]={1,0,-1,-1,-1,0,1,1};

class Graph{
	private:
	int V;
	vvp List;
	public:
	Graph(int v){
		V=v;
		List=vvp(v);
	}
	void add_edge(int s,int t,int c){
		List[s].push_back(P(t,c));
		List[t].push_back(P(s,c));
	}
	int DIJ(int s,int t){
		priority_queue<P> que;
		vi d(V,inf);
		d[s]=0;
		que.push(P(0,s));
		while(!que.empty()){
			P p=que.top();
			que.pop();
			int v=p.second;
			if(d[v]<-p.first) continue;
			for(int i=0;i<List[v].size();i++){
				int F=List[v][i].first,S=List[v][i].second;
				if(d[F]>d[v]+S){
					d[F]=d[v]+S;
					que.push(P(-d[F],F));
				}
			}
		}
		return d[t];
	}
};

int n,m;
vi a,b,c;

int main(){
	cin>>n>>m;
	a=b=c=vi(m);
	vvi s(n);
	for(int i=0;i<m;i++){
		cin>>a[i]>>b[i]>>c[i];
		a[i]--;b[i]--;
		s[a[i]].push_back(c[i]);
		s[b[i]].push_back(c[i]);
	}
	int S=0,I=n;
	map<P,int> M;
	for(int i=0;i<n;i++){
		sort(s[i].begin(),s[i].end());
		s[i].erase(unique(s[i].begin(),s[i].end()),s[i].end());
		for(int j=0;j<s[i].size();j++){
			M[{i,s[i][j]}]=I;
			I++;
		}
		S+=s[i].size();
	}
	Graph g(n+S);
	for(int i=0;i<m;i++) g.add_edge(M[{a[i],c[i]}],M[{b[i],c[i]}],0);
	for(int i=0;i<n;i++) for(int j=0;j<s[i].size();j++) g.add_edge(i,M[{i,s[i][j]}],1);
	int res=g.DIJ(0,n-1);
	if(res==inf) cout<<-1<<endl;
	else cout<<res/2<<endl;
}

Measured memory_bytes: 66556