akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using db = double;
using ld = long double;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define eb emplace_back
#define all(v) (v).begin(), (v).end()
#define siz(v) (ll)(v).size()
#define rep(i, a, n) for (ll i = a; i < (ll)(n); i++)
#define repr(i, a, n) for (ll i = n - 1; (ll)a <= i; i--)
#define lb lower_bound
#define ub upper_bound
typedef pair<int, int> P;
typedef pair<ll, ll> PL;
const ll mod = 1000000007;
const ll INF = 1000000099;
const ll LINF = (ll)(1e18 + 99);
vector<ll> dx = {-1, 1, 0, 0}, dy = {0, 0, -1, 1};
template <typename T>
T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
template <typename T>
T mpow(T a, T n)
{
    T res = 1;
    for (; n; n >>= 1)
    {
        if (n & 1)
            res = res * a;
        a = a * a;
    }
    return res;
}

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

signed main()
{
    int n, nowmx = 0;
    cin >> n;
    vector<ll> v(n), ans(n, 0);
    vector<int> mx(n, 0);
    rep(i, 0, n)
    {
        cin >> v[i];
        if (nowmx < v[i])
        {
            mx[i] = i;
            nowmx = v[i];
        }
        else
        {
            mx[i] = mx[i - 1];
        }
    }

    int mxi = mx[n - 1], ind = n - 1, nmxi = mxi, cnt = 0, pmxi=0;
    priority_queue<ll> q;
    while (1)
    {

        if (0 < mxi)
        {
            nmxi = mx[mxi - 1];
        }
        else
        {
            while (mxi < ind)
            {
                ans[0]+=v[ind];
                ind--;
            }
            while (!q.empty())
            {
                ans[0] += q.top();
                q.pop();
            }
            ans[0] += v[0];
            ans[0] += (v[mxi]) * cnt;
            break;
        }

        ans[mxi] += (v[mxi] - v[nmxi]) * cnt;

        while (mxi < ind)
        {
            if (v[nmxi] <= v[ind])
            {
                ans[mxi] += v[ind] - v[nmxi];
                cnt++;
            }
            else
            {
                q.push(v[ind]);
            }
            ind--;
        }
        ind--;

        while (!q.empty() && q.top() > v[nmxi])
        {
            ans[mxi] += q.top() - v[nmxi];
            q.pop();
            cnt++;
        }

        ans[mxi] += v[mxi] - v[nmxi];
        cnt++;
        pmxi = mxi;
        mxi = nmxi;
    }

    rep(i, 0, n) cout << ans[i] << endl;
}

Measured memory_bytes: 3320
n=int(input())
A=[2,4,5,7,9]
B=[0,1,6,8]
C=[3]
for i in range(100):
  if n<10:
    break
  else:
     n-=10
if n in A:
  print("hon")
elif n in B:
  print("pon")
else:
  print("bon")


Measured memory_bytes: 8992
import java.util.Scanner;

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

		String d = a + b + c;

		if (Integer.parseInt(d) % 4 == 0) {
			System.out.println("YES");
		} else {
			System.out.println("NO");
		}
	}
}


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

#define vd vector<double>
 
typedef long long ll;
#define vi vector<int>
#define vl vector<ll>
#define vii vector< vector<int> >
#define vll vector< vector<ll> >
#define vs vector<string>
#define pii pair<int,int>
#define pis pair<int,string>
#define psi pair<string,int>
#define pll pair<ll,ll>
#define X first
#define Y second
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep1(i,n) for(int i=1;i<=(n);i++)
#define rrep(i,n) for(int i=(n)-1;i>=0;i--)
#define rrep1(i,n) for(int i=(n);i>0;i--)
#define REP(i,a,b) for(int i=a;i<b;i++)
#define in(x, a, b) (a <= x && x < b)
#define all(c) c.begin(),c.end()
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; }
const ll inf = 1000000001;
const ll INF = (ll)1e18 + 1;
const ll MOD = 1000000007;
//const ll MOD = 998244353;
const double pi = 3.14159265358979323846;
int dx[4] = { -1,0, 1,0 }, dy[4] = { 0,1,0,-1 };
int dx2[8] = { 1,1,0,-1,-1,-1,0,1 }, dy2[8] = { 0,1,1,1,0,-1,-1,-1 };
// #define mp make_pair
//#define endl '\n'

ll gcd(ll a, ll b){
    if(b > a){
        swap(a, b);
    }
    if(b == 0) return a;
    ll r = a % b;
    while(r!=0){
        a = b;
        b = r;
        r = a % b;
    }
    return b;
}
 
int main() {
    int n;
    cin >> n;
    vl a(n);
    rep(i,n) cin >> a[i];
    
    vl sum1(n+1), sum2(n+1);
    rep(i,n){
        sum1[i+1] = gcd(sum1[i], a[i]);
    }
    rrep(i,n){
        sum2[i] = gcd(sum2[i+1], a[i]);
    }

    ll ans = 0;
    rep(i,n){
        chmax(ans, gcd(sum1[i], sum2[i+1]));
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 2560
#include <iostream>
using namespace std;
int main(){
	int n,m;
	while(cin>>n,n){
		char a,b,blist[62] = {0};
		while(n--){
			cin >> a >> b;
			if(a >= 97 && a <= 122)blist[a - 97] = b;
			if(a >= 65 && a <= 90)blist[a - 39] = b;
			if(a >= 48 && a <= 57)blist[a + 4] = b;
		}
		cin >> m;
		string s = "";
		while(m--){
			cin >> a;
			if(a >= 97 && a <= 122)b = blist[a - 97];
			if(a >= 65 && a <= 90)b = blist[a - 39];
			if(a >= 48 && a <= 57)b = blist[a + 4];
			if(b == 0)b = a;
			s+=b;
		}
		cout << s << endl;
	}
}

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

using VS = vector<string>;    using LL = long long;
using VI = vector<int>;       using VVI = vector<VI>;
using PII = pair<int, int>;   using PLL = pair<LL, LL>;
using VL = vector<LL>;        using VVL = vector<VL>;

#define ALL(a)  begin((a)),end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define SZ(a) int((a).size())
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))
#define FOR(i, s, e) for (int(i) = (s); (i) < (e); (i)++)
#define FORR(i, s, e) for (int(i) = (s); (i) > (e); (i)--)
//#pragma GCC optimize ("-O3") 
#ifdef YANG33
#include "mydebug.hpp"
#else
#define DD(x) 
#endif
const int INF = 1e9;                          const LL LINF = 1e16;
const LL MOD = 1000000007;                    const double PI = acos(-1.0);



struct Edge {
	int to; LL cost;
	Edge(int t, LL c = 0) : to(t), cost(c)
	{}
	bool operator>(const Edge& rhs) const {
		return cost > rhs.cost;
	}
	bool operator<(const Edge& rhs) const {
		return cost < rhs.cost;
	}

};
using Graph = vector< vector<Edge> >;

bool BellmanFord(const Graph& G, vector<LL>& d, int s) {
	const int V = G.size();
	for (int i = 0; i < V; ++i)
		d[i] = LINF;
	d[s] = 0;

	for (int lp = 0; lp <= V; ++lp) {
		for (int i = 0; i < V; ++i) {
			for (const auto& e : G[i]) {
				if (d[i] != LINF && d[e.to] > d[i] + e.cost) {
					d[e.to] = d[i] + e.cost;
					if (lp == V && e.to == V - 1)return true;
				}
			}
		}
	}
	return false;
}

int main() {
	// 1->Nのパスに有向閉路があるか？
	int N, M; cin >> N >> M;
	Graph G(N);
	FOR(i, 0, M) {
		int a, b, c; cin >> a >> b >> c;
		a--, b--;
		G[a].emplace_back(b, -c);
	}
	VL dist(N, 0);
	bool include_N_loop = BellmanFord(G, dist, 0);
	if (include_N_loop)cout << "inf\n";
	else cout << -dist.back() << "\n";
}


Measured memory_bytes: 384
import sys
input = sys.stdin.readline

N, M, Q = map(int, input().split())
ABCD = [list(map(int, input().split())) for _ in range(Q)]

P = []
def dfs(dmax, now):
    if len(now) == N:
        P.append(now)
        return
    for n in range(dmax, M+1):
        dfs(n, now+[n])
dfs(1, [])
ans = 0
for A in P:
    score = 0
    for a, b, c, d in ABCD:
        if A[b-1] - A[a-1] == c:
            score += d
    ans = max(ans, score)

print(ans)


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

#define ll long long
#define rep(i,x,y) for(int i=x;i<y;i++)
#define rel(i,x,y) for(int i=x-1;i>=y;i--)
#define all(x) x.begin(),x.end()

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    string s; cin >> s;
    int n = s.size();
    bool ok=true;
    rep(i,0,n/2){
        if(s[i]!=s[n-i-1]) ok = false;
       // cout << s[i] <<" " << s[n-i-1] << endl;
    }
    rep(i,0,n/4){
        if(s[i]!=s[n/2-i-1]) ok = false;
        if(s[n/2+i+1]!=s[n-i-1]) ok = false;
        //cout << s[i] <<" " << s[n/2-i-1] << endl;
        //cout << s[n/2+i+1] <<" " << s[n-i-1] << endl;
    }
    if(ok) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 256
use std::io::*;

fn main() {
    let mut buf = String::new();

    stdin().read_line(&mut buf).unwrap();
    let n: u32 = buf.trim_right().parse().unwrap();

    buf.clear();
    stdin().read_line(&mut buf).unwrap();
    let mut ls: Vec<u32> = buf.clone()
                              .split_whitespace()
                              .map(|x| x.parse().unwrap())
                              .collect();
    ls.sort();

    let mut c: u32 = 0;
    for i in ls.iter().enumerate() {
        if i.0 % 2 == 0 {
            c += *i.1;
        }
    }

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


Measured memory_bytes: 380
#include<bits/stdc++.h>
using namespace std;
int main(){
  vector<pair<int,int> > v;
  int n,i,x;
  cin>>n;
  for(i=0;i<n;i++){
   cin>>x;
   v.push_back(make_pair(x,i+1));
}
 sort(v.begin(),v.end());
 for(i=0;i<v.size();i++) cout<<v[i].second<<" ";
 return 0;
}

Measured memory_bytes: 1780
#include <cstdio>
#include <climits>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <string>
#include <cstdio>
#include <climits>
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <utility>
#include <queue>
#include <cstring>
#include <set>
#include <map>
#include <complex>
#define rep(i, n) for (int i = 0; i < int(n); i++)
using namespace std;
long long MOD = 998244353;
long long INF = 1000000000000000; //10^15
typedef long long ll;
typedef unsigned long long ull;


ll powMod(ll x, ll n, ll mod) {
  if (n == 0) return 1;
  ll t = powMod(x, n/2, mod);
  t = t * t % mod;
  if (n & 1) return t * x % mod;
  return t;
}



int main(void) {

  int k;
  cin >> k;
  if (k < 10) {
    cout << k << endl;
    return 0;
  }
  

  ll c[11][10010];

  rep(i, 10) c[i][1] = 1;

  int t = 2;
  ll d[11][10010];
  for (int i = 1; i <= 9; i++) d[i][1] = i;

  while (true) {
    c[0][t] = c[0][t - 1] + c[1][t - 1];
    c[9][t] = c[8][t - 1] + c[9][t - 1];
    for (int i = 1; i <= 8; i++) {
      c[i][t] = c[i-1][t-1]+c[i][t-1]+c[i+1][t-1];
    }
    d[1][t] = d[9][t-1]+c[1][t];
    for (int i = 2; i <= 9; i++) {
      d[i][t] = d[i-1][t]+c[i][t];
    }
    if (d[9][t] >= k) break;
    t++;
  }


  int p;
  for (int i = 1; i <= 9; i++) {
    if (d[i][t] >= k) {
      p = i;
      break;
    }
  }
  if (p > 1) k -= d[p-1][t];
  else k -= d[9][t-1];

  cout << p;
  t--;
  vector<int> v;
  int f = 0;
  while (t > 0) {
    v.clear();
    //cout << "p = " << p << endl;
    //cout << "t = " << t << endl;
    if (p - 1 >= 0) v.push_back(p-1);
    v.push_back(p);
    if (p + 1 <= 9) v.push_back(p+1);
    int s = 0;
    //rep(i, v.size()) cout << v[i] << " "; cout << endl;
    rep(i, v.size()) {
      s += c[v[i]][t];
      if (s >= k) {
	//cout << "s = " << s << endl;
	p = v[i];
	cout << p;
	if (i > 0) {
	  k = k - (s - c[v[i]][t]);
	  //cout << 
	}
	t--;
	break;
      }
    }
    //cout << t << endl;
    //f++;
    //if (f == 12) break;
  }
  cout << endl;
}
      
    

    




 


Measured memory_bytes: 384
from collections import deque
from heapq import heapify,heappop,heappush,heappushpop
from copy import copy,deepcopy
from itertools import product,permutations,combinations,combinations_with_replacement
from collections import defaultdict,Counter
from bisect import bisect_left,bisect_right
# from math import gcd,ceil,floor,factorial
# from fractions import gcd
from functools import reduce
from pprint import pprint

INF = float("inf")

def myinput():
    return map(int,input().split())

def mylistinput(n):
    return [ list(myinput()) for _ in range(n) ]

def mycol(data,col):
    return [ row[col] for row in data ]

def mysort(data,col,reverse_flag):
    data.sort(key=lambda x:x[col],reverse=reverse_flag)
    return data

def mymax(data):
    M = -1*float("inf")
    for i in range(len(data)):
        m = max(data[i])
        M = max(M,m)
    return M

def mymin(data):
    m = float("inf")
    for i in range(len(data)):
        M = min(data[i])
        m = min(m,M)
    return m

def mycount(ls,x):
    # lsはソート済みであること
    l = bisect_left(ls,x)
    r = bisect_right(ls,x)
    return (r-l)

def myoutput(ls,space=True):
    if space:
        if len(ls)==0:
            print(" ")
        elif type(ls[0])==str:
            print(" ".join(ls))
        elif type(ls[0])==int:
            print(" ".join(map(str,ls)))
        else:
            print("Output Error")
    else:
        if len(ls)==0:
            print("")
        elif type(ls[0])==str:
            print("".join(ls))
        elif type(ls[0])==int:
            print("".join(map(str,ls)))
        else:
            print("Output Error")

a,b,c,k = myinput()

if k<=a:
    ans = k
elif k>a and k<=(a+b):
    ans = a
elif k>(a+b) and k<=(a+b+c):
    m = k - (a+b)
    ans = a - m
else:
    ans = 0
print(ans)

Measured memory_bytes: 68332
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
	string s;
	cin>>s;
	string s1;
	ll n=s.length();
	for(ll i=0;i<n;i++)
	{
		if(s[i]=='0')
		s1+='0';
		else if(s[i]=='1')
		s1+='1';
		else
		{
			if(s1.length()==0)
			continue;
			else
			s1.resize(s1.size()-1);
		}
	}
	cout<<s1<<endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		String target = scanner.nextLine();
		for (int i = target.length() - 1; i > 0; i--) {
			System.out.print(target.charAt(i));
		}
		System.out.println(target.charAt(0));
	}
}

Measured memory_bytes: 17124
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
const int MAXN=100000;
int l,f[MAXN+5],ans,sum;
char c[MAXN+5];
int main(){
	scanf("%s",c+1);
	l=strlen(c+1);
	for(int i=1;i<=l;i++){
		if(c[i]=='g'&&(sum+1)*2<=i)
			ans++,sum++;
		if(c[i]=='p'){
			if((sum+1)*2>i)
				ans--;
			else sum++;
		}
	}
	printf("%d\n",ans);
}

Measured memory_bytes: 256
//written by NewbieChd
#include <cstdio>
#include <cctype>
#define BUF 1000000
using namespace std;
const int N = 301, M = 45001, yyb = 998244353;
char buf[BUF], *p1, *p2;
inline char getChar() { return p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, BUF, stdin), p1 == p2) ? EOF : *p1++; }
inline int read() {
    register int f = 0;
    register char c;
    while (!isdigit(c = getChar())) {}
    do
        f = f * 10 + (c ^ 48);
    while (isdigit(c = getChar()));
    return f;
}
int a[N], f[N][M], g[N][M];
inline int power(int x, int y) {
    register int o = 1;
    for (; y; y >>= 1, x = 1ll * x * x % yyb)
        if (y & 1)
            o = 1ll * o * x % yyb;
    return o;
}
int main() {
    register int n = read(), i, j, sum = 0, ans = 0;
    for (i = 1; i <= n; ++i)
        sum += a[i] = read();
    sum /= 2, f[0][0] = g[0][0] = 1;
    for (i = 1; i <= n; ++i) {
        for (j = sum; j >= a[i]; --j)
            f[i][j] = (2ll * f[i - 1][j - a[i]] + f[i - 1][j]) % yyb, g[i][j] = (g[i - 1][j - a[i]] + g[i - 1][j]) % yyb;
        for (j = a[i] - 1; ~j; --j)
            f[i][j] = f[i - 1][j], g[i][j] = g[i - 1][j];
    }
    for (j = 1; j <= sum; ++j)
        ans = (-2ll * g[n][j] + f[n][j] + ans) % yyb;
    ans = (-3ll * power(2, n) + power(3, n) + 3 - 3ll * ans) % yyb, printf("%d\n", (ans + yyb) % yyb);
    return 0;
}


Measured memory_bytes: 106496
#include<iostream>
using namespace std;
int main()
{
	for(int i=0;i>=0;i++)
	{
		int x,y;
		cin>>x>>y;
		if(x==0&&y==0)
		{
			break;
		}
		else if(x>y)
		{
			cout<<y<<" "<<x<<endl;
		}
		else
		{
			cout<<x<<" "<<y<<endl;
		}
	}
		return 0;
}

Measured memory_bytes: 1160
#include<iostream>
using namespace std;
int a,b;
int main(){
    string s;
    cin>>a>>b>>s;
    bool ok=1;
    int j=0;
    for(int i=0;i<a+b+1;i++){
        if(s[i]=='-')j++;
    }
    if(j!=1)ok=0;
    if(s[a]!='-')ok=0;
    cout<<(ok?"Yes":"No")<<endl;
}

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

int main() {
  ll n,x,count=0,z=0;
  cin >> n >> x;
  vector<ll> v(n,0);
  r(i,n)cin >> v[i];
  r(i,n-1){
    if(v[i]+v[i+1]>x){
      count+=v[i]+v[i+1]-x;
      v[i+1]=max(z,x-v[i]);
    }
  }
  cout<<count<<endl;
}

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

public class Main{
    public static void main(String args[]) throws Exception{
    	Scanner sc= new Scanner(System.in);
    	int x1,x2,x3;
    	int e;
    	while( (e= sc.nextInt())>0 ){
    		int min= e;
            for(x3= 0; x3*x3*x3<= e; x3++){
            }
            for(x3--; x3>=0; x3--){
            	int e_rem= e-x3*x3*x3;
                x2= (int)Math.sqrt(e_rem);
                x1= e_rem- x2*x2;
                if( min > x1+x2+x3 ){ min= x1+x2+x3; }
            }
            System.out.println(min);
    	}
    }
}

Measured memory_bytes: 26664
#include <bits/stdc++.h>
using namespace std;
typedef pair<double,double> P;

int main() {
  int n,m;
  cin >> n >> m;
  vector<P> v[n];
  for(int i=0; i<n; i++) {
    int k;
    cin >> k;
    for(int j=0; j<k; j++) {
      P a;
      cin >> a.first >> a.second;
      v[i].push_back(a);
    }
  }
  double dp[n+1][m+1];
  for(int i=0; i<=n; i++) {
    for(int j=0; j<=m; j++) dp[i][j]=-1;
  }
  dp[0][m]=0;
  double ans=0;
  for(int i=0; i<n; i++) {
    for(int j=0; j<=m; j++) {
      if(dp[i][j]<0) continue;
      int d=0;
      double h=0;
      for(int k=0; k<v[i].size(); k++) {
        P a=v[i][k];
        for(int l=0; l<a.second*a.first; l++) {
          d++;
          h+=1.0/a.first;
          if(d>j) break;
          dp[i+1][j-d]=max(dp[i+1][j-d],dp[i][j]+h);
          ans=max(ans,dp[i+1][j-d]);
        }
      }
      dp[i+1][j]=max(dp[i+1][j],dp[i][j]);
    }
  }
  printf("%.10f\n",ans);
  return 0;
}

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

namespace AtCoders {
	class Program {
		static void Main(string[] args) {
					var inputArray = retreiveLongArray();
			var inputCount = 1;

			// 不正な入力は処理しない
			if (inputArray.Length != inputCount) {
				Console.WriteLine("invalid input");
				return;
			}

			var N = inputArray[0];

			// N個の整数が追加で与えられる
			var numberArray = retreiveLongArray();


			//答えの出力
			var result = getAns(N, numberArray);
			var ans = result ? "APPROVED" : "DENIED";
			Console.WriteLine(ans);

		}

		private static bool getAns(long N, long[] numberArray) {

			var result = numberArray.Select(x => x % 2 == 1 | x % 3 == 0 | x % 5 == 0).All(x =>x);
			return result;

		}

		/// <summary>
		/// スペースで区切られた文字列配列の入力を受け取る
		/// </summary>
		/// <returns></returns>
		private static string[] retreiveStringArray() {
			var inputArray =  Console.ReadLine().Split(' ');
			return inputArray;
		}

		/// <summary>
		/// スペースで区切られた整数配列の入力を受け取る
		/// </summary>
		/// <returns></returns>
		private static long[] retreiveLongArray() {
			var inputArray = Console.ReadLine().Split(' ');
			var longArray = inputArray.Select(s => long.Parse(s));
			return longArray.ToArray();
		}
	}
}


Measured memory_bytes: 13396
#include<bits/stdc++.h>
using namespace std;
#define ll long long
 
int main() {
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	ll n,nu,i,j,k,ans[10005]={0};
	cin>>n;
	for(i=1;i<=100;i++) {
		for(j=1;j<=100;j++) {
			for(k=1;k<=100;k++) {
				nu=i*i+j*j+k*k+i*j+j*k+i*k;
				if(nu<=n)
				ans[nu]++;
			}
		}
	}
	for(i=1;i<=n;i++) cout<<ans[i]<<"\n";
	
	
}

Measured memory_bytes: 3716
#include <iostream>
#include <stdio.h>
#include <vector>
#include <algorithm>
#include <cmath>
#define rep(i,cc,n) for(int i=cc;i<=n;++i)
#define drep(i,cc,n) for(int i=cc;i>=n;--i)
typedef long long ll;
using namespace std;
int main(){
    ll n;
    cin>>n;
    ll p[n];
    rep(i,0,n-1) cin>>p[i];
    ll min;
    ll ans = 0;
    min = p[0];
    rep(i,0,n-1){
        if(min>=p[i]) ans++;
        if(min>p[i]) min = p[i];
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 1792
#include<iostream>
#include<algorithm>
#include<string>
#include<cmath>
using namespace std;

int main() {
    int a, b, c;
    cin >> a >> b >> c;
    if(b - a == c - b) cout << "YES" << endl;
    else cout << "NO" << endl;
    return 0;
}


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

using namespace std;

int main()
{
    ios_base::sync_with_stdio(0);
    cout.tie(0);
    cin.tie(0);

    int n,a,b;

    cin >>n >>a >>b;

    cout <<min( a * n, b ) <<'\n';

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>     
 
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define ll long long
#define int ll
#define forn(i, a, b) for(int i = (a); i <= (b); ++i)
#define forev(i, b, a) for(int i = (b); i >= (a); --i)
#define VAR(v, i) __typeof( i) v=(i)
#define forit(i, c) for(VAR(i, (c).begin()); i != (c).end(); ++i)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int)(x).size())
#define file(s) freopen(s".in","r",stdin); freopen(s".out","w",stdout);
 
using namespace std;
 
const int maxn = (int)3e3 + 100;
const int N = (int)1e5 + 100;
const int mod = (int)1e9 + 7;
 
#define inf mod
 
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;   
typedef vector<ll> Vll;               
typedef vector<pair<int, int> > vpii;
typedef vector<pair<ll, ll> > vpll;
 
int n, m;
string s, t;
int dp[maxn][maxn];

string calc(int n, int m){
	if(!n || !m)
		return "";
	string res = "";
	if(s[n - 1] == t[m - 1])
		res = calc(n - 1, m - 1) + s[n - 1];
	else if(dp[n - 1][m] > dp[n][m - 1])
		res = calc(n - 1, m);
	else
		res = calc(n, m - 1);
	return res;
}
main () {
	cin >> s >> t;
	n = sz(s), m = sz(t);
	forn(i, 0, n){
		forn(j, 0, m){
			if(!i || !j)
				dp[i][j] = 0;
			else{
				if(s[i - 1] == t[j - 1])
					dp[i][j] = dp[i - 1][j - 1] + 1;
				else
					dp[i][j] = max(dp[i - 1][j], dp[i][j - 1]);
			}
		}
	}
	cout << calc(n, m);
}

Measured memory_bytes: 74624
#include<bits/stdc++.h>
using namespace std;
int main(){
  vector<int>V(3);
  for(int i=0;i<3;i++){
    cin>>V.at(i);
  }
  sort(V.begin(),V.end());
  bool flag=true;
  if(V.at(0)!=5){
    flag=false;
  }
  if(V.at(1)!=5){
    flag=false;
  }
  if(V.at(2)!=7){
    flag=false;
  }
  if(flag){
    cout<<"YES"<<endl;
  }
  else{
    cout<<"NO"<<endl;
  }
}
 

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ull unsigned long long
#define ll long long
const int w=1e6+5;
const ll mod=1e9+7;
char a[w];
int dp[w][2];
int main()
{
    int i,j;
    scanf("%s",a+1);
    int len=strlen(a+1);
    int ans=0;
    dp[1][0]=a[len]-'0';
    dp[1][1]=10-(a[len]-'0');
    for(i=len-1;i>=0;i--)
    {
        dp[len-i+1][0]=min(dp[len-i][0]+a[i]-'0',dp[len-i][1]+a[i]-'0'+1);
        dp[len-i+1][1]=min(dp[len-i][0]+10-(a[i]-'0'),dp[len-i][1]+10-(a[i]-'0'+1));
    }
    cout<<min(dp[len][0],dp[len][1]+1)<<endl;
    return 0;
}


Measured memory_bytes: 9088
n,m=map(int,input().split())
a=[[int(i) for i in input().split()] for i in range(m)]
p=list(map(int,input().split()))
ans=0
for i in range(2**n):
    l=[False]*n
    for j in range(n):
        if(i>>j & 1):
            l[j]=True
    #ランプの状態が決定
    light=0
    for x,aa in enumerate(a):
        cnt=0
        for y,k in enumerate(aa):
            if y==0:
                continue
            if l[k-1]==True:
                cnt+=1
        if cnt%2==p[x]:
            light+=1
    if light==m:
        ans+=1
print(ans)

Measured memory_bytes: 43120
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

public class Main {

    public static void main(String[] args) {
        int n;
        String s;
        try (Scanner cin = new Scanner(System.in)) {
            n = cin.nextInt();
            s = cin.next();
        }

        int sameMax = 0;
        for (int i = 1; i < n; i++) {
            char[] x = s.substring(0, i).toCharArray();
            char[] y = s.substring(i, n).toCharArray();
            Set<Character> xset = new HashSet<Character>();
            for (int j = 0; j < x.length; j++) xset.add(x[j]);
            Set<Character> yset = new HashSet<Character>();
            for (int j = 0; j < y.length; j++) yset.add(y[j]);
            xset.retainAll(yset);
            sameMax = Math.max(xset.size(), sameMax);
        }

        System.out.println(sameMax);
    }

}


Measured memory_bytes: 22100
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repbtw(i, a, b) for (int i = a; i <= (int)(b); i++)
#define all(v) v.begin(), v.end()
#define pr(x) cout << x << endl


int main()
{
    int r;
    cin >> r;
    pr(2*r*3.1415926535);

    return 0;
}



Measured memory_bytes: 3772
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define F first
#define S second
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
using vi = vector<int>;
using vvi = vector<vi>;
using pii = pair<int,int>;
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; }
ll gcd(ll a, ll b) { return b?gcd(b, a%b):a;}
ll lcm(ll a, ll b) { return a*b/gcd(a,b);}
ll MOD=1000000007;

int main(){
  int k,x;cin>>k>>x;
  if(500*k>=x){
    cout<<"Yes"<<endl;
  }else{
    cout<<"No"<<endl;
  }
}


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

typedef long long ll;
#define MOD = 1000000007;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define ALL(a) begin(a),end(a)
#define COUNTOF(a) (sizeof(a)/sizeof(a[0]))
template<class T> istream& operator >> (istream& s, vector<T>& v) {
  for (T& x: v) { s >> x; } return s;}
template<class T> inline bool chmin(T& a, T b) {return a>b?a=b,true:false;}
template<class T> inline bool chmax(T& a, T b) {return a<b?a=b,true:false;}
#define SP << " " <<
#define FMT(a) #a<<":"<<a 
#define FMT2(a,b) #a<<":"<<a<<", "<<#b<<":"<<b 
#define FMT3(a,b,c) #a<<":"<<a<<", "<<#b<<":"<<b<<", "<<#c<<":"<<c 
#define FMT4(a,b,c,d) #a<<":"<<a<<", "<<#b<<":"<<b<<", "<<#c<<":"<<c<<", "<<#d<<":"<<d 
#define ANS(a) cout<<a<<endl
void yes(bool f){cout<<(f?"yes":"no")<<endl;}
void Yes(bool f){cout<<(f?"Yes":"No")<<endl;}
void YES(bool f){cout<<(f?"YES":"NO")<<endl;}

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

    int N; cin >>N;
    string colors = "PWGY";

    vector<int> f(4, 0);
    char c;
    rep(i, N) {
        cin >> c;
        f[colors.find(c)] = 1;
    }

    cout << (accumulate(ALL(f), 0) == 3 ? "Three" : "Four") << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
using namespace std;
typedef pair<int,int> P;
#define F first
#define S second
int n,ans;
P a[100005];
int main(void){
    scanf("%d",&n);
    for(int i=0;i<n;i++){
        cin>>a[i].F;
        a[i].S=i;
    }
    sort(a,a+n);
    for(int i=0;i<n;i+=2)if(a[i].S%2)ans++;
    printf("%d\n",ans);
}


Measured memory_bytes: 1024
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define MAX 500000

struct Node
{
  int key;
  struct Node *parent, *left, *right;
};

struct Node *root, *NIL;

void inorder(struct Node *u)
{
  if(u == NIL)return;
  inorder(u->left);
  printf(" %d",u->key);
  inorder(u->right);
}

void preorder(struct Node *u)
{
  if(u == NIL)return;
  printf(" %d",u->key);
  preorder(u->left);
  preorder(u->right);
}

void insert(int k)
{
  struct Node *y = NIL;//xの親
  struct Node *x = root;//Treeの根
  struct Node *z;

  z = (struct Node *)malloc(sizeof(struct Node));//挿入接点の設定
  z->key=k;
  z->left=NIL;
  z->right=NIL;

  while(x!=NIL)
  {
    y=x;//起点設定
    if(z->key < x->key)x = x->left;//左の子へ移動
    else x = x->right;//右の子に移動
  }
  z->parent = y;//親に接続

  if (y==NIL)//根が空の時
      root = z;

  else if(z->key < y->key)
      y->left = z; // z を y の左の子にする
  else
      y->right = z; // z を y の右の子にする
}

int main()
{
  int n,i,x;
  char str[10];

  scanf("%d",&n);

  for(i=0;i<n;i++)
  {
    scanf("%s",str);
    if(str[0]=='i')
    {
      scanf("%d",&x);
      insert(x);
    }
    else if(str[0]=='p')
    {
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    }
  }
  return 0;
}



Measured memory_bytes: 25176
#include <iostream>
using namespace std;
int main ()
{
	int a,b,c,x,y;
	while (cin>>a>>b>>c>>x>>y)
	{
		int sum=0;
		if (2*c<a+b)
		{
			if (2*c<a&&x>=y||2*c<b&&x<=y)
			{
				int k=min(x,y);
			sum+=min(x,y)*2*c;
			x-=k;
			y-=k;
			sum+=(x+y)*c*2;
			}
			else 
			{
				int k=min(x,y);
				sum+=min(x,y)*2*c;
				x-=k;
				y-=k;
				sum+=x*a+y*b;
			}
		}
		else 
		sum+=x*a+y*b;
		cout<<sum<<endl;
	}
} 

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

int main() {
  int n;
  cin >> n;
  vector<int> v(n);
  for (int i = 0; i < n; ++i) cin >> v[i];
  sort(v.begin(), v.end());
  bool flag = 1;
  for (int i = 0; i < n-1; ++i) {
    if (v[i] == v[i+1]) {
      flag = 0;
      break;
    }
  }
  if (flag) cout << "YES\n";
  else cout << "NO\n";
}

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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, s, e) for (int i = (int)(s); i < (int)(e); i++)
#define _rep(i, n) for (int i = (int)(n - 1); i >= 0; i--)
#define _REP(i, e, s) for (int i = (int)(e - 1); i >= (int)(s); i--)

#define yes cout << "yes" << endl;
#define Yes cout << "Yes" << endl;
#define YES cout << "YES" << endl;

#define no cout << "no" << endl;
#define No cout << "No" << endl;
#define NO cout << "NO" << endl;

#define AC cout << "AC" << endl;
#define WA cout << "WA" << endl;

#define out(s) cout << s << endl;

#define ll long long
#define ull unsigned long long

const unsigned int BIT_FLAG_0 = (1 << 0);  // 0000 0000 0000 0001
const unsigned int BIT_FLAG_1 = (1 << 1);  // 0000 0000 0000 0010
const unsigned int BIT_FLAG_2 = (1 << 2);  // 0000 0000 0000 0100
const unsigned int BIT_FLAG_3 = (1 << 3);  // 0000 0000 0000 1000
const unsigned int BIT_FLAG_4 = (1 << 4);  // 0000 0000 0001 0000
const unsigned int BIT_FLAG_5 = (1 << 5);  // 0000 0000 0010 0000
const unsigned int BIT_FLAG_6 = (1 << 6);  // 0000 0000 0100 0000
const unsigned int BIT_FLAG_7 = (1 << 7);  // 0000 0000 1000 0000

const double PI = 3.14159265358979323846;

const int dy[4] = {0, 1, 0, -1};
const int dx[4] = {1, 0, -1, 0};

#define H_MAX 500
#define W_MAX 500
#define INF 1e9 + 7

int main() {
    char a, b;
    cin >> a >> b;
    if (a > b) {
        rep(i, a - '0') {
            cout << b;
        }
    } else {
        rep(i, b - '0') {
            cout << a;
        }
    }
    cout << endl;
}


Measured memory_bytes: 3632
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s1 = sc.next();
        String s2 = sc.next();
        String s3 = sc.next();
        String s = "" + s1.charAt(0) + s2.charAt(0) + s3.charAt(0);
        System.out.println(s.toUpperCase());
    }
}


Measured memory_bytes: 21844
n = gets.to_i
s = gets.chomp.split("")

l_sum = 0
s.each do |c|
  if c == "("
    l_sum += 1
  else
    if l_sum > 0
      l_sum -= 1
    end
  end
end

r_sum = 0
s.reverse.each do |c|
  if c == ")"
    r_sum += 1
  else
    if r_sum > 0
      r_sum -= 1
    end
  end
end

l_sum.times do
  s.push(")")
end

r_sum.times do
  s.unshift("(")
end

puts s.join


Measured memory_bytes: 1788
import java.util.*;

public class Main {
	
	void run() {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		
		int maxDiff = Integer.MIN_VALUE;
		int minVal = scan.nextInt();
		
		for (int i = 1; i < n; i++) {
			int val = scan.nextInt();
			int diff = val - minVal;
			if (maxDiff < diff) {
				maxDiff = diff;
			}
			if (minVal > val) {
				minVal = val;
			}
		}
		
		System.out.println(maxDiff);
	}

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		new Main().run();
	}

}



Measured memory_bytes: 99044
#include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;
#define endl '\n'
#define pi pair<int, int>

const int maxn = 100000, k = 3;
int n;
int a[maxn][k], dp[maxn][k];

int main(){
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	
	cin >> n;
	
	for(int i = 0; i < n; i++){
		for(int j = 0; j < k; j++){
			cin >> a[i][j];
			if(i) for(int l = 0; l < k; l++){
				if(j == l) continue;
				dp[i][j] = max(dp[i][j], dp[i - 1][l]);
			}
			dp[i][j] += a[i][j];
		}
	}
	
	int ret = 0;
	for(int i = 0; i < k; i++) ret = max(ret, dp[n - 1][i]);
	
	cout << ret << endl;

	return 0;
}

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

int main() {
    int N;
    cin >> N;
    vector<int> A(N), B(N), C(N - 1);
    for(int i = 0; i < N; i++) cin >> A[i];
    for(int i = 0; i < N; i++) cin >> B[i];
    for(int i = 0; i < N - 1; i++) cin >> C[i];
    int ans = 0;
    for(int i = 0; i < N; i++ ){
        ans += B[A[i] - 1];
        if(i < N - 1 && A[i + 1] == A[i] + 1) ans += C[A[i] - 1];
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
string s;
long long int w = 0;
long long int b = 0;
int main()
{
    cin >> s;
    for (int i = 0; i < s.size(); i++)
    {
        if (s[i] == 'B')
        {
            b++;
        }
        else
        {
            w += b;
        }
    }
    cout << w << endl;
    return 0;
}

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

int main() {
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

	int k;
	cin >> k;
	if (k == 1) {
		cout << 1 << endl;
		cout << 1 << endl;
		return 0;
	}
	int n = 2*((k+3)/4);
	cout << n << endl;
	for (int r = 0; r < n; ++r) {
		for (int c = 0; c < n; ++c) {
			int x = (r+c)%n;
			if (r%2 == 1)
				x += n;
			if (x >= k)
				x -= n;
			cout << x+1 << ' ';
		}
		cout << endl;
	}
}


Measured memory_bytes: 1152
import java.util.Scanner;
class Main {
	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);

		int A = stdIn.nextInt();
		int B = stdIn.nextInt();

		int c = B *= 2; //両カーテンの長さの合計

		if(A-c>0)
		System.out.println(A-c);

		else {
			System.out.println(0);
		}
	}
}



Measured memory_bytes: 22612
N = int(input())
A = [input() for _ in range(2)]
mod = 10**9+7
ptn = []
for i in range(N-1):
    if A[0][i] == A[0][i+1]:
        ptn.append("=")
    elif A[0][i] == A[1][i]:
        ptn.append("|")
if A[0][-1] == A[1][-1]:
    ptn.append("|") 

if ptn[0] == "|":
    ans = 3
else:
    ans = 6
for i in range(1,len(ptn)):
    if (ptn[i-1],ptn[i]) == ("|","|"):
        ans = ans * 2 % mod
    elif (ptn[i-1],ptn[i]) == ("=","="):
        ans = ans * 3 % mod
    elif (ptn[i-1],ptn[i]) == ("|", "="):
        ans = ans * 2 % mod
    else:
        continue
print(ans)

Measured memory_bytes: 3064
/**
*    Username : adhoc_king
*    Name : adhoc_king
*    Institute : IIT Bombay
*/

#include <bits/stdc++.h>
#include <algorithm>
#include <iostream>
#include <cstring>
#include <vector>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <string>
// #include <deque>
// #include <queue>
// #include <array>
// #include <ctime>
// #include <list>
// #include <map>
// #include <set>
// #include <cassert>
// #include <complex>
// #include <sstream>
// #include <forward_list>
// #include <unordered_set>
// #include <unordered_map>

using namespace std;

#define int long long
#define pb push_back
#define mp make_pair
#define scani(n) scanf("%d",&n);
#define EPS 1e-9
#define FOR(i,n) for(int i=0; i<n; i++)
#define X first
#define Y second
#define arrinput for(int i=0; i<n; i++) cin>>arr[i];
#define arrsum for(int i=0; i<n; i++) sum+=arr[i];
#define for0(i,n) for(int i=0; i<n; i++)
#define for1(i,n) for(int i=1; i<=n; i++)
#define forr(i,n) for(int i=n-1; i>=0; i--)
#define all(v) v.begin(), v.end()

typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<pii> vii;

const int MOD = 1e9+7;
const int n_ = 1e5+1000;
const long double PI = acos(-1.0);

ll gcd (ll a, ll b) {return ( a ? gcd(b%a, a) : b );}
ll power(ll a, ll n) {ll p = 1;while (n > 0) {if(n%2) {p = p * a;} n >>= 1; a *= a;} return p;}
ll power(ll a, ll n, ll mod) {ll p = 1;while (n > 0) {if(n%2) {p = p * a; p %= mod;} n >>= 1; a *= a; a %= mod;} return p % mod;}

bool vowel(char ch) {
    if(ch=='a' || ch=='e' || ch=='i' || ch=='o' || ch=='u') return true;
    else return false;
}

// Union-Find Disjoint Sets Library written in OOP manner, using both path compression and union by rank heuristics
class UnionFind {                                              // OOP style
private:
    vi p, rank, setSize;                       // remember: vi is vector<int>
    int numSets;
public:
    UnionFind(int N) {
        setSize.assign(N, 1); numSets = N; rank.assign(N, 0);
        p.assign(N, 0); for (int i = 0; i < N; i++) p[i] = i; }
    int findSet(int i) { return (p[i] == i) ? i : (p[i] = findSet(p[i])); }
    bool isSameSet(int i, int j) { return findSet(i) == findSet(j); }
    void unionSet(int i, int j) { 
        if (!isSameSet(i, j)) { numSets--; 
        int x = findSet(i), y = findSet(j);
        // rank is used to keep the tree short
        if (rank[x] > rank[y]) { p[y] = x; setSize[x] += setSize[y]; }
        else                   { p[x] = y; setSize[y] += setSize[x];
                                 if (rank[x] == rank[y]) rank[y]++; } } }
    int numDisjointSets() { return numSets; }
    int sizeOfSet(int i) { return setSize[findSet(i)]; }
};

signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);

    int a, b, mx = 0;
    cin>>a>>b;
    mx = max(mx, a+b);
    mx = max(mx, a+a-1);
    mx = max(mx, b+b-1);
    cout<<mx;

    return 0;
}

Measured memory_bytes: 256
N = int(input())
A = list(map(int,input().split()))
sum = 1
if 0 in A:
    print(0)
    exit()
else:
    for i in range(len(A)):
        sum=sum*A[i]
        if(sum > 10**18):
            print(-1)
            exit()
print(sum)

Measured memory_bytes: 21692
#include <iostream>
#include<bits/stdc++.h>
using namespace std;
#define int long long
int32_t main() {
    int n;
    cin>>n;
    int arr[100000];
    map<int,int> m;
    for(int i=0;i<n;i++)
    {
    cin>>arr[i];
    m[arr[i]]++;
    }
    int count = 0;
    for(auto x : m)
    {
        if(x.second>x.first)
        {
                count += (x.second-x.first);
        }
        else if(x.second<x.first)
        {
            count +=  x.second;
        }

    }

cout<<count;

}


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

void fnInput(vector<int>& rvnSeq)
{
  int nSeqSiz;
  cin >> nSeqSiz;
  rvnSeq.resize(nSeqSiz);

  for (int& rnSeq : rvnSeq)
    cin >> rnSeq;
}
  
int fnLowerCnt(const vector<int>& cnrvnSeq)
{
  vector<int> vnRevSeq(cnrvnSeq);
  reverse(begin(vnRevSeq), end(vnRevSeq));

  int nMaxSeqCnt = 0;
  int nFoward = 0;

  while (nFoward < vnRevSeq.size() - 1)
  {
    int nSeqCnt = 0;
    int n;

    for (n = nFoward; n < vnRevSeq.size() - 1; n++)
      if (vnRevSeq[n] <= vnRevSeq[n + 1])
        nSeqCnt++;
      else
        break;

    nFoward = n + 1;
    nMaxSeqCnt = max(nMaxSeqCnt, nSeqCnt);
  }
  return nMaxSeqCnt;
}
  
int main()
{
  vector<int> vnSeq;

  fnInput(vnSeq);
  cout << fnLowerCnt(vnSeq) << endl;

  return 0;
}

Measured memory_bytes: 1024
Num,up,down = map(int,input().split())
check2,check3 = 0,0
result= 0

for i in range(1,Num+1):
    check1 = i

    while not check1 == 0:
        check2 = check1 % 10
        check1 = int(check1 / 10)
        check3 += check2

    if up <= check3 <= down:
        result += i
    check3 = 0

print(result)

Measured memory_bytes: 3060
#pragma GCC optimize("O3")
#include<bits/stdc++.h> 
using namespace std;
using ll=long long;
typedef  unsigned long long int ull;
typedef pair<ll,ll> P;
template<class T> using V=vector<T>; 
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
const ll inf=(1e18);
//const ll mod=998244353;
const ll mod=1000000007;
//ios_base::sync_with_stdio(false);
//cin.tie(NULL);
ll gcd(ll a,ll b) {return b ? gcd(b,a%b):a;}
ll lcm(ll c,ll d){return c/gcd(c,d)*d;}
struct __INIT{__INIT(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}} __init;
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; }
bitset<16005> dpx[16005],dpy[16005];
ll mid=8000;
int main(){
string s;
cin>>s;
int x,y;
cin>>x>>y;
dpx[0][mid]=1;dpy[0][mid]=1;
int n=s.size();
int j=1;
int t=0,cnt=0;
for(int i=0;i<n;){
    if(t%2==0){
        while(i<n&&s[i]!='T'){
            i++;
            cnt++;
        }
        if(j==1){
            dpx[j]|=(dpx[0]<<cnt);
        }
        else{
            dpx[j]|=(dpx[j-1]<<cnt);
            dpx[j]|=(dpx[j-1]>>cnt);
        }
        cnt=0;
        j++;
    }
    if(s[i]=='T'){
    while(i<n&&s[i]=='T'){
        i++; t++;
      }
    }
    else i++;
}
int k=1;
t=0;
for(int i=0;i<n;){
    if(t%2==1){
        while(i<n&&s[i]!='T'){
            i++;
            cnt++;
        }
         dpy[k]|=(dpy[k-1]<<cnt);
         dpy[k]|=(dpy[k-1]>>cnt);
        k++;
        cnt=0;
    }
   if(s[i]=='T'){
    while(i<n&&s[i]=='T'){
        i++; t++;
      }
    }
    else i++;
}
if(dpx[j-1][x+mid]&&dpy[k-1][y+mid])cout<<"Yes"<<"\n";
else cout<<"No"<<"\n";
}

Measured memory_bytes: 10496
#include<iostream>
using namespace std;
int main(){
	double n;
	while(cin>>n){
		if(n<=48.00)cout<<"light fly"<<endl;
		else if(n<=51.00)cout<<"fly"<<endl;
		else if(n<=54.00)cout<<"bantam"<<endl;
		else if(n<=57.00)cout<<"feather"<<endl;
		else if(n<=60.00)cout<<"light"<<endl;
		else if(n<=64.00)cout<<"light welter"<<endl;
		else if(n<=69.00)cout<<"welter"<<endl;
		else if(n<=75.00)cout<<"light middle"<<endl;
		else if(n<=81.00)cout<<"middle"<<endl;
		else if(n<=91.00)cout<<"light heavy"<<endl;
		else cout<<"heavy"<<endl;
	}
}

Measured memory_bytes: 0
import java.util.*;
import java.io.*;
public class Main {
	public static void main(String[] args) throws Exception {
    	Scanner file = new Scanner(System.in);
      	String s = file.next();
      	file.close();
      	boolean works = is(s) && is(s.substring(0,s.length()/2)) && is(s.substring(s.length()/2+1));
      	System.out.println(works ? "Yes" : "No");
      	System.exit(0);
    }
  	public static boolean is(String s) { return new StringBuilder(s).reverse().toString().equals(s); }
}

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

using namespace std;
typedef long long ll;
#define MOD 1000000007
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}

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

    bool flg = false;
    for(int i = 1; i<10; i++) {
        if(N % i == 0 && N / i < 10) {
            flg = true;
            break;
        }
    }

    if(flg) cout << "Yes" << endl;
    else cout << "No" << endl;

    return 0;
}

Measured memory_bytes: 256
#[allow(unused)]
use std::cmp::{max, min};

#[allow(unused_macros)]
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)*}
    };
}

#[allow(unused_macros)]
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)*}
    };
}

#[allow(unused_macros)]
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")
    };
}

trait IteratorExt: Iterator + Sized {
    fn vec(self) -> Vec<Self::Item> {
        self.collect()
    }
}

impl<T: Iterator> IteratorExt for T {}

fn main() {
    input! {
        // usize
        // n: usize,
        // vec
        // v: [i64; n],
        a: i64,
        b: i64,
    }

    let sum = a + b;
    let sub = a - b;
    let mul = a * b;

    println!("{}", std::cmp::max(sum, std::cmp::max(sub, mul)));
}

Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pp;
const int INF = 1e9;
const int MOD = 1000000007;
#define rep(i,n) for(int i=0;i<n;i++)
 
int main() {
  int n;
  cin >> n;
  vector<vector<int>> abc(n,vector<int>(3,0));
  rep(i,n) cin >> abc[i][0] >> abc[i][1] >> abc[i][2];
  vector<vector<int>> dp(n,vector<int>(3,0));
  rep(i,3) dp.at(0).at(i) = abc.at(0).at(i);
  for(int i=1;i<n;i++)rep(j,3){
    dp.at(i).at(j) = max(dp.at(i-1).at((j+1)%3)+abc.at(i).at(j),dp.at(i-1).at((j+2)%3)+abc.at(i).at(j));
  }
  int ans = max(dp.at(n-1).at(0),max(dp.at(n-1).at(1),dp.at(n-1).at(2)));
  cout << ans << endl;
  return 0;
}




Measured memory_bytes: 11136
d, g = map(int, input().split())
lst = []
for _ in range(d):
  lst.append([int(i) for i in input().split()])

res = 1000
for i in range(1 << d):
  s = 0
  c = 0
  for j in range(d):
    if i >> j & 1:
      s += 100 * (j + 1) * lst[j][0] + lst[j][1]
      c += lst[j][0]
    else:
      last = j
  if s < g:
    s100 = 100 * (last + 1)
    need = (g - s - 1) // s100 + 1
    if need > lst[last][0]:
      continue
    c += need
  if res > c:
    res = c
print(res)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
//#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
//#include "boost/multiprecision/cpp_int.hpp"
//typedef boost::multiprecision::cpp_int LL;
typedef long double dd;
#define i_7 (ll)(1E9+7)
//#define i_7 998244353
#define i_5 i_7-2

ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
typedef pair<ll,ll> l_l;
typedef pair<dd,dd> d_d;
ll inf=(ll)1E16;
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
void Max(ll &pos,ll val){pos=max(pos,val);}//Max(dp[n],dp[n-1]);
void Min(ll &pos,ll val){pos=min(pos,val);}
void Add(ll &pos,ll val){pos=mod(pos+val);}
dd EPS=1E-9;
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define fi first
#define se second
#define endl "\n"
#define SORT(v) sort(v.begin(),v.end())
#define ERASE(v) v.erase(unique(v.begin(),v.end()),v.end())
#define POSL(v,x) (lower_bound(v.begin(),v.end(),x)-v.begin())
#define POSU(v,x) (upper_bound(v.begin(),v.end(),x)-v.begin())
//template<class T>void max(T a,T b){if(a<b)return b;else return a;}
//template<class T>void min(T a,T b){if(a>b)return b;else return a;}
//template<class T>bool Max(T&a, T b){if(a < b){a = b;return 1;}return 0;}
//template<class T>bool Min(T&a, T b){if(a > b){a = b;return 1;}return 0;}

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


int main(){fastio
    ll n,k;cin>>n>>k;
    cout<<min(n%k,k-n%k)<<endl;
    
    
    return 0;
}



Measured memory_bytes: 256
#include <iostream>
    using namespace std;
    int main(void){
        // Your code here!
        int n,x;
        
        cin>>n>>x;
        
        int L[n];
        int sum=0;
        int i;
        for(i=0; i<n; i++){
            cin>>L[i];
            sum=sum+L[i];
            if(sum>x){
                cout<<i+1;
                break;
            }
        }
        if(sum<=x){
            cout<<i+1;
        }
    }

Measured memory_bytes: 256