akhauriyash/Code-Regression huggingface dataset:
#pragma GCC optimize ("O3")
#include <iostream>
#include <iomanip>
#include <istream>
#include <ostream>
#include <sstream>
#include <iterator>
#include <vector>
#include <algorithm>
#include <queue>
#include <deque>
#include <list>
#include <stack>
#include <map>
#include <unordered_map>
#include <set>
#include <bitset>
#include <utility>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <string>
#include <ctime>
#include <cctype>
#include <cstdlib>
#define IINF 10e8
#define INF 1<<30
#define MOD 1000000007
#define mod 10007
#define REP(i, a, n) for (ll i = a; i < (ll)(n); i++)
#define REPE(i, a, n) for (ll i = a; i <= (ll)(n); i++)
#define Endl endl
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define eb emplace_back
#define mmax(x,y)(x>y?x:y)
#define mmin(x,y)(x<y?x:y)
#define chmax(x,y) x=mmax(x,y)
#define chmin(x,y) x=mmin(x,y)
#define all(x) (x).begin(),(x).end()
#define siz(x) (ll)(x).size()
#define PI acos(-1.0)
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
typedef long double ld;
typedef pair<int,int>Pin;
typedef pair<ll,ll>Pll;
template<class T> using V=vector<T>;
long long GCD(long long a, long long b) {return b?GCD(b,a%b):a;}
long long LCM(long long a, long long b) {return a/GCD(a,b)*b;}
int dx[4]={-1,0,1,0};
int dy[4]={0,-1,0,1};
int ddx[8]={-1,0,1,0,1,1,-1,-1};
int ddy[8]={0,-1,0,1,1,-1,1,-1};
ll cmp(pair<ll,ll>a,pair<ll,ll> b){
        if(a.se!=b.se)
        return a.se<b.se;
        else
        return a.fi<b.fi;
}
//----------------------------------------------------------------------

//----------------------------------------------------------------------
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    //-------------------------------  
    //ll begin_time=clock();
    //------------------------------
    int a,b,c;cin>>a>>b>>c;
    int ans=0;
    for(int i=a;i<=b;i++){
        if(c%i==0)ans++;
    }
    cout<<ans<<endl;
    //-------------------------------  
    //ll end_time=clock();cout<<"time="<<end_time-begin_time<<"ms"<<endl;
    //-------------------------------
    return 0;
}
//----------------------------------------------------------------------

































Measured memory_bytes: 3228
整数 = int
入力 = input
各々 = map
文字列 = str
分割 = 文字列.split
配列 = list
総和 = sum
絶対値 = abs
出現回数 = 配列.count
出力 = print
零 = 0
真偽 = bool
又 = 真偽.__or__
且 = 真偽.__and__
余 = 整数.__mod__
和 = 整数.__add__
積 = 整数.__mul__
弐 = 2
壱 = 1
最小値 = min
差 = 整数.__sub__
負 = lambda 整数: 整数 < 零


長さ = 整数(入力())
整数列 = 配列(各々(整数, 分割(入力())))
絶対値列 = 配列(各々(絶対値, 整数列))
絶対値の和 = 総和(絶対値列)
零の数 = 出現回数(整数列, 零)
負の数の数 = 総和(各々(負, 整数列))
出力(差(絶対値の和,
      積(最小値(絶対値列),
          積(弐,
              差(壱,
                 整数(又(真偽(零の数),
                         真偽(余(和(負の数の数, 壱), 弐)))))))))


Measured memory_bytes: 14504
mod=10**9+7
n,k=map(int,input().split())
a=list(map(int,input().split()))
if max(a)<0:
  if k%2:a.sort(reverse=1)
  else:a.sort()
  ans=1
  for i in a[:k]:ans=(ans*i)%mod
  exit(print(ans))
if n==k:
  ans=1
  for i in a:ans=(ans*i)%mod
  exit(print(ans))
p=[(0,0)]
m=[(0,0)]
for i in a:
  if i<0:m.append((-i,1))
  else:p.append((i,0))
pp=mm=None
p.sort()
m.sort()
oe=0
ans=1
for i in range(k):
  if p[-1][0]>m[-1][0]:
    t,f=p.pop()
    pp=t
  else:
    t,f=m.pop()
    mm=t
  ans=(ans*t)%mod
  if ans==0:exit(print(0))
  oe^=f
if oe:
  if mm==None:
    ans=(ans*pow(pp,mod-2,mod)*m[-1][0])%mod
  elif pp==None:
    ans=(ans*pow(mm,mod-2,mod)*p[-1][0])%mod
  elif pp*p[-1][0]>mm*m[-1][0]:
    ans=(ans*pow(mm,mod-2,mod)*p[-1][0])%mod
  else:
    ans=(ans*pow(pp,mod-2,mod)*m[-1][0])%mod
print(ans)


Measured memory_bytes: 109500
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<vector<vector<int>>> vvvi;
typedef vector<vector<vector<vector<int>>>> vvvvi;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<vector<vector<ll>>> vvvl;
typedef vector<vector<vector<vector<ll>>>> vvvvl;
typedef vector<pair<int, int>> vpii;
typedef pair<int, int> pii;

int X , Y;
int x, y;

int main() {
  cin >> X >> Y;
  if(X == 1){
    x = 300000;
  }
  else if(X == 2){
    x = 200000;
  }
  else if(X == 3){
    x = 100000; 
  }
  else{
    x = 0;
  }
    if(Y == 1){
    y = 300000;
  }
  else if(Y == 2){
    y = 200000;
  }
  else if(Y == 3){
    y = 100000; 
  }
  else{
    y = 0;
  }
  if(X == 1 && Y == 1){
    cout << x + y + 400000 <<endl;
  }
  else{
    cout << x + y <<endl;
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)n; i++)
#define ALL(a) (a).begin(), (a).end()
const ll mod = 1e9 + 7;

int main()
{
    string s;
    cin >> s;
    int cnt[2] = {};
    int i = 0;
    for (; i < s.length(); i++)
    {
        if (s[i] == 'C')
        {
            cnt[0] = 1;
            i++;
            break;
        }
    }
    for (; i < s.length(); i++)
    {
        if (s[i] == 'F')
            cnt[1] = 1;
    }
    if (cnt[0] == 1 && cnt[1] == 1)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 256
n = int(input())
a = [int(i) for i in input().split()]

b = []
for i,k in enumerate(a):
	b.append([k,i])
b.sort()
for i in range(n-1):
	print("%d " % (b[i][1]+1),end="")
print("%d" % (b[n-1][1]+1))

Measured memory_bytes: 21380
//#pragma GCC target ("avx2,sse2")
//#pragma GCC optimization ("Ofast")
//#pragma GCC optimization ("unroll-loops")
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <set>
#include <queue>

using namespace std;

const int N = 2e6 + 14;
const int INF = 1e9;
const int mod = 1e9;
const int SZ = (1 << 17) - 1;
const int K = 320;

#define eb emplace_back
#define sz(s) (int)(s.size())
#define ppb pop_back

#define ll long long

#define int ll

int a[N];

signed main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	int n, k;
	cin >> n >> k;
	for (int i = 1; i <= n; ++ i)
		cin >> a[i];
	sort(a + 1, a + 1 + n);
	int sum = 0;
	for (int i = 1; i <= n - k; ++ i)
		sum += a[i];
	cout << sum;
	return 0;
}


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

typedef long long  ll;

ll MOD = 1000000007;
ll INF = 100000000000000000;
double PI = 3.1415926535;

template<typename T>
void remove(std::vector<T>& vector, unsigned int index)
{
    vector.erase(vector.begin() + index);
}

ll N,K;



int main(){
  int N;
  string S;
  cin >> N >> S;
  vector<vector<int>> dp(5010,vector<int>(5010,0));
  for(int i = N-1;i >= 0;i--){
    for(int j = N-1;j >= 0;j--){
      if(S[i] == S[j]){
        dp[i][j] = 1 + dp[i+1][j+1];
      }else{
        dp[i][j] = 0;
      }
    }
  }
  int ans = 0;
  for(int i = 0;i < N;i++){
    for(int j = 0;j < N;j++){
      //cout << dp[i][j] << ' ';
      if(i != j && i + dp[i][j] <= j){
        ans = max(ans,dp[i][j]);
      }
    }
    //cout << endl;
  }
  cout << ans << endl;
}


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

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


	stringstream ss;
	for (int i = x-k+1; i <= x+k-1; i++) {
		ss << i << " ";
	}
	string ans = ss.str();
	cout << ans << endl;
	return 0;
}



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

void solve()
{
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    cout << min({a + c, a + d, b + c, b + d}) << endl;
}

int main()
{
    solve();
    return 0;
}

Measured memory_bytes: 3568
#include <iostream>

int main(void) {
	using namespace std;
	int W, H, x, y, r;
	cin >> W >> H >> x >> y >> r;
	if ((W - r) >= x && r <= x &&( H - r) >= y && r <= y) {
		cout << "Yes" << endl;
	}
	else cout << "No" << endl;

	return 0;
}

Measured memory_bytes: 3104
package main

import (
	"bufio"
	"os"
	"strconv"
	"fmt"
)

var scanner = bufio.NewScanner(os.Stdin)

func nextInt() int {
	scanner.Scan()
	i, e := strconv.Atoi(scanner.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func main() {
	scanner.Split(bufio.ScanWords)
	q := nextInt()
	set := make(map[int]struct{})
	for i := 0; i < q; i++ {
		switch nextInt() {
		case 0:
			x := nextInt()
			set[x] = struct{}{}
			fmt.Println(len(set))
		case 1:
			x := nextInt()
			if _, ok := set[x]; ok {
				fmt.Println(1)
			} else {
				fmt.Println(0)
			}

		default:
			panic("no such operation!")
		}
	}
}



Measured memory_bytes: 9068
#include <bits/stdc++.h>
 
typedef long long ll;

using namespace std;
using Graph = vector<vector<int>>;

#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)

int N;

void Main()
{
    long double a, b, ans;
    cin >> a >> b;

    ans = a * b;

    cout << (long long)(ans  + 0.001) << endl;
}
 
int main()
{
	cin.tie(0);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	Main();
}



Measured memory_bytes: 3752
from itertools import accumulate

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

if n == 2:
  print(abs(A[0]-A[1]))
  exit()
  
B = list(accumulate(A))

ans = abs(B[-2]-A[-1])
y = 0
for i in range(len(A)-1, 0, -1):
    x = B[i-1]
    y += A[i]
    #print(x, y, ans)
    ans = min(ans, abs(x-y))

print(ans)

Measured memory_bytes: 30908
using System;

namespace abc058A
{
    class MainClass
    {
        public static void Main(string[] args)
        {
            string[] str = Console.ReadLine().Split();
            int A = int.Parse(str[0]);
            int B = int.Parse(str[1]);
            int C = int.Parse(str[2]);
            if ((B - A) == (C - B))
                Console.WriteLine("YES");
            else
                Console.WriteLine("NO");
        }
    }
}


Measured memory_bytes: 13140
import java.util.Scanner;
public class Main{
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		while(scan.hasNext()){
			int n = Integer.parseInt(scan.nextLine());
			String[] str = scan.nextLine().split(" ");
			BubbleSort(str,n);
			SelectionSort(str,n);
		}
	}
	
	public static void swapStr(String[] a,int i,int j){
		String t = a[j];a[j] = a[i];a[i] = t;
	}
	
	public static void PrintOutStr(String[] a,int n){
		for(int i = 0;i < n;i++){
			System.out.print(a[i] + ((i == n-1)?"\n":" "));
		}
	}
	
	public static void BubbleSort(String[] str,int n){
		String[] card = new String[n];
		for(int i = 0;i < n;i++){
			card[i] = str[i];
		}
		for(int i = 0;i < n;i++){
			for(int j = n-1;j > i;j--){
				if(card[j].charAt(1) < card[j-1].charAt(1)){
					swapStr(card,j,j-1);
				}
			}
		}
		PrintOutStr(card,n);
		System.out.println("Stable");
	}
	
	public static boolean jStab(String[] str,String[] card,int n){
		boolean fl = false;
		for(int i = 0;i < n-1;i++){
			if(card[i].charAt(1) == card[i+1].charAt(1)){
				String a = card[i];
				String b = card[i+1];
				int ia = 0;
				int ib = 0;
				for(int j = 0;j < n;j++){
					if(str[j].equals(a)){
						ia = j;
					}else if(str[j].equals(b)){
						ib = j;
					}
				}
				fl = (ib-ia > 0)?false:true;
			}
			if(fl){
				break;
			}
		}
		return fl;
	}
	
	public static void SelectionSort(String[] str,int n){
		String[] card = new String[n];
		for(int i = 0;i < n;i++){
			card[i] = str[i];
		}
		for(int i = 0;i < n;i++){
			int min = i;
			for(int j = i + 1;j < n;j++){
				if(card[min].charAt(1) > card[j].charAt(1)){
					min = j;
				}
			}
			if(min != i){
				swapStr(card,i,min);
			}
		}
		PrintOutStr(card,n);
		System.out.println((jStab(str,card,n))?"Not stable":"Stable");
	}
}

Measured memory_bytes: 17200
package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"strconv"
)

func getScanner(fp *os.File) *bufio.Scanner {
	scanner := bufio.NewScanner(fp)
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, 500001), 500000)
	return scanner
}

func getNextString(scanner *bufio.Scanner) string {
	scanner.Scan()
	return scanner.Text()
}

func getNextInt(scanner *bufio.Scanner) int {
	i, _ := strconv.Atoi(getNextString(scanner))
	return i
}

func getNextInt64(scanner *bufio.Scanner) int64 {
	i, _ := strconv.ParseInt(getNextString(scanner), 10, 64)
	return i
}

func main() {
	fp := os.Stdin
	if len(os.Args) > 1 {
		fp, _ = os.Open(os.Args[1])
	}

	scanner := getScanner(fp)
	writer := bufio.NewWriter(os.Stdout)

	n := getNextInt(scanner)
	m := getNextInt(scanner)
  p := int64(0)

	edges := make([]Edge, m)

	var g Graph
	g.lto = make([][]int, n)
	g.rto = make([][]int, n)
	for i := 0; i < n; i++ {
		g.lto[i] = make([]int, 0)
		g.rto[i] = make([]int, 0)
	}

	for i := 0; i < m; i++ {
		a := getNextInt(scanner) - 1
		b := getNextInt(scanner) - 1
		c := (getNextInt64(scanner) - p) * -1
		edges[i] = Edge{
			a:    a,
			b:    b,
			cost: c,
		}
		g.lto[a] = append(g.lto[a], b)
		g.rto[b] = append(g.rto[b], a)
	}

	g.lreach = make([]bool, n)
	g.rreach = make([]bool, n)

	g.dfs(0, false)
	g.dfs(n-1, true)

	cc := make([]int64, n)
	for i := 0; i < n; i++ {
		cc[i] = math.MaxInt64
	}

	cc[0] = 0

	for i := 0; i < n; i++ {
		for ii := 0; ii < m; ii++ {
			if cc[edges[ii].a] == math.MaxInt64 {
				continue
			}
			if g.lreach[edges[ii].a] == false {
				continue
			}
			if g.rreach[edges[ii].a] == false {
				continue
			}
			if cc[edges[ii].b] > edges[ii].cost+cc[edges[ii].a] {
				cc[edges[ii].b] = edges[ii].cost + cc[edges[ii].a]
				if i == n-1 {
					fmt.Fprintln(writer, "inf")
					writer.Flush()
					return
				}
			}
		}
	}
	fmt.Fprintln(writer, -cc[n-1])
	writer.Flush()
}

type Graph struct {
	lto, rto       [][]int
	lreach, rreach []bool
}

func (g *Graph) dfs(s int, r bool) {
	to := g.lto
	reach := g.lreach
	if r == true {
		to = g.rto
		reach = g.rreach
	}
	if reach[s] == true {
		return
	}
	reach[s] = true
	for _, t := range to[s] {
		g.dfs(t, r)
	}
}

type Edge struct {
	a, b int
	cost int64
}


Measured memory_bytes: 1024
{-# OPTIONS_GHC -O2 -funbox-strict-fields #-}
module Main(main) where
import qualified Data.Vector as V
import Data.Vector (Vector)
import Data.Vector ((!))
import Data.Vector ((!?))
import Control.Applicative
main :: IO ()
main = do
  n:maxw:_ <- map read . words <$> getLine :: IO [Int]
  vws <- V.replicateM n $ do
    v:w:_ <- map read . words <$> getLine :: IO [Int]
    return (v,w)
  print $ V.maximum $ solve vws (maxw+1)
  return ()
{-# INLINE solve #-}
solve :: Vector (Int,Int) -> Int -> Vector Int
solve vws maxw = V.foldl' next v0 vws
  where
    v0 :: Vector Int
    v0 = V.replicate (maxw) 0
    next :: Vector Int -> (Int,Int) -> Vector Int
    --next vs _ | traceShow vs False = undefined
    next vs (v,w) = V.generate maxw gen
      where
        gen i = max v1 v2
          where
            v1 = vs ! i
            v2 = case vs !? (i - w) of
              Nothing -> 0
              Just p -> p + v

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

int main(){
  ll x,y,a,b,c;
  cin>>x>>y>>a>>b>>c;
  vector<ll> p(a),q(b),r(c);
  for(ll i=0; i<a; i++) cin>>p[i];
  for(ll i=0; i<b; i++) cin>>q[i];
  for(ll i=0; i<c; i++) cin>>r[i];
  sort(p.begin(),p.end());
  sort(q.begin(),q.end());
  sort(r.begin(),r.end());
  reverse(p.begin(),p.end());
  reverse(q.begin(),q.end());
  reverse(r.begin(),r.end());
  vector<ll> s;
  for(ll i=0; i<x; i++) s.push_back(p[i]);
  for(ll i=0; i<y; i++) s.push_back(q[i]);
  for(ll i=0; i<c; i++) s.push_back(r[i]);
  sort(s.begin(),s.end());
  reverse(s.begin(),s.end());
  ll ans=0;
  for(ll i=0; i<x+y; i++) ans += s[i];
  cout<<ans;
}

Measured memory_bytes: 8816
from sys import stdin


def fetch_one_line():
    return stdin.readline().rstrip()


def fetch_int_input():
    return [int(s) for s in fetch_one_line().split()]


def fetch_inputs(times):
    return [fetch_one_line() for _ in range(times)]


def fetch_int_inputs(times):
    return [[int(s) for s in fetch_one_line()] for _ in range(times)]


s = fetch_one_line()
print(s[:3] + "8" + s[4:])



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

int n;
long long int a[200000], b[200000];

int main(){
  cin >> n;
  rep(i, n){
    cin >> a[i] >> b[i];
    a[i] %= b[i];
  }
  long long int cnt = 0;
  for(int i = n - 1; i >= 0; i--){
    a[i] += cnt;
    long long int tmp = a[i] % b[i];
    tmp = b[i] - tmp;
    tmp %= b[i];
    cnt += tmp;
    //cerr << tmp << endl;
  }
  cout << cnt << endl;
}


Measured memory_bytes: 1792
#include <iostream>
using namespace std;
int main(void) {
	int L, R, d, i, cnt = 0;
	cin >> L >> R >> d;
	for (i=L; i<=R; i++) {
		if (i%d == 0)
			cnt++;
	}
	cout << cnt;
	
	return 0;
}

Measured memory_bytes: 3636
use proconio::input;

fn main() {
    input!(n: usize, a: [usize; n]);

    const AMAX: usize = 1_000_000;

    let mut div = vec![0; AMAX + 1];
    let mut pri = Vec::new();

    for i in 2..=AMAX {
        if div[i] != 0 {
            continue;
        }
        pri.push(i);
        let mut j = i;
        while j <= AMAX {
            div[j] = i;
            j += i;
        }
    }

    let mut cnt = vec![0; AMAX + 1];
    for &a in &a {
        cnt[a] += 1;
    }
    for i in (2..=AMAX).rev() {
        if div[i] == i {
            continue;
        }
        let j = i / div[i];
        cnt[j] += cnt[i];
        if div[j] != div[i] {
            cnt[div[i]] += cnt[i];
        }
    }

    let pairwise = pri.iter().all(|&i| cnt[i] <= 1);
    let setwise = pri.iter().all(|&i| cnt[i] < n);

    println!(
        "{}",
        if pairwise {
            "pairwise coprime"
        } else if setwise {
            "setwise coprime"
        } else {
            "not coprime"
        }
    );
}


Measured memory_bytes: 32588
{-# OPTIONS_GHC -O2 -funbox-strict-fields #-}
import           Control.Monad (replicateM)

main :: IO ()
main = do
  css <- replicateM 3 getLine
  let c00 = css !! 0 !! 0
      c11 = css !! 1 !! 1
      c22 = css !! 2 !! 2
  putStrLn $ c00 : c11 : c22 : ""


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

int main() {
  int n, m;
  cin >> n >> m;
  cout << (n-1)*(m-1) << endl;
}

Measured memory_bytes: 3584
n, m = map(int, input().split())
ac = 0
pe = 0
c = [0 for i in range(n+1)]
wa = [0 for i in range(n+1)]
for i in range(m):
    s = input().split(" ")
    if c[int(s[0])] == 1:
        continue
    else:
        if s[1] == "AC":
            c[int(s[0])] += 1
            ac += 1 
            pe += wa[int(s[0])]
        else:
            wa[int(s[0])] += 1
print(ac, pe)

Measured memory_bytes: 4760
#include  <iostream>
#include  <stdio.h>
#include <algorithm>
using namespace std;
#include <vector>
#define rep(i,n) for (int i = 0; i < (n) ; i++)
#define INF 1e9
#define llINF 1e18
#define MOD 1000000007
#define pb push_back
#define ll long long
#define ull unsigned long long
#define vint vector<int>
#define vll vector<ll>

//#include <stack>
//#include <queue>

/*
#include <math.h>
int standerd = int(pow(10.0,9.0)) + 7;
*/
string ans_Yes = "Yes"; 
string ans_No = "No"; 
string ans_yes = "yes"; 
string ans_no = "no"; 
 
ll index[1000000][15]={};

int main(){



    string S;
    cin >> S;
    string Sn;
    index[0][0]=1;
    int cnt=1;
    for( int si = 0 ; si < S.length() ;si++ ){
        Sn = S.substr(si,1);

        int target;
        //cout << Sn << endl;
        if(Sn=="?"){
            rep(ii,10){
                rep(jj,13){
                    index[cnt][ (jj * 10 + ii)%13  ] += index[cnt-1][jj]; 
                }
            }
        }else{
            target =  atoi(Sn.c_str());
            rep(jj,13){
                index[cnt][ (jj * 10 + target) % 13  ] += index[cnt-1][jj]; 
            }
        }
        rep(jj,13){
            index[cnt][jj] %= MOD;
        }
        cnt++;
    }
    cout << index[cnt-1][5] << endl;



}

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

#define INF 1001001001
#define LINF 1001001001001001001
#define MOD 1000000007
#define MOD2 998244353

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

#define rep(i,n) for(int i=0,_i=(n);i<_i;++i)
#define rep1(i,a,b) for(int a_=(a),b_=(b),i=a_;i<b_;++i)
#define repr(i,n) for(int _i=(n),i=_i;i>0;--i)

#define db(x) cerr<<#x<<" = "<<x<<" ";
#define db2(x,y) cerr<<"("<<#x<<", "<<#y<<") = ("<<x<<", "<<y<<") ";
#define db3(x,y,z) cerr<<"("<<#x<<", "<<#y<<", "<<#z<<") = ("<<x<<", "<<y<<", "<<z<<") ";
#define ln cout<<endl;

#define all(a)  (a).begin(),(a).end()
#define dig(n)  to_string(n).length()

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define se second
#define fi first

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

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);}

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

vector<string> RnS;
vector<ll> RnN;

void bfs(string num,int cdig,int dim){
    RnS.emplace_back(num);
    if(dim <= 8){
        string add;
        for(int i = max(0,cdig-1); i < min(10,cdig+2);++i){
            add = to_string(i);
            bfs(num+add,i,dim+1);
        }
    }
}

int main(){

    bool flag=false;
    ll ans=0,sum=0;

    int k;
    cin>>k;

    rep1(i,1,10){
        bfs(to_string(i),i,0);
    }

    for(string rns:RnS)RnN.emplace_back( stoll(rns) ) ;
    sort(all(RnN));
    //db(RnN.size());


    cout <<RnN[k-1]<<endl;

    //if(flag)cout << "Yes" <<endl;
    //else cout << "No" <<endl;

    return 0;
}


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

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

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

#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for (int i = x; i < n; i++)
#define OP(m) cout << m << endl
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;

int main()
{
    int a, b;
    cin >> a >> b;
    if (a * b % 2 == 0)
        OP("Even");
    else
        OP("Odd");
    return 0;
}

Measured memory_bytes: 256
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <stack>
using namespace std;

int main() {
    /* Enter your code here. Read input from STDIN. Print output to STDOUT */   
    stack<int> S1;
    stack< pair < int, int > > S2;
    char ch;
    int sum = 0;
    for(int i = 0; cin >> ch; i++){
        if(ch == '\\')
            S1.push(i);
        else if(ch == '/' && S1.size() > 0){
            int j = S1.top();
            S1.pop();
            sum += i - j;
            int a = i - j;
            while(S2.size() > 0 && S2.top().first > j){
                a += S2.top().second;
                S2.pop();
            }
            S2.push(make_pair(j, a));
        }
    }
    
    vector<int> ans;
    int t = 0;
    while(S2.size() > 0){
        ans.push_back(S2.top().second);
        S2.pop();
    }
    reverse(ans.begin(), ans.end());
    cout << sum << endl;
    cout << ans.size();
    for(int i = 0; i < ans.size(); i++){
        cout << " ";
        t += ans[i];
        cout << ans[i];
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 1284
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <fstream>
#include <cassert>
#include <cstring>
#include <numeric>
#include <ctime>
#include <complex>
#include <bitset>
#include <random>
#include <climits>
#include <stack>

using namespace std;

typedef long long ll;
typedef long double ld;

#define int ll
#define double ld
#define loop(i, n) for(int i = 0; i < (int)n; ++i)
#define loop1(i, n) for(int i = 1; i <= (int)n; ++i)
#define F first
#define S second
#define pb push_back
#define pi pair <int, int>
#define all(x) begin(x), end(x)
#define ti tuple <int, int, int>
#define Point Vect
#define no {cout << 0; return;}
#define mkp make_pair
#define mkt make_tuple
#define cerr if(0) cerr

void solve() {
    int n;
    string s, t;
    cin >> n >> s >> t;
    loop(i, n)
        cout << s[i] << t[i];
}

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


Measured memory_bytes: 3548
s = input()
n = len(s)

ans = 0
cnt = 0
for i in range(n):
    if s[i] == "T" or s[i] == "A" or s[i] == "C" or s[i] == "G":
        cnt += 1
        if cnt > ans:
            ans = cnt
    else:
        cnt = 0
print(ans)

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

typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<ll,ll> P;
typedef vector<P> vp;

const ll mod = 1e9+7;
const ll inf = 1e16;

#define loop(i,m,n) for(ll i=m;i<n;i++)
#define vloop(it,x) for(auto it=x.begin(); it!=x.begin(); it++)
#define all(x) x.begin(),x.end()
#define debug(x) cout << #x <<":"<< x <<endl	
#define showll(x) printf("%lld\n",x)
#define test(t) ll t;cin >> t;while(t--)
#define showc(x) printf("%c\n",x)
#define read(x) cin >> x
#define yes printf("YES\n")
#define no printf("NO\n")
#define pb push_back

void fast()
{
ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
}

//////////////////////////////// - _ - \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\

ll n;

int main()
{
	fast();
	// debug(n);
	// showll(a);
	ll i,j,w,n,tmp;
	read(n);read(w);
//	debug(n);debug(w);
	ll dp[w+1];
	ll val[n];
	ll wt[n];
	loop(i,0,n)
	{
		cin >> wt[i] >> val[i]; 
	}
	loop(i,0,w+1)
	{
		dp[i] = 0;
	}
	loop(i,0,n)
	{
		for(j=w;j>=0;j--)
		{
			if((wt[i]+j)<=w)
			{
				dp[wt[i]+j] = max(dp[wt[i]+j],val[i]+dp[j]);
			//	debug(wt[i]+j);
			//	debug(dp[wt[i]+j]);
			}
		}
	}
	ll ans= 0;
	loop(i,0,w+1)
	{
		ans = max(ans,dp[i]);
	}
	showll(ans);
}


Measured memory_bytes: 1024
#include <stdio.h>

int	main(void)
{
  	long long 	a;
    long long 	b;
    long long 	c;
    long long 	k;
  
  	long long	t;
  	long long 	u;
  	long long 	v;
  	long long 	i;
  
  	scanf("%lld %lld %lld %lld", &a, &b, &c, &k);
  
  	t = k - a;
  
  	if(t < 0)
    {
      	printf("%lld", k);
      	return (0);
    }
  	else
    {
      	u = t - b;
      	if(u < 0)
        {
          	printf("%lld", a);
          	return (0);
        }
      	else
        {
          	if (u < c)
            {
              	printf("%lld", a - u);
                return (0);
            }
          	else
            {
              	printf("%lld", a - c);
              	return (0);
            }
        }
    }
  	return (0);
}

Measured memory_bytes: 1728
#include<bits/stdc++.h>
#include<mutex>
#define MOD 1000000007
#define line "\n"
#define loop(i,a,n) for(ll i=a;i<n;i++)
#define ll long long int
#define lb long double
#define ull unsigned long long int
#define pb push_back
#define vi vector < int >
# define vs vector < string >
# define vb vector < bool >
#define vll vector<ll>
# define pii pair < int , int >
# define pll pair < ll , ll >
# define pld pair < ld , ld >
# define pDD pair < D , D >
#define vpii vector<pair<int,int>>
#define vpsi vector<pair<string,int>>
#define mii map<int ,int>
#define mis map<int,string>
#define all(v) v.begin(),v.end()


# define fast ios_base::sync_with_stdio(false) ; cin.tie(0) ; cout.tie(0);
using namespace std;

void solve()
{ 
int n;
cin>>n;
int a=1000;
int z=n%a;
if(z==0){cout<<z<<line;return;}
if(z>500)
{
    cout<<1000-z<<line;
}
else
    {
        cout<<1000-z<<line;
    }
    


}



int main()
{fast
// #ifndef ONLINE_JUDGE
//  freopen("input.txt","r",stdin);
//  freopen("output.txt","w",stdout);
//  #endif
// ll t;
// cin>>t;
// while(t--)
{
solve();
}

}



Measured memory_bytes: 3612
#include <stdio.h>

int main()
{
    int n;
    long int sum = 0;

    scanf("%d", &n);

    for (int i = 1; i <= n; i++) {
        if (i % 3 != 0 && i % 5 != 0)
            sum += i;
    }

    printf("%ld\n", sum);

    return 0;
}

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

using namespace std;

typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> VI;
typedef vector<VI> VVI;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const int INF = numeric_limits<int>::max() / 2;
const int NEG_INF = numeric_limits<int>::min() / 2;

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

  int a,b,c;
  cin >> a >> b >> c;
  bool ans=false;
  for(int t=0;t<61;t++){
    if((60*t+c)%(a+b) <=a) {
      cout << 60*t+c << endl;
      ans = true;
      break;
    }
  }
  if(!ans) cout << -1 << endl;
}

Measured memory_bytes: 3204
#pragma GCC optimize ("O2")
#pragma GCC target ("avx2")
//#include<bits/stdc++.h>
#include<iostream>
#include<algorithm>
#include<cstring>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please

const int CM = 1 << 17, CL = 12;
char cn[CM + CL], * ci = cn + CM + CL, * owa = cn + CM, ct;
const ll ma0 = 1157442765409226768;
const ll ma1 = 1085102592571150095;
const ll ma2 = 71777214294589695;
const ll ma3 = 281470681808895;
const ll ma4 = 4294967295;
inline int getint() {
	if (ci - owa > 0) {
		memcpy(cn, owa, CL);
		ci -= CM;
		fread(cn + CL, 1, CM, stdin);
	}
	ll tmp = *(ll*)ci;
	int dig = 68 - __builtin_ctzll((tmp & ma0) ^ ma0);
	tmp = tmp << dig & ma1;
	tmp = tmp * 10 + (tmp >> 8) & ma2;
	tmp = tmp * 100 + (tmp >> 16) & ma3;
	tmp = tmp * 10000 + (tmp >> 32) & ma4;
	ci += 72 - dig >> 3;
	return tmp;
}


const int dm = 1400000;
char dn[dm], * di = dn;
const int MAX = 20000;
class unko {
public:
	char C[MAX * 7 + 10], *K[MAX + 10];
	constexpr unko() : C(), K() {
		auto di = C + 3;
		C[0] = '0';
		C[0] = ' ';
		C[0] = '\n';
		K[0] = C;
		K[1] = di;
		rep1(i, MAX) {
			int X = i;
			int keta = 0;
			char c[10] = {};
			while (X) {
				*(c + keta) = '0' + X % 10;
				X /= 10;
				keta++;
			}
			for (int j = keta - 1; j >= 0; j--)* di++ = (*(c + j));
			*di++ = ' ';
			*di++ = '\n';
			K[i + 1] = di;
		}
	}
};
constexpr unko f;
inline void putint(int X) {
	if (X > 20000) {
		int ue = X / 10;
		for (auto i = f.K[ue]; *i != ' '; i++) *di++ = *i;
		*di++ = '0' + X % 10;
		*di++ = ' ';
	}
	else for (auto i = f.K[X]; *i != '\n'; i++)* di++ = *i;
}

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


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

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

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

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

	Would you please return 0;
}

Measured memory_bytes: 7296
/**
 *  Kaiwen Zhou,
 *  CUHK
**/
#include <bits/stdc++.h>
using namespace std;
#define INS ios::sync_with_stdio(false);cin.tie(0)
typedef long long LINT;
#define INF 1000000000000

int main(void) {
    INS;
    LINT n, k;
    cin >> n >> k;
    LINT h[n], dp[n];
    for(int i = 0; i < n; i ++) {
        cin >> h[i];
        dp[i] = INF;
    }
    dp[0] = 0;
    for(int i = 1; i < n; i ++) {
        for(int j = 1; j <= k; j ++) {
            if(i - j >= 0) {
                dp[i] = min(dp[i], dp[i - j] + abs(h[i] - h[i - j]));
            }
        }
    }
    cout << dp[n - 1] << '\n';
    return 0;
}


Measured memory_bytes: 1792
// PCK2018 Yosen Q8 Taxi
// YAMADA Terushige 2018.9.30.

#include <iostream>
#include <set>
#include <vector>

using namespace std;

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

  multiset <int> s;
  for(int i=1;i<=N;i++){
    cin >> M;
    for(int j=0;j<M;j++){
      int c;
      cin >> c;
      s.insert(c);
      if(s.size()>i) s.erase(s.begin()); 
    }
  }

  long long sum=0;
  for(const auto &v:s){
    sum+=v;
  }
  cout << sum << endl;
  return 0;
}



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

#define int long long

int N;
int A[111111];

signed main() {
  cin >> N;
  int minus = 0; // マイナスの個数
  for (int i = 0; i < N; i++) {
    cin >> A[i];
    if (A[i] < 0) {
      minus++;
    }
  }

  if (minus % 2 == 0) {
    int ans = 0;
    for (int i = 0; i < N; i++) {
      ans += abs(A[i]);
    }
    cout << ans << endl;
  } else {
    for (int i = 0; i < N; i++) {
      A[i] = abs(A[i]);
    }
    sort(A, A+N);
    int ans = -A[0]; // 一番小さいやつをマイナスにする
    for (int i = 1; i < N; i++) {
      ans += A[i];
    }
    cout << ans << endl;
  }

  return 0;
}

Measured memory_bytes: 1024
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
using static System.Math;

namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            var sw = new System.IO.StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);
            new Program().Solve(new MyInputStream(Console.In, ' '));
            Console.Out.Flush();
        }

        public void Solve(MyInputStream cin)
        {
            var N = cin.ReadInt();
            var K = cin.ReadInt();
            var l = cin.ReadIntArray(N);
            WriteLine(l.OrderByDescending(x => x).Take(K).Sum());
        }
    }

    public class MyInputStream
    {
        private readonly System.IO.TextReader _stream;
        private char separator = ' ';
        private Queue<string> inputStream;
        public MyInputStream(System.IO.TextReader s, char separator = ' ')
        {
            this.separator = separator;
            this._stream = s;
            inputStream = new Queue<string>();
        }
        public string Read()
        {
            if (inputStream.Count != 0) return inputStream.Dequeue();
            string[] tmp = _stream.ReadLine().Split(separator);
            for (int i = 0; i < tmp.Length; ++i)
                inputStream.Enqueue(tmp[i]);
            return inputStream.Dequeue();
        }
        public string ReadLine() { return _stream.ReadLine(); }
        public int ReadInt() { return int.Parse(Read()); }
        public long ReadLong() { return long.Parse(Read()); }
        public double ReadDouble() { return double.Parse(Read()); }
        public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read(); return ret;}
        public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt(); return ret;}
        public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong(); return ret;}
    }
}

Measured memory_bytes: 13396
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>

// increment
#define rep_n(_1, _2, _3, NAME, ...) NAME
#define rep_2(i, n) for (int(i) = 0; (i) < (int)(n); ++(i))
#define rep_3(i, initial, n) for (int(i) = (int)(initial); (i) < (int)(n); ++(i))
#define rep(...) rep_n(__VA_ARGS__, rep_3, rep_2, rep_1)(__VA_ARGS__)
// decrement
#define rep_r_n(_1, _2, _3, NAME, ...) NAME
#define rep_r_2(i, n) for (int(i) = (int)(n); (i) > 0; (i)--)
#define rep_r_3(i, initial, n) for (int(i) = (int)(initial); (i) > (int)(n); (i)--)
#define rep_r(...) rep_r_n(__VA_ARGS__, rep_r_3, rep_r_2)(__VA_ARGS__)
// define type definition
using namespace std;
typedef long long ll;
using mpint = boost::multiprecision::cpp_int; // 多倍長整数（任意精度）
typedef pair<int, int> P;

// define construct variable
const double EPS = numeric_limits<double>::epsilon();
// 10^9 + 7
const ll MOD = ll(1e9)+7;
const ll INF = ll(1e10);
const string ALPHABET = "abcdefghijklmnopqrstuvwxyz";

// define methods
// 最大公約数
ll gcd(const ll a, const ll b) { return b ? gcd(b, a % b) : a; }
// 最小公倍数
ll lcm(const ll a, const ll b) { return a / gcd(a, b) * b; }
// char -> int
int ctoi(char c) { return (int)(c - '0'); }
// 素因数分解
vector< pair<ll, ll> > prime_factorize(ll n) {
  vector< pair<ll, ll> > p;
  for (ll i = 2; i * i <= n; i++) {
    if ((n % i) != 0) continue;
    p.push_back(make_pair(i, 0));
    while ((n % i) == 0) {
      n /= i;
      p[i].second += 1;
    }
    p.push_back(make_pair(n, 0));
  }

  if (n != 1) p.push_back(make_pair(n, 1));
  return p;
}
// 組み合わせの整合性を保つ（後ほど解析する）
ll modinv(ll a) {
	ll b = MOD, u = 1, v = 0;
	while (b) {
		ll t = a / b;
		a -= t * b;
		swap(a, b);
		u -= t * v;
		swap(u, v);
	}
	u %= MOD;
	if (u < 0) { u += MOD; }
	return u;
}
// 順列
ll permutation(const ll n, const ll m) {
	ll result = 1;
	for (ll i = n; i > n - m; i--) { result = (result * i) % MOD; }
	return result;
}

// 繰り返し n 乗法
ll repeat_square(const ll n, const ll x) {
	if (x == 0) return 1;
	ll res = repeat_square(n, x/2);
	res = res * res % MOD;
	if ((x % 2) == 1) res = res * n % MOD;
  return res;
}
// 組み合わせ
ll combination(const ll n, const ll a) {
	ll x = 1, y = 1;
  for(ll i = 0; i < a; i++){
    x = x * (n-i) % MOD;
    y = y * (i+1) % MOD;
  }
  return x * repeat_square(y, MOD-2) % MOD;
}

int result = 0;

void dfs(int N, int M, int Q, vector<int> A, map<int, vector<int> > m){
	if (A.size() == N+1) {
		int temp = 0;
		rep(i, Q) {
			int a = m[i][0];
			int b = m[i][1];
			int c = m[i][2];
			int d = m[i][3];
			if ((A[b-1] - A[a-1]) == c) temp += d;
		}

		if (temp > result) result = temp;
		return;
	}
	A.push_back(A.back()); // 直前の数を push（A1 <= A2 <= A3 ... An のため）
	while(A.back() <= M) {
		dfs(N, M, Q, A, m);
		A.back()++;
	}
}

int main() {
	int N, M, Q;
	map<int, vector<int> > m;
	cin >> N >> M >> Q;

	rep(i, Q) {
		int a, b, c, d;
		cin >> a >> b >> c >> d;
		m[i] = vector<int>{a,b,c,d};
	}
	
	dfs(N, M, Q, vector<int> (1, 1), m);
	cout << result << endl;
  return 0;
}


Measured memory_bytes: 3668
/* Kadai2_3
   nabe9393 */
 
#include <stdio.h>
 
int main(void) {
    int N, A, B;
 
    //入力受け取り
    scanf("%d", &N);
    scanf("%d", &A);
    //Bの値が黒く塗ることになるマスの数
    //Nの二乗からAを引いた数
    B = N*N - A;
    printf("%d\n", B);
    return 0;
}

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

using namespace std;

vector<int> prime;

void createPrim() {
    int index = 0;
    for (int x = 11; x <= 55555; x += 30) {
        int z = 0;
        for (int y = 2; y <= x - 1; y++) {
            if (x % y == 0) {
                z++;
            }
        }
        if (z == 0) {
            prime.push_back(x);
        }
    }
}

int main()
{
    int a;
    vector<int> select;
    
    createPrim();

    cin >> a;

    for (int i = 0; i < prime.size(); i++) {
        if (prime[i] % 5 == 1) {
            select.push_back(prime[i]);
        }
        if (select.size() == a) break;
    }

    for (int i = 0; i < select.size(); i++) {
        cout << select[i];
        if (i != select.size() - 1) {
            cout << " ";
        }
    }
    cout << endl;

    return 0;
}

Measured memory_bytes: 256
n = int(input())
h = list(map(int, input().split()))

ans = 0
_min = 0
for i in range(1,n):
    if h[i-1]>=h[i]:
        _min += 1
    else:
        if _min > ans:
            ans = _min
        _min = 0

if _min > ans:
    ans = _min

print(ans)


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

#define LL long long
typedef pair<int, int> pii;

template< typename T > inline void read(T &x)
{
    static char _c;
    static bool _f;

    x = 0;
    _f = 0;
    _c = getchar();

    while(_c < '0' || '9' < _c) {if(_c == '-') _f = true; _c = getchar();}
    while('0' <= _c && _c <= '9') {x = (x << 1) + (x << 3) + (_c & 15); _c = getchar();}
    if(_f) x = -x;
}

template < typename T > inline void Min(T &x, T y) {if(y < x) x = y;}
template < typename T > inline void Max(T &x, T y) {if(x < y) x = y;}


#define lowbit(x) ((x) & -(x))
#define lson l,mid,id<<1
#define rson mid+1,r,id<<1|1
#define ls id<<1
#define rs id<<1|1
#define MID(l,r) ((l)+(((r)-(l))>>1))
#define fi first
#define se second
#define mk make_pair
#define pb push_back

const int MOD = (int) 1e9 + 7;
const int inf = (int) 1e9;
const int maxn = (int) 2e5 + 20;
const int maxm = (int) 5e5 + 20;

void work()
{
    int a, b, c;
    cin >>a >>b >>c;
    cout <<a + b + c - max(max(a, b), c) <<endl;
}

int main()
{
#ifdef yukihana0416
freopen("in.txt", "r", stdin);
//freopen("out.txt", "w", stdout);
#endif // yukihana0416
    int tc = 1;
//    cin >>tc;
    for(int ca = 1; ca <= tc; ca++)
    {
//        printf("Case #%d: ", ca);
        work();
    }
    return 0;
}


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

const int N = 301;
const int MOD = 998244353;

void add(int &a,int b) { a = (a + b + MOD) % MOD; }
void mul(int &a,int b) { a = (a * b) % MOD; }

signed main(){

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

  static int dp[N][N*N + N];
  //i個目まで見て、Rで塗った辺の長さがjとなる場合の数
  //一辺の値が(R+G+B)/2以上ならば三角形は作れない
  static int dp2[N][N*N + N];
  //2色に塗り分けたとき、i個目まで見て、Rで塗った辺の長さがj
  //R=G=(R+G+B)/2,B=0の重複カウントを取り除く
  dp[0][0] = 1;
  dp2[0][0] = 1;
  for(int i = 0; i < n; i++){
    for(int j = 0; j < N*N; j++){
      add(dp[i+1][j+a[i]], dp[i][j]);
      add(dp[i+1][j], dp[i][j] * 2);
      add(dp2[i+1][j+a[i]], dp2[i][j]);
      add(dp2[i+1][j], dp2[i][j]);
    }
  }


  int ans = 1;
  for(int i = 0; i < n; i++){
    mul(ans,3);
  }

  int ng = 0;
  for(int i = (sum+1)/2; i < N*N; i++){
    add(ng,dp[n][i]);
  }
  if(sum%2 == 0){
    add(ng,-dp2[n][sum/2]);
  }
  mul(ng,3);

  ans = (ans - ng + MOD) % MOD;
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 427008
N,M = list(map(int,input().split()))
d = {i+1:1 for i in range(N)}
isRed = {i+1:False for i in range(N)}

isRed[1] = True
for m in range(M):
  x,y = list(map(int,input().split()))
  d[x] -= 1
  d[y] += 1
  if isRed[x]:
    isRed[y] = True
  if d[x] == 0:
    isRed[x] = False
print(sum(isRed.values()))

Measured memory_bytes: 60772
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
using namespace std;
int cl(int a, int b) {
	return (a - (a%b)) / b;//b=0だと積む
}
int up(int a, int b) {
	return cl(a + b - 1, b);//b=0だと積む
}
int ord(int a, int p) {
	if (a%p == 0) {
		return ord(a / p, p) + 1;
	}
	else {
		return 0;
	}
}
int ruin(int a, int n, int p) {
	if (n == 0) {
		return (1%p);
	}
	else {
	int x = ruin(a, (n - (n % 2)) / 2, p);
		if (n % 2 == 0) {
			return (x*x) % p;
		}
		else {
			return (((x*x) % p)*a) % p;
			
		}
	
	}
	
}

int main() {
    int az=0;
    while(az==0){
    int r, c; int ans = 0;
	cin >> r >> c;
    if(r*r+c*c==0){
        az=1;
    }
    else{
	vector<vector<int> > a(r, vector<int>(c));
	vector<int> kos(c, 0);
	vector<int> kosq(c, 0);
	for (int i = 0; i < r; i++) {
		for (int j = 0; j < c; j++) {
			cin >> a[i][j];
			kos[j] = kos[j] + a[i][j];
		}
	}
	kosq = kos;
	if (r == 1) {
		cout << 0<<endl;
	}
	else {
		int lo = ruin(2,r - 1,100000) - 1;
		vector<vector<int> >gr(r - 1, vector<int>(lo));
		gr[0][0] = 0;
		int rui = 1;
		for (int big = 1; big < r - 1; big++) {
			rui = rui * 2 + 1; 
			for (int i = 0; i < rui; i++) {
				if (i < (rui - 1) / 2) {
					gr[big][i] = gr[big - 1][i];
				}
				else if (i == (rui - 1) / 2) {
					gr[big][i] = big;
				}
				else {
					gr[big][i] = gr[big-1][rui - 1 - i];
				}
			}
		}
		vector<int> d(lo);
		d = gr[r - 2];
		int ba = 0;
		for (int i = 0; i < c; i++) {
			ba = ba + max(kos[i], r - kos[i]);
    	}
		ans = ba;
		for (int i = 0; i < lo; i++) {
			int x = d[i];
			for (int j = 0; j < c; j++) {
				a[x][j] = 1 - a[x][j];
				kosq[j] = kos[j] + (-1 + a[x][j] * 2);
				ba = ba + (max(kosq[j], r - kosq[j]) - max(kos[j], r - kos[j]));
			}
			kos = kosq;
			ans = max(ans, ba);
		}
	}
	cout <<  ans<<endl;
    }
    }
	return 0;
}



Measured memory_bytes: 3496
#include <bits/stdc++.h>
using namespace std;
#define lli long long int
#define mod 1000000007
#define pb emplace_back
#define endl "\n"
#define fastio ios_base::sync_with_stdio(0); cin.tie(0)
 
lli ans;
 
lli dfs(lli v, vector<vector<lli> > &edges, vector<lli> &dist, vector<bool> &visited){
	visited[v] = true;
	lli val = 0;
	for(auto x:edges[v]){
		if(visited[x]){
			val = max(val, dist[x]+1);
		}else{
			val = max(dfs(x, edges, dist, visited), val);
		}
	}
	dist[v] = val;
	ans = max(ans, dist[v]);
	return val+1;
}
 
int main(){
    fastio;
     
	lli n, m; cin >> n >> m;
	vector<lli> dist(n+1, -1);
	vector<vector<lli> > edges(n+1);
	ans = 0;
	
	for(int i=0; i<m; i++){
		lli u, v; cin >> u >> v;
		edges[u].pb(v);
	}
	
	vector<bool> visited(n+1, false);
	for(int i=1; i<=n ; i++){
		if(!visited[i]){
			//cout << i << " ";
			dfs(i, edges, dist, visited);
		}
	}
	//cout << endl;
	
	cout << ans << endl;
    return 0;
}

Measured memory_bytes: 9984
#include <iostream>
#include <algorithm>

using namespace std;

int money[20];

int pow(int x, int n) {
	if (n == 0) {
		return 1;
	}
	int res = pow(x * x, n / 2);
	if (n & 1) {
		res *= x;
	}
	return res;
}

int f(int n, int x) {
	int res = 0;
	int i = 0;
	while (pow(x, i) <= 100000) {
		i++;
	}
	while (i >= 0 || n > 0) {
		res += n / pow(x, i);
		n %= pow(x, i);
		i--;
	}
	return res;
}

int main() {
	int N;
	cin >> N;
	int sum = 1 << 30;
	for (int i = 0; i <= N; i++) {
		sum = min(sum, f(i, 6) + f(N - i, 9));
	}
	cout << sum << endl;
	
	//system("pause");
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main()
{
    int a,b,c;
    cin>>a>>b>>c;
    if((a==5 && b==5 && c==7)||(a==7 && b==5 && c==5)|| (a==5 && b==7 && c==5))
    {
        cout<<"YES"<<endl;
    }
    else
    {
        cout<<"NO"<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
using namespace std;
 
int main() {
    int a,b;
    int result;
    cin >> a >> b;
    if(((a/10)>=1)||(((b/10)>=1))){
        result = -1;
    }
    else{
        result = a*b;
    }
    cout << result << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define ff first
#define ss second
#define quick                    \
    ios::sync_with_stdio(false); \
    cin.tie(0);
#define time cerr << (0.1 * clock()) / CLOCKS_PER_SEC << endl;
#define mod 1000000007
typedef long long ll;
typedef pair<ll, ll> pl;
#define forn(n) for (ll i = 0; i < ll(n); i++)

const ll MAXI = 1000000000000001ll;

void solve() {
    ll n;
    cin >> n;
    vector<ll> v;
    v.push_back(26);
    vector<ll> gr;
    ll curr = 26;
    gr.pb(26);
    while (curr < MAXI) {
        curr *= 26;
        gr.push_back(curr + gr[gr.size() - 1]);
        v.push_back(curr);
    }
    int si = v.size() - 1;
    bool ok = false;
    while (n > 0 and si >= 0) {
        if (si == 0) {
            cout << (char)('a' + n - 1) << '\n';
            return;
        }
        if (n > gr[si - 1]) {
            char a = 'a';
            n -= v[si - 1];
            while (n > gr[si - 1]) {
                a++;
                n -= v[si - 1];
            }
            cout << (char)a;
            ok = true;
            si--;
            continue;
        } else {
            if (ok == true) {
                cout << 'z';
            }
            si--;
            continue;
        }
    }
}

int main() {
    quick;
    solve();
    // ll t;
    // cin >> t;
    // while (t--) {
    //     solve();
    // }
}

Measured memory_bytes: 3652
N = int(input())
s = []
s = [input() for i in range(N)]
count = 0
a = []
sortdict = {}
for i in range(N):
    a = str(sorted(s[i]))
    if a in sortdict:
        sortdict[a] += 1
    else:
        sortdict[a] = 0
sort_list = list(sortdict.values())
for i in range(len(sort_list)):
    sort_list[i] = int((sort_list[i])*(sort_list[i] + 1)/2)
 

print(sum(sort_list))

Measured memory_bytes: 29200