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

using namespace std;

#ifdef DEBUG_MODE
	#define DBG(n) n;
#else
	#define DBG(n) ;
#endif
#define REP(i,n) for(ll (i) = (0);(i) < (n);++i)
#define PB push_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {for(int W = 0;W < (n);W++)cerr << v[W] << ' ';cerr << endl << endl;}
#define SHOW2d(v,i,j) {for(int aaa = 0;aaa < i;aaa++){for(int bbb = 0;bbb < j;bbb++)cerr << v[aaa][bbb] << ' ';cerr << endl;}cerr << endl;}
#define ALL(v) v.begin(),v.end()
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL
#define MOD 1000000007

typedef long long ll;
typedef pair<ll,ll> P;

int aa[2222][2222];
int aa1[2222][2222];
int a1a1[2222][2222];
int mp[2222][2222];

int getImos(int a,int b,int c,int d,int v[2222][2222]){
	int ret = v[c][d];
	if(a > 0){
		ret -= v[a-1][d];
	}
	if(b > 0){
		ret -= v[c][b-1];
	}
	if(a > 0 && b > 0){
		ret += v[a-1][b-1];
	}
	return ret;
}

int main(){

	int n, d;cin >> n >> d;
	REP(i,n){
		int x, y;cin >> x >> y;
		x %= d;y %= d;
		mp[y][x]++;
	}

	int ma = 0;
	REP(i,d){
		REP(j,d){
			while((ma+1) * (ma+1) < mp[i][j])ma++;
		}
	}

	REP(i,d){
		REP(j,d){
			if(mp[i][j] > ma * ma){
				aa[i][j]++;aa[i+d][j]++;aa[i][j+d]++;aa[i+d][j+d]++;
			}
			if(mp[i][j] > ma * (ma + 1)){
				aa1[i][j]++;aa1[i+d][j]++;aa1[i][j+d]++;aa1[i+d][j+d]++;
			}
			if(mp[i][j] > (ma + 1) * (ma + 1)){
				a1a1[i][j]++;a1a1[i+d][j]++;a1a1[i][j+d]++;a1a1[i+d][j+d]++;
			}
		}
	}

	REP(i,2*d){
		REP(j,2*d){
			aa[i+1][j] += aa[i][j];
			aa1[i+1][j] += aa1[i][j];
			a1a1[i+1][j] += a1a1[i][j];
		}
	}

	REP(i,2*d){
		REP(j,2*d){
			aa[i][j+1] += aa[i][j];
			aa1[i][j+1] += aa1[i][j];
			a1a1[i][j+1] += a1a1[i][j];
		}
	}
	int l = -2;
	int r = d-1;

	while(r - l > 1){
		int mid = (l + r) / 2;
		bool flag = false;
		REP(i,d){
			REP(j,d){
				int tmp = 0;
				tmp += getImos(i,j,i+mid,j+mid,a1a1);
				tmp += getImos(i,j+mid+1,i+mid,j+d-1,aa1);
				tmp += getImos(i+mid+1,j,i+d-1,j+mid,aa1);
				tmp += getImos(i+mid+1,j+mid+1,i+d-1,j+d-1,aa);
				if(tmp == 0)flag = true;
			}
		}
		if(flag)r = mid;
		else l = mid;
	}

	cout << d * ma + r << endl;

	return 0;
}


Measured memory_bytes: 67584
#include<cstdio>
//#include<iostream>
#include<iostream>
#include<cmath>
typedef long long int ll;
using namespace std;
int main()
{
	ll n;
	ll x;
	ll t;
	cin>>n>>x>>t;
	ll res=0;
	ll i;
	for( i=1;;i++)
	{
		res+=x;
		if(res>=n)
		{
			break;
			}	
	}
	t=t*i;
	cout<<t;
}

Measured memory_bytes: 3584
# -*- coding: utf-8 -*-

def do_binary_search(target_value, target_list, target_list_length=None):
    left = 0
    right = target_list_length

    while right - left > 0:
        mid = (right + left) / 2
        key = target_list[mid]
        if key == target_value:
            return True
        elif target_value < key:
            right = mid
        else:
            left = mid + 1
    return False



def main():
    s_length = int(raw_input())
    s = [int(x) for x in raw_input().strip().split(' ')]
    t_length = raw_input()
    t = [int(x) for x in raw_input().strip().split(' ')]

    counter = 0
    for value in t:
        counter += int(do_binary_search(value, s, s_length))

    print counter 

if __name__ == '__main__':
    main()

Measured memory_bytes: 15056
L=[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]
n=int(input())
print(L[n-1])

Measured memory_bytes: 2940
en=[chr(i) for i in range(65,91)]+list(' .,-\'?') 
de={
'101':' ','000000':'\'','000011':',','10010001':'-','010001':'.','000001':'?',
'100101':'A','10011010':'B','0101':'C','0001':'D','110':'E','01001':'F',
'10011011':'G','010000':'H','0111':'I','10011000':'J','0110':'K','00100':'L',
'10011001':'M','10011110':'N','00101':'O','111':'P','10011111':'Q','1000':'R',
'00110':'S','00111':'T','10011100':'U','10011101':'V','000010':'W','10010010':'X',
'10010011':'Y','10010000':'Z'
}
while 1:
    try:s=input()
    except:break
    a=b=c=''
    for x in s:a+=str(bin(en.index(x)))[2:].zfill(5)
    for i in range(len(a)):
        b+=a[i]
        if b in de:c+=de[b];b=''
    print(c)

Measured memory_bytes: 7476
import sys
import numpy as np
input = sys.stdin.readline

N, K = [int(item) for item in input().split()]
V = [int(item) for item in input().split()]

max_v = 0

for l in range(min(N + 1, K + 1)):
    for r in range(min(N - l + 1, K - l + 1)):
        acts = l + r

        items = V[:l] + V[N - r:]
        minus = sum([item < 0 for item in items])
        if minus <= K - acts:
            total = sum([(item > 0) * item for item in items])
        else:
            items.sort()
            total = sum(items[K - acts:])
        max_v = max(max_v, total)

print(max_v)


Measured memory_bytes: 15072
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <vector>

using namespace std;

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

#define PB push_back
#define MP make_pair

#define FOR(prom, a, b) for(int prom = (a); prom < (b); prom++)
#define FORD(prom, a, b) for(int prom = (a); prom > (b); prom--)
#define FORDE(prom, a, b) for(int prom = (a); prom >= (b); prom--)
#define R1(a) do{scanf("%d", &(a));}while(0)
#define R2(a, b) do{scanf("%d%d", &(a), &(b));}while(0)
#define R3(a, b, c) do{scanf("%d%d%d", &(a), &(b), &(c));}while(0)
#define SV(vec) do{int s_v_;scanf("%d", &(s_v_));vec.PB(s_v_);}while(0)
#define MM(co, cim) memset((co), (cim), sizeof((co)))
#define DEB(x) cerr << ">>> " << #x << " : " << x << endl;
#define INF 1000000007

int k;
ll res;

int main ()
{
  R1(k);
  res = 0;
  FOR(a, 1, k + 1) FOR(b, 1, k + 1) FOR(c, 1, k + 1) res += __gcd(__gcd(a, b), c);
  printf("%lld\n", res);
  return 0;
}


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

typedef long long ll;
typedef double dd;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;

const int mx=1e6+11;
const double PI = acos(-1);
#define MOD 1000000007


#define nl '\n'
#define pb push_back
#define F first
#define S second
#define I insert
#define mp make_pair

#define sz(x) x.size()
#define sa(v) sort(v.begin(),v.end())
#define sd(v) sort(v.begin(),v.end(),greater<>())
#define rev(s) reverse(s.begin(),s.end())
#define tt int t; cin>>t; while(t--)
#define lo(i,a,b) for(ll i=a;i<b;i++)
#define be(a) (a).begin(),(a).end()
#define rbe(a) (a).rbegin(),(a).rend()

#define sqr(a) ((a) * (a))
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a*(b/gcd(a,b)))
#define mem(a,b) memset(a,b,sizeof(a))

#define yes cout<<"YES"<<nl;
#define no cout<<"NO"<<nl;

#define su ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define file freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
#define frac cout.unsetf(ios::floatfield); cout.precision(10); cout.setf(ios::fixed,ios::floatfield);

#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
typedef tree< long long, null_type, less_equal<long long>, rb_tree_tag, tree_order_statistics_node_update > ordered_set;
void erase ( ordered_set &s, long long val )
{
    auto it = s.upper_bound(val);

    if ( it == s.begin() && val == *s.begin() )
        s.erase ( s.upper_bound(val) );
    else
        s.erase ( s.upper_bound(val) );
}

#define dbg(args...) do {cerr << #args << " : "; faltu(args); } while(0)
void faltu ()
{
    cerr << endl;
}
template < typename T, typename ... hello>void faltu( T arg, const hello &... rest)
{
    cerr << arg << ' ';
    faltu(rest...);
}


int main()
{
    su;
    int n,p;
    cin>>n;
    vi a;
    while(n--)
    {
      cin>>p;
      a.pb(p);
    }
    p=0;
    lo(i,0,sz(a))
    {
      if(i%2==0&&a[i]%2!=0)
        p++;
    }
    cout<<p<<nl;
    return 0;
}


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

char S[15];

int main(){
  scanf("%s",S);
  bool flag = 1;
  if(S[0]!='A'){
    cout <<"WA\n";
    return 0;
  }
  int ans = 0,tmp=0;
  for(int i=2;i<strlen(S)-1;i++){
    if(S[i]=='C'){
      ans++;
      tmp=i;
    }
  }
  if(ans!=1){
    cout <<"WA\n";
    return 0;
  }
  for(int i=1;i<strlen(S);i++){
    if(i==tmp) continue;
    if(!(S[i]>='a')&&(S[i]<='z')){
       cout <<"WA\n";
       return 0;
     }
  }
  cout << "AC\n";
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define lld long long int
int main(void) {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
int n;
cin>>n;
int arr[n];
for(int i=0;i<n;i++)
cin>>arr[i];
sort(arr,arr+n);
int c=0;
for(int i=0;i<n;i++)
{
    for(int j=0;j<i;j++)
    {
        for(int k=0;k<j;k++)
        {
            if(arr[i]!=arr[j]&&arr[j]!=arr[k]&&(arr[j]+arr[k])>arr[i])
            c++;
        }
    }
}
cout<<c<<"\n";
	return 0;
}



Measured memory_bytes: 3620
#include<iostream>
#include<cmath>
#include<algorithm>
#include<vector>

using namespace std;

int main(){

    int n;
    cin >> n;
    int a,b;
    cin >> a >> b;

    if(a%n!=0 && b<(a/n)*n+n)cout << "NG" <<  endl;
    else cout << "OK" << endl;

}

Measured memory_bytes: 3620
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;
import java.util.HashMap;

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

    static class Teleporter {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int n = in.nextInt();
            long k = in.nextLong();

            HashMap<Integer, Integer> map = new HashMap<>();
            int[] circle = new int[n + 1];

            for (int i = 1; i <= n; i++) {
                int t = in.nextInt();
                map.put(i, t);
            }

            Integer next = 1;
            circle[1]++;

            int close_start;
            while (true) {
                next = map.get(next);
                if (circle[next] == 3) {
                    close_start = next;
                    break;
                }
                circle[next]++;
            }

            int closed_step = 1;
            int tmp_close = map.get(close_start);
            while (tmp_close != close_start) {
                tmp_close = map.get(tmp_close);
                closed_step++;
            }

            long up_steps = 1;
            next = map.get(1);

            while (true) {
                if (next == close_start || up_steps >= k) {
                    break;
                }
                next = map.get(next);
                up_steps++;
            }

            long loop_num = (k - up_steps) % closed_step;
            for (int i = 0; i < loop_num; i++) {
                next = map.get(next);
            }
            out.append(String.valueOf(next));
        }

    }
}



Measured memory_bytes: 76148
#include <bits/stdc++.h>
#define GET_MACRO(_1,_2,_3,_4,_5,_6,NAME,...) NAME
#define pr(...) GET_MACRO(__VA_ARGS__,pr6,pr5,pr4,pr3,pr2,pr1)(__VA_ARGS__)
#define Pr(a) (#a)<<"="<<(a)<<" "
#define pr1(a) cerr<<Pr(a)<<endl
#define pr2(a,b) cerr<<Pr(a)<<Pr(b)<<endl
#define pr3(a,b,c) cerr<<Pr(a)<<Pr(b)<<Pr(c)<<endl
#define pr4(a,b,c,d) cerr<<Pr(a)<<Pr(b)<<Pr(c)<<Pr(d)<<endl
#define pr5(a,b,c,d,e) cerr<<Pr(a)<<Pr(b)<<Pr(c)<<Pr(d)<<Pr(e)<<endl
#define pr6(a,b,c,d,e,f) cerr<<Pr(a)<<Pr(b)<<Pr(c)<<Pr(d)<<Pr(e)<<Pr(f)<<endl
#define int long long
#define double long double
using namespace std;
const int INF = 1LL<<55;
const int mod = (1e9)+7;
const double EPS = 1e-8;
const double PI = 6.0 * asin(0.5);
typedef pair<int,int> P;
typedef long long ll;
template<class T> T Max(T &a,T b){return a=max(a,b);}
template<class T> T Min(T &a,T b){return a=min(a,b);}
ostream& operator<<(ostream& o,P p){return o<<"("<<p.first<<","<<p.second<<")";}
istream& operator>>(istream& i,P &p){return i>>p.first>>p.second;}
ostream& operator<<(ostream& o,vector<auto> &a){int i=0;for(auto t:a)o<<(i++?" ":"")<<t;return o;}
istream& operator>>(istream& i,vector<auto> &a){for(auto &t:a)i>>t;return i;}
void prArr(auto a,string s=" "){int i=0;for(auto t:a)cout<<(i++?s:"")<<t;cout<<endl;}


signed main(){
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);

  int n;
  cin>>n;
  vector<P> A(n);
  cin>>A;
  sort(A.begin(), A.end());
  
  for(P a:A) cout<<a.first<<" "<<a.second<<endl;
  return 0;
}



Measured memory_bytes: 4364
#include <iostream>
#include <utility>
#include <vector>

int main()
{
    size_t n = 0;
    std::cin >> n;

    using StaffType = std::pair<size_t, int>;
    using StaffArrayType = std::vector<StaffType>;

    constexpr size_t NO_PARENT = -1;
    StaffArrayType staffArray(n, { 0, NO_PARENT });
    for (size_t count = 1; count < n; ++count)
    {
        int parent = 0;
        std::cin >> parent;
        auto SetParent = [&staffArray, &NO_PARENT](size_t index, int parent)
        {
            staffArray[index].second = parent;
            auto current = parent;
            ++staffArray[current].first;
        };
        SetParent(count, parent - 1);
    }

    for (const auto& staff : staffArray)
    {
        std::cout << staff.first << "\n";
    }
}

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

int main() {
  int A, B;
  cin >> A >> B;
  
  if ( A%2 == B%2 ) {
    cout << (A+B)/2 << endl;  
  }
  else {
    cout << "IMPOSSIBLE" << endl;  
  }
}


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

int main()
{
    int D,x,y;
    cin >> D;
    x = D/100;
    y = D%100;
    if (1<=x && x<=12)
    {
        if (1<=y && y<=12)
        {
            cout << "AMBIGUOUS" << endl;
        }
        else
        {
            cout << "MMYY" << endl;
        }
    }
    else
    {
        if (1<=y && y<=12)
        {
            cout << "YYMM" << endl;
        }
        else
        {
            cout << "NA" << endl;
        }
    }
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<string.h>
#define ll long long 
#include<vector>
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using namespace std;
const int mod=1e9+7;
int main(){
	IOS;
	int n;
	cin>>n;
	vector<ll> v(n);
	for(int i=0;i<n;i++)
	cin>>v[i];
	ll prev=v[0];
	ll ans=0;
	for(int i=1;i<n;i++){
		if(prev>v[i])
		{
			ans+=prev-v[i];
	}
	else
	prev=v[i];
	}
	cout<<ans;
}

Measured memory_bytes: 4752
#include<iostream>
#include<vector>
#include<algorithm>

int main()
{
	const int weight[] = {1,2,4,8,16,32,64,128,256,512}; 

	std::vector<int> answer;

	int n;

	while(std::cin >> n)
	{
		for(size_t i=0; i<10; ++i)
		{
			if(n/weight[9-i])
			{

				answer.push_back(weight[9-i]);

				n = n%weight[9-i];
			}
		}

		for(size_t i=0; i<answer.size()-1; ++i)
		{
			std::cout << answer[answer.size()-1-i] << ' ';
		}

		std::cout << answer[0] << '\n';

		answer.clear();
	}

}

Measured memory_bytes: 1212
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int A,B;
  int sum;
  cin >> A >> B;
  for(int i = A;i<=B;i++){
    int x;
    int num[5]{};
    for(int j=4;j>=0;j--){
      x = num[0] + 10*num[1]+100*num[2]+1000*num[3]+10000*num[4];
      num[j] = (i-x)/pow(10,j);
    }
    if(num[0]==num[4]&&num[1]==num[3]){
      sum++;
    }
  }
  cout << sum << endl;
}

Measured memory_bytes: 384
use std::io::stdin;
use std::cmp::min;

fn input() -> String {
    let mut s = String::new();
    stdin().read_line(&mut s).unwrap();
    s.trim_end().to_string()
}

fn main() {
    let s = input();
    let t = input();

    let mut ans = t.len();
    let s_all = s.chars().collect::<Vec<char>>();
    let t_all = t.chars().collect::<Vec<char>>();

    for i in 0..s.len() {
        if s.len() - i < t.len() { break; }

        let mut diff = 0;
        for h in 0..t.len() {
            if s_all[i + h] != t_all[h] {
                diff += 1;
            }
        }
        ans = min(ans, diff);
    }

    println!("{}", ans);
}

Measured memory_bytes: 2164
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#define FAST ios_base::sync_with_stdio(false);
#define FO cout.tie(NULL);
#define FI cin.tie(NULL);
#define IN cin>>
#define OUT cout<<
#define loop(i,a,n) for(int i=a; i<n; i++)
#define rloop(i,a,n) for(int i=a; i>=n; i--)
#define endl "\n";
#define pb push_back
#define mp make_pair
#define set_bits(a) __builtin_popcount(a)
#define ll long long int
#define ld long double
#define vll vector<long long int>
#define pll pair<long long int, long long int>
#define mod 1000000007
#define M 998244353
ll gcd(ll a, ll b)
{
    return (b?gcd(b,a%b):a);
}
ll P(ll B, ll power, ll modulo)
{
    ll ans=1LL;
    while(power>0LL)
    {
        if(power%2LL==1LL)
        {
            ans=(ans*B)%modulo;
        }
        B=(B*B)%modulo;
        power/=2LL;
    }
    return ans;
}
bool isPrime(ll n)
{
    if(n<=1LL)
    {
        return false;
    }
    if(n<=3LL)
    {
        return true;
    }
    if(n%2==0LL || n%3==0LL)
    {
        return false;
    }
    for(ll i=5LL; (i*i)<=n; i+=6LL)
    {
        if(n%i==0LL || n%(i+2LL)==0LL)
        {
            return false;
        }
    }
    return true;
}
using namespace std;
bool sortbysec(const pair<int,int> &a, const pair<int,int> &b)
{
    return (a.second<b.second);
}
bool sortbysecll(const pll &a, const pll &b)
{
    return (a.second<b.second);
}
ll modinv(ll x, ll y, ll modulo)
{
    return ((x%modulo)*(P(y,modulo-2LL,modulo)%modulo))%modulo;
}
int main()
{
    FAST
    FO
    FI
    string s;
    IN s;
    int temp1=0, temp2=0;
    loop(i,0,3)
    {
        if(s[i]=='A')
        {
            temp1++;
        }
        if(s[i]=='B')
        {
            temp2++;
        }
    }
    if(temp1 && temp2)
    {
        OUT "Yes"<<endl
    }
    else
    {
        OUT "No"<<endl
    }
    return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Text;

namespace AtCoder.ABC169
{
    public class Problem3
    {
        public static void Main(string[] args)
        {
            var a = Console.ReadLine().Split(" ");

            var i = decimal.Parse(a[0]) * decimal.Parse(a[1]);

            Console.WriteLine(Math.Floor(i).ToString());
        }
    }
}


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

// int/long:		-2,147,483,648 - 2,147,483,647 (-2^31 <= int < 2^31)
// long/long long:	-9,223,372,036,854,775,808 - 9,223,372,036,854,775,807 (-2^63 <= long < 2^63)

// lower_bound(A.begin(), A.end(), N)
// upper_bound(...

// A.erase(unique(A.begin(), A.end()), A.end())

// bit: &/and, |/or, ^/xor, ~/not

// getline(cin, String)
// while (getline(cin, S)) {}

// cout <<fixed <<setprecision(10)

// priority_queue<int> q;
// priority_queue<int, vector<int>, less<int>> q; // Default: vector, less
// priority_queue<vector<int>, vector<vector<int>>, greater<vector<int>>> q;

// Graph
// Warshall-Floyd: Distance between each node, N^3
// Dijkstra: Distance from the start node, N^2
// DFS(Depth-First Search)

//
// Notes
//
// When specified less than N, try full scan.
// RE: empty vector
// Check Qs
// long/int
// xor -> count each bit
// Check values
// 	1,000,000 -> Loop
// 	100,000	-> vector(int:400KB, long:800KB) 

#define	INF (1<<30)
//1,073,741,824
//= 536,870,912 *2

#define	MOD 1000000007

#define	Rep0(i, n)	for (int i=0; i<n; i++)
#define	Rep1(i, n)	for (int i=1; i<=n; i++)
#define Sort(P)	sort(P.begin(), P.end())
#define Rev(P)	reverse(P.begin(), P.end())

struct Step {
	char t;
	char d;
};

int	main() {
	int N, Q;
	string s;
	cin >>N >>Q >>s;
	s=" "+s+" ";
	vector<Step> ST(Q);
	Rep0(i, Q)
		cin >>ST.at(i).t >>ST.at(i).d;
	Rev(ST);
	int L=1;
	int R=N+1;
	Rep0(i, Q) {
		char C=ST.at(i).t;
		if ('L'==ST.at(i).d) {
			if (C==s.at(L))
				L++;
			if (C==s.at(R))
				R++;
		} else { //'R'
			if (C==s.at(L-1))
				L--;
			if (C==s.at(R-1))
				R--;
		}
	}
	cout <<R-L <<endl;
	return 0;
}



Measured memory_bytes: 992
n = int(input())
ac = 0
wa = 0
tle = 0
re = 0

for _ in range(n):
    s = input()
    if s == 'AC':
        ac += 1
    elif s == 'WA':
        wa += 1
    elif s == 'RE':
        re += 1
    else:
        tle += 1
print("AC x " + str(ac)) 
print("WA x " + str(wa))
print("TLE x " + str(tle)) 
print("RE x " + str(re)) 

Measured memory_bytes: 9208
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	int t;
	t=1;
	while(t--)
	{
	    int n;
	    cin>>n;
	    vector<ll>arr(n+1,0);
	    for(int i=1;i<=n;i++)cin>>arr[i];
	    arr[0]=201;
	    ll ans=1000;
	    vector<ll>dp(n+1,0);
	    dp[0]=1000;
	    for(int i=0;i<=n;i++){
	        for(int j=i+1;j<=n;j++){
	            if(arr[j]<arr[i]){
	               for(int k=j+1;k<=n;k++){
	               	if(arr[k]>arr[j]){
	               		ll x=dp[i]/arr[j];
	               		ll y=dp[i]-(arr[j]*x);
	               		dp[k]=max(dp[k],y+x*arr[k]);
					   }
				   }
	            }
	        }
	        //for(int j=0;j<=n;j++)cout<<dp[j]<<" ";cout<<endl;
	        
	    }
	    cout<<*max_element(dp.begin(),dp.end())<<endl;
	}
	return 0;
}

Measured memory_bytes: 3620
/*
* @author:  codancer
* @createTime:  2020-08-20, 12:06:01
*/

#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <bitset>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
const ll mod = 1e9+7;
#define pb push_back
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define fep(i,a,b) for(int i=(a);i>=(b);i--)
#define deb(x) cerr<<#x<<" = "<<(x)<<"\n"
typedef vector<int> VI;
typedef vector<ll> VII;
typedef pair<int,int> pii;
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
ll Rand(ll B) {
	return (ull)rng() % B;
}
const int N = 3001;
long long dp[N][N][4];
long long maze[N][N];
int main(){
	int n,m,k,a,b,c;
	cin>>n>>m>>k;
	rep(i,1,k){
		cin>>a>>b>>c;
		maze[a][b]=c;
	}
	for(int i=1;i<=n;i++){
		for(int j=1;j<=m;j++){
			if(maze[i][j]){
				for(int k=0;k<=3;k++){
					dp[i][j][k]=max(dp[i][j][k],dp[i][j-1][k]);
					dp[i][j][k]=max(dp[i][j][k],dp[i-1][j][k]);
				}
				for(int k=1;k<=3;k++){
					dp[i][j][k]=max(dp[i][j][k],dp[i][j-1][k-1]+maze[i][j]);
				}
				for(int k=0;k<=3;k++){
					dp[i][j][1]=max(dp[i][j][1],dp[i-1][j][k]+maze[i][j]);
				}
			}else{
				for(int k=0;k<=3;k++){
					dp[i][j][k]=max(dp[i][j][k],dp[i][j-1][k]);
					dp[i][j][k]=max(dp[i][j][k],dp[i-1][j][k]);
				}
			}
		}
	}
	ll ans=0;
	for(int i=0;i<=3;i++){
		ans=max(ans,dp[n][m][i]);
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 355204
#include <stdio.h>
#include <math.h>

#define PI 3.14159265359

typedef struct{
  double x;
  double y;
}coordinate;

int kock(int, coordinate, coordinate);

int main()
{
  coordinate p1={0,0}, p2={100,0};
  int n;
  scanf("%d",&n);

  printf("%f %f\n",p1.x,p1.y);
  kock(n,p1,p2);
  printf("%f %f\n",p2.x,p2.y);

  return 0;
}

int kock(int n, coordinate p1, coordinate p2)
{
  coordinate s, t, u;
  if(n==0)
    return 1;

  s.x = (2*p1.x+p2.x)/3;
  s.y = (2*p1.y+p2.y)/3;
  t.x = (p1.x+2*p2.x)/3;
  t.y = (p1.y+2*p2.y)/3;
  u.x = (t.x-s.x)*cos(PI/3.0)-(t.y-s.y)*sin(PI/3.0)+s.x;
  u.y = (t.x-s.x)*sin(PI/3.0)+(t.y-s.y)*cos(PI/3.0)+s.y;

  kock(n-1,p1,s);
  printf("%f %f\n",s.x,s.y); 
  kock(n-1,s,u);
  printf("%f %f\n",u.x,u.y);
  kock(n-1,u,t);
  printf("%f %f\n",t.x,t.y);
  kock(n-1,t,p2);
}

Measured memory_bytes: 636
#include<stdio.h>
int main()
{
    int a,b,c,d;
    scanf("%d%d%d",&a,&b,&c);
    d=a;
    a=b;
    b=d;
    d=a;
    a=c;
    c=d;
    printf("%d %d %d",a,b,c);
    return 0;
}


Measured memory_bytes: 128
#include <cmath>
#include <ios>
#include <iostream>

using namespace std;

int main(int argc, const char *argv[]) {
  int d, n;
  cin >> d >> n;

  if (n == 100) {
    cout << static_cast<int>(pow(100, d)) * (n + 1) << '\n';
  } else {
    cout << static_cast<int>(pow(100, d)) * n << '\n';
  }
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<stdlib.h>
#include<stdio.h>
#include<bits/stdc++.h>
using namespace std;
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;
/*---------------------DEBUGGING--------------------------------------------*/
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
/*-------------------------------------------------------------------------------------*/
//#define mp make_pair
#define pb push_back
#define ll long long
#define pii pair<int,int>
#define pcc pair<char,char>
#define F first
#define S second
#define int long long
#define pi 3.141592653589793238462643383279502
#define M  1000000007
#define rep(i,a,n) for(int i=a;i<n;i++)
#define INF 10000000000000
#define N 200005
#define vi vector<int>
#define all(v) v.begin(),v.end()
#define endl "\n"
//#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>

signed main()
{
   ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
   int n,k;
   cin>>n>>k;
   vi a(n);
   rep(i,0,n)
   {
       cin>>a[i];
   }
   for(int i=k;i<n;i++)
   {
       if(a[i]>a[i-k])
        cout<<"Yes"<<endl;
       else
        cout<<"No"<<endl;
   }
}


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

#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    std::cerr << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');std::cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#define rep(i,a,n)    for(int i=a; i<=n; ++i)
#define rep1(i,a,n)   for(int i=a; i>=n; --i)
#define pb            push_back
#define mp            make_pair
#define int           long long
#define fr            first
#define sc            second
#define vc            vector
#define sz(v)         (int)v.size()
#define all(x)        (x).begin(),(x).end()
#define rall(x)       (x).rbegin(),(x).rend()
#define N             (int)(1e6+5)
#define M             1000000007
#define MM            998244353
#define PI            3.14159265358979
#define INF           1000000000000000

typedef vector<int> vi;
typedef pair<int,int> pii;
typedef map<int,int> mii;

int n,m,ans; string str;

int solve(){
    char c; cin>>c;
    cout<<(char)(c+1);
    return 0;
}

signed main() {
    ios::sync_with_stdio(0);
    //std::mt19937_64 rng(std::chrono::steady_clock::now().time_since_epoch().count());
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    int t=1;
    //cin>>t;
    while(t--) solve();
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        String s = sc.next();
        if (n % 2 != 0) {
            System.out.println("No");
        } else {
            if (s.substring(0, n / 2).equals(s.substring(n / 2))) {
                System.out.println("Yes");
            } else {
                System.out.println("No");
            }
        }
        sc.close();
    }
}

Measured memory_bytes: 23636
#include <iostream>
#include <vector>
using namespace std;
vector <int> a[25];
int w,h,result,d1[4]={-1,0,1,0},d2[4]={0,1,0,-1};
void dfs(int y,int x,int amo){

  /* a[0][0]=-1;
     return; */
  
  int i;

  amo++;
  result=max(amo,result);
  a[y][x]=0;
  for(i=0;i<4;i++){
    if(0<=x+d1[i] && x+d1[i]<w && 0<=y+d2[i] && y+d2[i]<h)
      if(a[y+d2[i]][x+d1[i]]==1) dfs(y+d2[i],x+d1[i],amo);
  }
  a[y][x]=1;
}
  
int main(){

  int i,j,tmp;

  while(cin>>w>>h,w){

    result=0;
    
    for(i=0;i<h;i++){
      a[i].clear();
      for(j=0;j<w;j++){
        cin>>tmp;
        a[i].push_back(tmp);
      }
    }
    for(i=0;i<h;i++) for(j=0;j<w;j++) if(a[i][j]==1) dfs(i,j,0);
    //cout<<moto[0][0]<<endl;
    
    cout<<result<<endl;
    
  }
  
  return 0;

}

Measured memory_bytes: 3020
while true do
  i, j = gets.split(' ').map(&:to_i)
  break if i == 0 && j == 0
  arr = []
  i.times { arr.push(gets.split(' ')) }

  data_array = arr.each_with_index.map do |e, index|
    p = e[1].to_i
    time, direction = e[0] == 'R' ? [j-p, 1] : [p, -1]
    {direction: direction, time: time, index: index + 1, position: p}
  end
  max_time = data_array.map{|x| x[:time]}.max

  a_d = data_array.select{|data| data[:time] == max_time}.map{|data| data[:direction]}.inject(1, :*)
  additional_array = data_array.each_with_index.map do |e, index|
    left_count = index==0 ? 0 : data_array[0..index-1].select{|el| el[:direction] == 1 && (el[:position]-e[:position]).even?}.count
    right_count = index==data_array.count-1 ? 0 : data_array[index+1..-1].select{|el| el[:direction] == -1  && (el[:position]-e[:position]).even?}.count
    e[:exit_direction] = e[:direction] + (left_count - right_count) * 2
    {exit_direction: e[:exit_direction], position: e[:position], index: e[:index]}
  end
  additional_array = additional_array.select{|data| data[:exit_direction]*a_d>0}
  ans_array = additional_array.select{|data| a_d==-1 ? (data[:position]+max_time).even? : (data[:position]+j+max_time).even? }
  ans_index = a_d == 1 ? ans_array[0][:index] : ans_array[-1][:index]
  puts "#{max_time} #{ans_index}"
end

Measured memory_bytes: 8952
n, l = [int(i) for i in input().split()]

p = [l+i-1 for i in range(1, n+1)]

dif = 9999
ans = 0
for i in range(n):
    pre = p[:i]
    post = p[i+1:]

    tmp = sum(pre) + sum(post)

    if abs(sum(p) - tmp) < dif:
        ans = tmp
        dif  = abs(sum(p) - tmp)

print(ans)

Measured memory_bytes: 3064
MAX = 10**15

def find_next_n(n):
    cand = []
    n_str = str(n)
    n_list = list(n_str)
    for i in range(1,len(str(n))+1):
        n_list[-i] = '9'
        cand.append(int("".join(n_list)))
    cand_result = [num/snuke(num) for num in cand]
    min_idx = cand_result.index(min(cand_result))

    return cand[min_idx]
    
    
def snuke(num):
    ans = 0
    while num//10 != 0:
        ans += num%10
        num = num//10
    return ans + num

def main():
    K = int(input())
    if K<10:
        for i in range(1,K+1):
            print(i)
    else:
        n = 10
        for i in range(1,n):
            print(i)
        for i in range(10,K+1):
            ans = find_next_n(n)
            print(ans)
            n = ans+1
            
            if n>MAX:
                break
    
    
if __name__ == "__main__":
    main()

Measured memory_bytes: 3188
#include <bits/stdc++.h>
#include <vector>
#include <algorithm>
#define DIVCEIL(A,B) ((A+(B-1))/B)
#define LL long long
#define INF (LL)1e10
using namespace std;

vector<LL> dijkstra(long long S, long long N, vector<vector<long long>> edges){
    vector<LL> shortest(N, INF);
    priority_queue<pair<LL, LL>> q;
    q.push(make_pair(0, S));
    while(!q.empty()){
        auto src = q.top().second, l0 = q.top().first;
        q.pop();
        if(l0 >= shortest[src])continue;
        shortest[src] = l0;
        for(auto dst=0ll; dst<N; dst++){
            auto l1 = edges[src][dst];
            if(l1 < INF && l0+l1 < shortest[dst]){
                q.push(make_pair(l0+l1, dst));
            }

        }
    }
    return shortest;
}

void solve(long long H, long long W, std::vector<std::vector<long long>> c, std::vector<std::vector<long long>> A){
    vector<vector<LL>> edges(10, vector<LL>(10));
    for(int i=0; i<10; i++){
        for(int j=0; j<10; j++){
            edges[i][j]=c[j][i];
        }
    }

    auto shortest = dijkstra(1, 10, edges);
    LL ans=0;
    for(LL i=0; i<H; i++){
        for(LL j=0; j<W; j++){
            if(A[i][j]==-1)continue;
            ans+=shortest[A[i][j]];
        }
    }
    cout << ans << endl;
}

int main(){
    long long H;
    scanf("%lld",&H);
    long long W;
    scanf("%lld",&W);
    std::vector<std::vector<long long>> c(9-0+1, std::vector<long long>(9-0+1));
    for(int i = 0 ; i < 9-0+1 ; i++){
        for(int j = 0 ; j < 9-0+1 ; j++){
            scanf("%lld",&c[i][j]);
        }
    }
    std::vector<std::vector<long long>> A(H, std::vector<long long>(W));
    for(int i = 0 ; i < H ; i++){
        for(int j = 0 ; j < W ; j++){
            scanf("%lld",&A[i][j]);
        }
    }
    solve(H, W, std::move(c), std::move(A));
    return 0;
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
int main(){
	int a,b,c,d;
	cin>>a>>b>>c>>d;
	if(abs(c-a)<=d){
		cout<<"Yes";
	}
	else if(abs(c-b)<=d&&abs(b-a)<=d){
		cout<<"Yes";
	}
	else{
		cout<<"No";
	}
}

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

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

	long long ans = 0;
	for (int i = 1; i <= n; ++i) {
		int cnt = n / i;
		ans += (long long) i * cnt * (cnt + 1) / 2;
	}

	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3576
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <vector>
#include <map>
 
using namespace std;
typedef long long ll;
 
int main(){
  int k, t;
  int a[120];

  cin >> k >> t;
  for(int i = 0; i < t; i++){
    cin >> a[i];
  }
  while(true){
    sort(a, a+t);
    if(a[t-2] == 0 || t == 1){
      break;
    }
    a[t-1] -= a[t-2];
    a[t-2] = 0;
    k -= a[t-1] + a[t-2];
  }
  if(a[t-1] > 0){
    a[t-1]--;
  }
  
  cout << a[t-1] << endl;

  return 0;
}


Measured memory_bytes: 256
#include <set> 
#include <string> 
#include <iomanip> 
#include<stdio.h>
#include <iostream>
using namespace std;

int main(){
    char matubi;
    int length; 
    string takahashi;
  	cin >> takahashi;
	
  	length = takahashi.size();
    matubi = takahashi[length-1];
    if('s' == matubi){
        cout << takahashi << "es";
    } else {
        cout << takahashi << "s";
    }

    return 0;
}

Measured memory_bytes: 3540
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.StringTokenizer;

public class Main {
	
	public static void main(String[] args) throws IOException {
		
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st;
		
		int N = Integer.parseInt(br.readLine());
		double[] p = new double[N];
		st = new StringTokenizer(br.readLine());
		for(int i=0; i<N; i++) {
			p[i] = Double.parseDouble(st.nextToken());
		}
		
		double[][] dp = new double[N+1][N+1];
		dp[0][0] = 1;
		dp[1][1] = p[0];
		for(int tosses=1; tosses<=N; tosses++) {
			dp[tosses][0] = dp[tosses-1][0] * (1-p[tosses-1]);
			for(int heads=1; heads<=N; heads++) {
				dp[tosses][heads] = dp[tosses-1][heads-1]*p[tosses-1] + (1-p[tosses-1])*dp[tosses-1][heads]; 
			}
		}
		
		double ans = 0;
		for(int i=N/2+1; i<=N; i++) {
			ans += dp[N][i];
		}
		System.out.println(ans);
		
		
		
		
	}
}


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

int main()
{
    int n;
    cin >> n;
    vector<int> a(n);
    vector<int> b(n);
    rep(i,n) cin >> a[i];
    rep(i,n) b[i] = a[i];
    sort(ALL(b));
    int m = b[n-1];
    rep(i,n){
        if(a[i] == m){
            cout << b[n-2] << endl;
        }
        else{
            cout << m << endl;
        }
    }


    return 0;
}

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

int main() {
  vector<int> a(3);
  cin>>a[0]>>a[1]>>a[2];
  sort(a.begin(),a.end());
  reverse(a.begin(),a.end());
  cout << 10*a[0] + a[1] + a[2];
}

Measured memory_bytes: 256
<?php
/*
    Problem URL : http://abc044.contest.atcoder.jp/tasks/abc044_a
    (12:12:00-)
    Score  :
    Result :
    Time   : ms
    Memory : KB
 */

ini_set('error_reporting', E_ALL & ~E_NOTICE);

fscanf(STDIN, "%d", $a);
fscanf(STDIN, "%d", $b);
fscanf(STDIN, "%d", $h);

echo (($a + $b) * $h / 2) . PHP_EOL;


Measured memory_bytes: 3576
let () =
  let n = Scanf.scanf "%d\n" (fun n -> n) in
  let as_ = Array.to_list @@ Array.init n (fun _ -> Scanf.scanf "%d " (fun a -> a)) in
  let n_odd = List.length @@ List.filter (fun n -> n mod 2 = 1) as_ in
  let n_4n2 = List.length @@ List.filter (fun n -> n mod 2 = 0 && n mod 4 <> 0) as_ in
  let n_4n = List.length @@ List.filter (fun n -> n mod 4 = 0) as_ in
  print_endline @@ if n_odd <= n_4n || n_4n2 = 0 && n_odd <= n_4n + 1 then "Yes" else "No"

Measured memory_bytes: 8064
#include <bits/stdc++.h>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned int uint;
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<string> vs;
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<<29;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-9;
const ll mod=1e9+7;
const int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};

string s;

int main(){
	cin>>s;
	cout<<(s[0]!=s[1]||s[1]!=s[2]?"Yes":"No")<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define print(s) cout << s << endl
#define acc(v) accumulate(v.begin(), v.end(), 0)
#define cinv(n,v) rep(i,n) cin >> v[i]
using namespace std;
const int INF = 1e9;
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vint;
typedef vector<string> vstr;
typedef vector<char> vchar;
const ll LINF = 1e18;
const ll MOD = 1e9 + 7;
int x_pos[4] = {1,0,-1,0}, y_pos[4] = {0,1,0,-1};
int ctoi(char c) {
	if (c >= '0' && c <= '9') {
		return c - '0';
	}
	return 0;
}

char upper(char c){
	return c-0x20;
}

char lower(char c){
	return c+0x20;
}

void unique_vector(vector<int>& v){
	sort(all(v));
	v.erase(unique(all(v)), v.end());
}

// n次元配列の初期化。第２引数の型のサイズごとに初期化していく。
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

//ユークリッドの互除法
//最大公約数
ll gcd(ll x, ll y) {
  if (y == 0) return x;
  return gcd(y, x%y);
}

//最小公倍数
ll lcm(ll x, ll y){
	ll g = gcd(x,y);
	return x/g*y;
}

ll myPow(ll x, ll n, ll m){
  if(n == 0)
    return 1;
  if(n % 2 == 0)
    return myPow(x * x % m, n / 2, m);
  else
    return x * myPow(x, n - 1, m) % m;
}

int main() {
	int n;
	cin >> n;
	int ans = 0;
	int now = 0;
	ll before = 0;
	rep(i, n)
	{
		if(i==0){
			cin >> before;
			continue;
		}
		ll next;
		cin >> next;
		if(next <= before)
		{
			now++;
		}
		else
		{
			if(now > ans){
				ans = now;
			}
			now = 0;
		}
		before = next;
	}
	if (now > ans)
	{
		ans = now;
		now = 0;
	}
	cout << ans << endl;
}


Measured memory_bytes: 256
import java.util.*;
public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		long w = sc.nextInt();
		long h = sc.nextInt();
		
		if(w%3==0 || h%3==0)
			System.out.println(0);
		else
			System.out.println(Math.min(solve(w, h), solve(h, w)));

	}
	static long solve(long w, long h){
		long min = Long.MAX_VALUE;
		for(int i=1;i<h;i++){
			long a = w*i;
			long b = 0, c = 0;
			
			b = w*((h-i)/2);
			c = w*((h-i+1)/2);
			min = Math.min(min, d(a, b, c));
			
			b = w/2*(h-i);
			c = ((w+1)/2)*(h-i);
			min = Math.min(min, d(a, b, c));
		}
		return min;
	}
	static long d(long a, long b, long c){
		long max = Math.max(a, Math.max(b, c));
		long min = Math.min(a, Math.min(b, c));
		return max - min;
	}
}

Measured memory_bytes: 21844
#include <iostream>;
using namespace std;
int main ()
{
    int n,m;
    cin>>n>>m;
    char q[n][m];
    for (int i=0;i<n;i++)
    {
        for (int j=0;j<m;j++)
        {
            cin>>q[i][j];
        }
    }
    int line[n]={0},column[m]={0},x=0;
    for (int i=0;i<n;i++)
    {
        for (int j=0;j<m;j++)
        {
            if (q[i][j]=='.'){x++;}
        }
        if (x==m){line[i]++;}
        x=0;
    }
    for (int i=0;i<m;i++)
    {
        for (int j=0;j<n;j++)
        {
            if (q[j][i]=='.'){x++;}
        }
        if (x==n){column[i]++;}
        x=0;
    }
    //for (int i=0;i<n;i++){cout<<line[i]<<" ";}
    //cout<<endl;
    //for (int i=0;i<m;i++){cout<<column[i]<<" ";}
    for (int i=0;i<n;i++)
    {
        if (line[i]==1){continue;}
        for (int j=0;j<m;j++)
        {
            if (column[j]==1){continue;}
            cout<<q[i][j];
        }
        cout<<endl;
    }
    return 0;
}

Measured memory_bytes: 3600
#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <numeric>
#include <functional>
#include <map>
#include <queue>

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

using namespace std;
using ll = long long;
using P = pair<int, int>;
using TP = tuple<ll, ll, ll>;
ll MOD = 1e9+7;
ll INF = 1e18;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int n;
    cin >> n;
    vector<ll> a(n);
    ll m = 0;
    ll mIndex = 0;
    ll m2 = 0;
    REP(i, n){
        cin >> a[i];
        if(m < a[i]){
            m = a[i];
            mIndex = i;
        }else if(m2 < a[i]){
            m2 = a[i];
        }
    }
    REP(i, n){
        if(i == mIndex){
            cout << m2 << endl;
        }else{
            cout << m << endl;
        }
    }
    //cout << m << endl;
    return 0;
}


Measured memory_bytes: 3200
a, v = map(int, input().split()) 
b, w = map(int, input().split())
t = int(input()) 
if v <= w:
  print('NO') 
else:
  q = abs(a-b) / abs(v - w) 
  if abs(a-b) <= abs(v - w) * t:
    print('YES') 
  else:
    print('NO') 
 

Measured memory_bytes: 9024
#include <iostream>
#include <vector>
#include <array>
#include <queue>
#include <stack>

const int vmax = 10005;
std::array<std::vector<int>, vmax> adjlist;
std::array<int, vmax> indeg;
std::array<int, vmax> color;

void dfs (int u)
{
  if (indeg[u] == 0 && color[u] ==0)
    {
      std::cout << u << std::endl;
      color[u] = 1;
      for (int i=0; i<adjlist[u].size(); ++i)
        {
          indeg[adjlist[u][i]]--;
          dfs(adjlist[u][i]);
        }
    }
}

void dfs_stack (int u)
{
  std::stack<int> s;
  s.push(u);

  while (!s.empty())
    {
      u = s.top();
      s.pop();

      if (indeg[u] == 0 && color[u] ==0)
        {
          std::cout << u << std::endl;
          color[u] = 1;
          for (int i=0; i<adjlist[u].size(); ++i)
            {
              indeg[adjlist[u][i]]--;
              s.push(adjlist[u][i]);
            }
        }
    }
}

int main ()
{
  int V, E;
  std::cin >> V >> E;

  indeg.fill(0);
  int s, t;
  for (int i=0; i<E; ++i)
    {
      std::cin >> s >> t;
      adjlist[s].push_back(t);
      indeg[t]++;
    }

  color.fill(0); // 0: not visited, 1: visited

  for (int i=0; i<V; ++i)
    {
      // dfs(i);
      dfs_stack(i);
    }
}





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

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
//typedef vector<vector<ll>> Graph;

const ll mod = 1e9 + 7;
//const ll mod = 998244353;

#define REP(i,n) for(ll i=0;i<(ll)n;i++)
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define spa << " " <<
#define fi first
#define se second

template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }

template<class S, class T> ostream& operator << (ostream& os, const pair<S, T> v){
os << "(" << v.first << ", " << v.second << ")"; return os;
}
template<class T> ostream& operator << (ostream& os, const vector<T> v){
for(int i = 0; i < (int)v.size(); i++){if(i > 0){os << " ";} os << v[i];} return os;
}
template<class T> ostream& operator << (ostream& os, const vector<vector<T>> v){
for(int i = 0; i < (int)v.size(); i++){if(i > 0){os << endl;} os << v[i];} return os;
}

template<typename T> void debug(vector<vector<T>>&v,ll h,ll w){for(ll i=0;i<h;i++)
{cerr<<v[i][0];for(ll j=1;j<w;j++)cerr spa v[i][j];cerr<<endl;}};
template<typename T> void debug(vector<T>&v,ll n){if(n!=0)cerr<<v[0];
for(ll i=1;i<n;i++)cerr spa v[i];
cerr<<endl;};

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

    ll X;
    cin >> X;
    cout << (X>=30 ? "Yes" : "No") << endl;

    return 0;
}

Measured memory_bytes: 3648
#include<bits/stdc++.h>
using namespace std;
#define ull unsigned long long
ull s[1000000];
ull a[100500];
int main()
{
    
    
    int n;
    ull sb=1e18;
    memset(s,0,sizeof(s));
    scanf("%d",&n);
    int flag=1;
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
        if(a[i]==0)
        {
            flag=0;
        }
    }   
    if(flag==0)
    {
        printf("0\n");
        return 0;
    }
    sort(a,a+n);
    int k=0;
    while(a[0])
    {
        s[k++]=a[0]%10;
        a[0]/=10;
    }   
    int flag1=1;
    for(int i=1;i<n;i++)
    {
        for(int j=0;j<k;j++)
        {
            s[j]=s[j]*a[i];
        }
        int g=0;
        while(a[i])
        {
            a[i]/=10;
            g++;
        }
        for(int h=0;h<k+g;h++)
        {
            s[h+1]+=s[h]/10;
            s[h]%=10;
        }
        k+=g;
        while(s[k]==0)
        {
            k--;
        }
		if(k>=19){
			
			flag1=0;
			break;
		}
        k++; 
    }
    k--;
    if(flag1){
    	ull ggg=0;
    	for(k;k>=0;k--)
    	{
    		ggg=ggg*10+s[k];
		}
    	if(ggg>sb)
    	{
    		cout<<-1<<endl;
    		return 0;
		}
    	cout<<ggg<<endl;
    }else{
    	cout<<-1<<endl;
	}
    return 0;
}

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

int solve(int custo,int saldo,int vezes){
        int total;
        total=saldo/custo;
        if (vezes<=total){return vezes;}
        else{return total;}
}

int main(){
int a,b,c;

cin >> a >> b >> c;

cout << solve(a,b,c)<<endl;


return 0;
}


Measured memory_bytes: 256