akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication25 {
    class Program {
        static void Main(string[] args) {
            string s = Console.ReadLine();
            var result = Method(s);
            Console.WriteLine(result);
        }

        private static string Method(string s) {

            string result = "";

            result = s.Replace(",", " ");

            return result;
        }
    }
}


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

int main() {
  int N , K, r=0;
  cin >> N >> K;
  
  for (int i = N; i <= K; i++) {
  	int s = i % 10, t = i / 10000 % 10;
    int u = i / 10 % 10, v = i / 1000 % 10;
    
    if (s==t && u==v){
    	r++;
    }
  }
  cout << r << endl;
}

Measured memory_bytes: 256
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import array
from bisect import *
from collections import *
import fractions
import heapq
from itertools import *
import math
import random
import re
import string
import sys

N = int(input())
As = list(map(int, input().split()))

order = []
for i, a in enumerate(As):
    order.append((a, i + 1))
order.sort()

ans = [x[1] for x in order]
print(*ans)




Measured memory_bytes: 23236
#include<iostream>
#include<string>
#include<cmath>
#include<vector>
#include<algorithm>
#include<cstring>
#include<cctype>
 
using namespace std;

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<ll> vll;

const int INF = 1e9 + 7;
const int MOD = 1e9 + 7;
const int MAXN = 1e6 + 3;

#define sort_all(v) sort(v.begin(), v.end())
#define fill(a) memset(a, 0, sizeof(a))

#define FOR(i, a, b) for(int i = a; i < b; i++)
#define FOR_REV(i, a ,b) for(int i = a; i >= b; i--)
#define REP(i, n) FOR(i, 0, n)


void test() {
    int64_t D, T, S;
    cin >> D >> T >> S;
    printf("%s", (T * S >= D) ? "Yes" : "No");
}   
 
int main ()     
{
    // int t;
    // cin >> t;
    // while(t--) 
        test();
}


Measured memory_bytes: 3760
fun main(args:Array<String>):Unit {
    val n = readLine()!!.toInt()
    val minSegmentTree = MinSegmentTree(n)
    val maxSegmentTree = MaxSegmentTree(n)
    readLine()!!.split(' ').map(String::toInt).forEachIndexed{index, i ->
        minSegmentTree[index] = i
        maxSegmentTree[index] = i
    }
    repeat(readLine()!!.toInt()){
        val (c, from, to) = readLine()!!.split(' ').map(String::toInt)
        println(when(c){
            0 -> minSegmentTree[from, to - 1]
            else -> maxSegmentTree[from, to - 1]
        })
    }

}
abstract class SegmentTree<T>(val size:Int, private val mArray:Array<Array<T>>, private val mZero:T){
    protected abstract fun accumulate(a:T, b:T):T
    operator fun set(index:Int, value:T):Unit {
        mArray[0][index] = value
        var pos = index / 2
        for (i in 1 until mArray.size){
            mArray[i][pos] = mArray[i - 1][pos * 2]
            if ((pos * 2 + 1) in mArray[i - 1].indices)
                mArray[i][pos] = accumulate(mArray[i][pos], mArray[i - 1][pos * 2 + 1])
            pos /= 2
        }
    }
    operator fun get(from:Int, to:Int):T{
        var res = mZero
        var left = from
        var right = to
        for (i in 0 until mArray.size){
            if (left % 2 == 1)
                res = accumulate(res, mArray[i][left])
            if (right % 2 == 0)
                res = accumulate(res, mArray[i][right])
            if (left == right) return res
            left = (left + 1) / 2
            right = (right - 1) / 2
            if (left > right) return res
        }
        return res
    }
    companion object {
        inline fun <reified T> Int.to2D(default: T):Array<Array<T>> {
            var size = this
            var count = 1
            while(size != 1){
                ++count
                size = (size + 1) / 2
            }
            val res = Array(count){Array(0){default}}
            size = this
            res[0] = Array(this){default}
            count = 0
            while (size != 1){
                size = (size + 1) / 2
                res[++count] = Array(size){default}
            }
            return res
        }
    }
}
class MaxSegmentTree private constructor (size:Int, array:Array<Array<Int>>):SegmentTree<Int>(size, array, Int.MIN_VALUE){
    companion object {
        operator fun invoke(size:Int):MaxSegmentTree {
            return MaxSegmentTree(size, size.to2D(Int.MIN_VALUE))
        }
    }
    override fun accumulate(a: Int, b: Int): Int {
        return if(a > b) a else b
    }
}

class MinSegmentTree private constructor (size:Int, array:Array<Array<Int>>):SegmentTree<Int>(size, array, Int.MAX_VALUE){
    companion object {
        operator fun invoke(size:Int):MinSegmentTree{
            return MinSegmentTree(size, size.to2D(Int.MAX_VALUE))
        }
    }
    override fun accumulate(a: Int, b: Int): Int {
        return if(a > b) b else a
    }

}



Measured memory_bytes: 34524
N,x = map(int,input().rstrip().split(" "))
ans = 0
A = list(map(int,input().rstrip().split(" ")))
if A[0] > x:
    ans += A[0] - x
    A[0] = x
for i in range(N -1):
    k = max(A[i] + A[i + 1] - x,0)
    ans += k
    A[i+1] -= k
print(ans)

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

using namespace std;

typedef long long ll;

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    while(1){
        c-=b;
        if(c<=0)
            return cout << "Yes", 0;
        a-=d;
        if(a<=0)
            return cout << "No", 0;
    }
    return 0;
}



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

int main() {
    int N; cin >> N;
    vector<int> a(N);
    vector<int> b(N);
    REP(i,N) {
        cin >> a[i];
        b[a[i]-1] = i;
    }
    set<int> S; S.insert(N);
    set<int> T; T.insert(1);
    ll ans = 0;
    REP(i,N) {
        int itr1 = *S.lower_bound(b[i]); //cout << itr1 << " ";
        int itr2 = -(*T.lower_bound(-b[i])); //cout << itr2 << endl;
        ans += (ll)(i+1)*(itr1-b[i])*(b[i]-itr2);
        S.insert(b[i]);
        T.insert(-b[i]);
    }
    cout << ans << endl;
}

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

using namespace std;

int main(void)
{
	int n,x;
	cin >> n >> x;
	int m[n];

	int sum = 0;

	for(int i=1;i<=n;i++)
	{
		cin >> m[i-1];
		sum += m[i-1];
	}

	sort(m,m+n);

	cout << n+(x-sum)/m[0] << endl;
}

Measured memory_bytes: 256
#pragma target("avx2")
#pragma optimize("O3")
#pragma optimize("unroll-loops")
#include<stdio.h>
#include<stdbool.h>

int main(void){
        char s[10];
        int l = 0, i, cnt = 0;
        bool ok = true;
        while((s[l]=getchar())!='\n') l++;
        for(i=0; i<l; i++){
                if('a'<=s[i] && s[i]<='z') cnt++;
                else if(s[i]=='C') ok &= (1<i && i<l-1);
                else if(s[i]=='A') ok &= (i==0);
                else ok = false;
        }
        if(ok && cnt==l-2) puts("AC");
        else puts("WA");
        return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define repr(i,n) for(int i = (int)(n); i >= 0; i--)
#define all(v) v.begin(),v.end()
typedef long long ll;

int main(){
    ll N;
    cin >> N;
    vector<ll> A(N);
    rep(i,N){
        cin >> A[i];
    }
    ll now_min = A[0];
    ll ans = 0;
    rep(i,N){
        if (A[i] < now_min){
            ans += now_min - A[i];
        }
        else{
            now_min = A[i];
        }
    }
    cout << ans << endl;
}

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

//typedef
//------------------------------------------
typedef long long LL;
typedef vector<LL> VL;
typedef vector<VL> VVL;
typedef vector<string> VS;
typedef pair<LL, LL> PLL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int MOD = 1000000007;

// grid
//--------------------------------------------
VL dx = {0, 1, 0, -1};
VL dy = {1, 0, -1, 0};
VL dx2 = {-1, 0, 1, -1, 1, -1, 0, 1};
VL dy2 = {-1, -1, -1, 0, 0, 1, 1, 1};

//debug
//--------------------------------------------
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

//IO accelerate
//--------------------------------------------
struct InitIO {
    InitIO() {
        cin.tie(nullptr);
        ios_base::sync_with_stdio(false);
        cout << fixed << setprecision(30);
    }
} init_io;

//template
//--------------------------------------------
template<typename T>
istream& operator >>(istream& is, vector<T>& vec) {
  for(T& x: vec) is >> x;
  return is;
}
template<typename T>
ostream& operator <<(ostream& os, const vector<T>& vec) {
  for(int i=0; i<vec.size(); i++){
    os << vec[i] << ( i+1 == vec.size() ? "" : "\t" );
  }
  return os;
}
template<typename T>
ostream& operator <<(ostream& s, const vector<vector<T>>& vv) {
	for (int i = 0; i < vv.size(); ++i) {
		s << vv[i] << endl;
	}
	return s;
}

//main code
int main(int argc, char const* argv[])
{
	int n,m;
	cin >> n >> m;
	VL k(m), p(m), s(m,0);

	for (int i = 0; i < m; i++) {
		cin >> k[i];
		for (int j = 0; j < k[i]; j++) {
			int a;
			cin >> a;
			s[i] += (1<<(a-1));
		}
	}
	cin >> p;

	LL ans = 0;
	for (int on = 0; on < (1<<n); on++) {
		bool ok = true;
		for (int light = 0; light < m; light++) {
			int num = 0;
			for (int i = 0; i < n; i++) {
				if (on&(1<<i) and s[light]&(1<<i)) {
					// 両方ついてる
					num++;
				}
			}
			if (num%2 != p[light]) {
				ok = false;
			}
		}
		if (ok) {
			ans++;
		}
	}
	cout << ans << endl;
	return 0;
}



Measured memory_bytes: 256
using System;
using System.IO;
using System.Linq;
using System.Collections.Generic;

public class Program
{

    public void Proc()
    {
        System.Text.StringBuilder ans = new System.Text.StringBuilder();
        while(true) {
            string inpt = Reader.ReadLine();
            if(inpt == null) {
                break;
            }
            long[] tmp = inpt.Split(' ').Select(a => long.Parse(a)).ToArray();
            long gcd = GetGCD(tmp[0], tmp[1]);
            long lcm = tmp[0] / gcd * tmp[1];
            ans.AppendLine(gcd + " " + lcm);
        }
        Console.Write(ans.ToString());
    }


    private long GetGCD(long num1, long num2) {
        if(num1 % num2 == 0) {
            return num2;
        }
        return GetGCD(num2, num1 % num2);
    }

    public class Reader
	{
		private static StringReader sr;
		public static bool IsDebug = false;
		public static string ReadLine()
		{
			if (IsDebug)
			{
				if (sr == null)
				{
					sr = new StringReader(InputText.Trim());
				}
				return sr.ReadLine();
			}
			else
			{
				return Console.ReadLine();
			}
		}
		private static string InputText = @"



8 6
50000000 30000000



";
	}

	public static void Main(string[] args)
	{
#if DEBUG
		Reader.IsDebug = true;
#endif
		Program prg = new Program();
		prg.Proc();
	}
}

Measured memory_bytes: 9384
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>

#include <iostream>
#include <complex>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>

#include <functional>
#include <cassert>

typedef long long ll;
using namespace std;

#define debug(x) cerr << __LINE__ << " : " << #x << " = " << (x) << endl;

#define mod 1000000007 //1e9+7(prime number)
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define SIZE 100010

vector<int> way[SIZE];
int point[SIZE];
int ans = -INF;

pair<pair<int,int>,int> dfs(int now, int back = -1){
  vector<int> vec, vec2;
  int sum = 0;
  
  for(int i=0;i<way[now].size();i++){
    if(way[now][i] == back) continue;
    auto p = dfs(way[now][i], now);
    vec.push_back(p.first.first - p.first.second);
    vec2.push_back(p.second - p.first.second);
    sum += p.first.second;
  }

  vec.push_back(0);
  vec.push_back(0);
  vec2.push_back(0);
  sort(vec.begin(), vec.end(), greater<int>());
  sort(vec2.begin(), vec2.end(), greater<int>());

  ans = max(ans, sum + vec[0] + vec[1] + point[now]);
  ans = max(ans, sum + vec2[0] + point[now]);
  
  return {{max(0, sum + vec[0] + point[now] - 1), max(0, sum + point[now] - 2)},
      max({0, sum + vec[0] + vec[1] + point[now] - 2, sum + vec2[0] + point[now] - 2})};
}

int main(){
  int n;

  scanf("%d", &n);
  
  for(int i=0;i<n;i++){
    scanf("%d", point+i);
  }

  for(int i=0;i<n-1;i++){
    int a, b;
    scanf("%d%d", &a, &b);
    a--; b--;
    way[a].push_back(b);
    way[b].push_back(a);
  }

  dfs(0);

  printf("%d\n", ans);
  
  return 0;
}



Measured memory_bytes: 29452
S = '>' + input() + '<='
l = len(S)
A = [0] * (l-2)
zero_posi = []
max_posi = []

for i in range(l-2):
    now = S[i]
    nex = S[i+1]
    if S[i] == '>' and S[i+1] =='<':
        A[i] = 0
        zero_posi.append(i)

while zero_posi:
    start = zero_posi.pop()
    count = 0
    for i in range(start, -1, -1):
        A[i] = max(A[i], count)
        count += 1
        if S[i-1] == '<':
            A[i-1] = max(A[i], count)
            break

    count = 0
    for i in range(start, l-2):
        A[i] = max(A[i], count)
        count += 1
        if S[i + 1] == '>':
            break

ans = sum(A)
print(ans)

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

int main(){
  int n;
  cin >> n;
  vector<int> x(n);
  rep(i,n) cin >> x[i];
  int ans = 1001001001;
  for (int p = 1; p <= 100; p++){
    int now = 0;
    rep(i,n) now += (x[i]-p)*(x[i]-p);
    ans = min(ans, now);
  }
  cout << ans << endl;  
  return 0;
}

Measured memory_bytes: 256
//*
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <time.h>
#include <stdlib.h>
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <string>
#include <numeric>
#include <functional>
#define MOD 1000000007
#define MAX 0x3f3f3f3f
#define MAX2 0x3f3f3f3f3f3f3f3fll
#define ERR 1e-10
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#pragma warning(disable:4996)
using namespace std;

typedef long long ll;
typedef long double ldb;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;

int n, x;
int a[300000];

int main()
{
	int i, j, k, l;
	cin>>n>>x;
	for(i=0;i<n;i++) scanf("%d", &a[i]);
	ll ans=0;
	for(i=0;i<n-1;i++)
	{
		if(a[i]+a[i+1] > x)
		{
			if(a[i] > x)
			{
				ans+=a[i+1];
				ans+=a[i]-x;
				a[i+1]=0;
				a[i]=x;
			}
			else
			{
				ll u=a[i+1]+a[i]-x;
				ans+=a[i+1]+a[i]-x;
				a[i+1]-=u;
			}
		}
	}
	cout<<ans<<endl;
	return 0;
}
//*/

Measured memory_bytes: 764
#include <iostream>
#include <vector>
#include <algorithm>
#include <climits>

using namespace std;

/*
再帰関数での全探索
bit全探索(2^n通り)
*/

void many_equals();

void train_ticket();

void all_green();

int main()
{
  //many_equals();
  //train_ticket();
  all_green();

}


void many_equals()
{
  string S;
  cin >> S;
  vector<int> a(S.size());

  for (int i = 0; i < S.size(); ++i)
  {
    a[i] = S[i] - '0';
  }

  cout << (1 << (S.size() - 1)) << "\n";;

  long long int n_sum = 0;
  for (int i = 0; i < 1 << (S.size() - 1); ++i)
  {
    //cout << i << "\n";
    long long int tmp = a[0];
    for (int p = 0; p < S.size() - 1; ++p)
    {
      //p left shift先にあれば
      if (i & 1 << p)
      {
        n_sum += tmp;
        tmp = a[p + 1];
      }
      else
      {
        tmp = tmp * 10 + a[p + 1];
      }
    }
    n_sum += tmp;
  }

  cout << n_sum << "\n";
}

void train_ticket()
{
  string abcd;
  cin >> abcd;
  vector<int> a(abcd.size());
  for (int i = 0; i < abcd.size(); ++i)
  {
    a[i] = abcd[i] - '0';
  }

  vector<char> sign(3);

  for (int i = 0; i < 1 << (abcd.size() - 1); ++i)
  {
    int v_sum = a[0];
    for (int j = 0; j < abcd.size() - 1; ++j)
    {
      if (i & 1 << j)
      {
        v_sum += a[j + 1];
        sign[j] = '+';
      }
      else
      {
        v_sum -= a[j + 1];
        sign[j] = '-';
      }
    }
    //iの位置は+,それ以外は-を行う判定
    if (v_sum == 7)
    {
      for (int k = 0; k < 3; ++k)
      {
        cout << abcd[k] << sign[k];
      }
      cout << abcd[3] << "=7\n";

      return;
    }
  }
}

void all_green()
{
  int D, G;
  cin >> D >> G;
  vector<pair<int, int>> p_c(D);
  for (int i = 0; i < p_c.size(); ++i)
  {
    cin >> p_c[i].first >> p_c[i].second;
  }

  int ans = INT_MAX;
  for (int bit = 0; bit < (1 << p_c.size()); ++bit)
  {
    int s = 0, cnt = 0, rest_max = -1;
    for (int i = 0; i < p_c.size(); ++i)
    {
      if (bit & 1 << i)
      {
        s += 100 * (i + 1) * p_c[i].first + p_c[i].second;
        cnt += p_c[i].first;
      }
      else
      {
        rest_max = i;
      }
    }

    if (s < G)
    {
      int s1 = 100 * (rest_max + 1);
      // ピッタリの個数ずらし
      int need = (G - s - 1) / s1 + 1;
      if (need >= p_c[rest_max].first) continue;
      cnt += need;
    }
    ans = min(ans, cnt);
  }
  cout << ans << "\n";
}

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

int main()
{
  int n;
  for(;cin>>n;)
    {
      int data[n];
      int dmax=0;
      for(int i=0;i<n;i++)
	{
	  cin>>data[i];
	  dmax=max(dmax,data[i]);
	}
      for(int i=1;i<=dmax/2;i++)
	{
	  bool flag=true;
	  for(int j=0;j<n;j++)
	    {
	      if(data[j]%i!=0)
		{
		  flag=false;
		  break;
		}
	    }
	  if(flag)
	    cout<<i<<endl;
	}
    }
}

Measured memory_bytes: 1160
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <math.h>
#define MOD 1000000007
typedef long long ll;
using namespace std;

int main(){
  ll n;
  cin>>n;
  ll tmp=0,m=n;
  for(int i=1;m>0;i++){
    tmp+=m%10;
    m/=10;
  }
  if(n%tmp==0){
    cout<<"Yes"<<endl;
  }else{
    cout<<"No"<<endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <unordered_map>
 
using namespace std;
 
int v,e;
unordered_map<int,unordered_map<int,int> > g;
 
int dfs(int pos, int flow, unordered_map<int,bool> &arrived) {
    if(pos==v-1) return flow;
    arrived[pos] = true;
    for(pair<int,int> p : g[pos]) {
        int next = p.first;
        int capacity = p.second;
        if(!arrived[next]&&capacity>0) {
            int res = dfs(next,min(flow,capacity),arrived);
            if(res>0) {
                g[pos][next] -= res;
                g[next][pos] += res;
                if(g[pos][next]<=0) g[pos].erase(next);
                return res;
            }
        }
    }
    return 0;
}
 
int main() {
    int x,y,e;
    cin >> x >> y >> e;
    v = x+y+2;
    for(int i = 0; i < e; i++) {
        int u,v2;
        cin >> u >> v2;
        g[u+1][v2+x+1] = 1;
    }
    for(int i = 0; i < x; i++) {
        g[0][1+i] = 1;
    }
    for(int i = 0; i < y; i++) {
        g[1+x+i][v-1] = 1;
    }
    int ans = 0;
    while(true) {
        unordered_map<int,bool> arrived(v);
        int flow = dfs(0,1<<30,arrived);
        if(flow<=0) break;
        else ans += flow;
    }
    cout << ans << endl;
}


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

typedef long long ll;
typedef long double lg;
using namespace std;


int main(){

 long long h,a;
 cin>>h>>a;

 if(h<a){
    cout<<"1"<<endl;
 return 0; }

 long long Q = h/a;

 long long number = Q*a;

 if(number >= h)
    cout<<Q<<endl;
 else if(number < h)
    cout<<Q+1<<endl;

return 0;
}

Measured memory_bytes: 3584
n = int(input())
A = list(map(int, input().split()))
C = [0 for _ in range(10000)]


def counting_sort(A, n, k):
    B = [0 for _ in range(n)]
    for i in range(n):
        C[A[i]] += 1

    for i in range(1, k):
        C[i] += C[i - 1]

    for i in range(n)[::-1]:
        C[A[i]] -= 1
        B[C[A[i]]] = A[i]

    return B


print(*counting_sort(A, n, 10000))



Measured memory_bytes: 224544
#include<bits/stdc++.h>
using namespace std;
const int maxn = 5e2 + 10;
int h, w, a[maxn][maxn];
int mx[maxn];
string s[maxn];
int main() {
	cin >> h >> w;
	for(int i = 0; i < h; i++) {
		cin >> s[i];
	}
	for(int i = 0; i < h; i++) {
		for(int j = 0; j < w; j++) {
			if(i == 0)
				cout << '.';
			else if( i== h - 1)
				cout << '#';
			else {
				if(j % 2 == 0)
					cout << "#";
				else 
					cout << s[i][j];
			}
		}cout << endl;
	}
	cout << endl;
	for(int i = 0; i < h; i++) {
		for(int j = 0; j < w; j++) {
			if(i == 0)
				cout << '#';
			else if( i== h - 1)
				cout << '.';
			else {
				if(j % 2 == 1)
					cout << "#";
				else 
					cout << s[i][j];
			}
		}cout << endl;
	}
}

Measured memory_bytes: 1024
N, M, C = map(int, input().split())
B = list(map(int, input().split()))
ans = 0
for i in range(N):
    A = list(map(int, input().split()))
    n = 0
    for j in range(M):
        n += A[j] * B[j]
    if n + C > 0: ans += 1
print(ans)


Measured memory_bytes: 3060
#include <stdio.h>

int main(){
  int S[] = {1,1,1,2,1,2,1,5,2,2,1,5,1,2,1,14,1,5,1,5,2,2,1,15,2,2,5,4,1,4,1,51};
  int K;
  
  scanf("%d",&K);
  
  printf("%d\n",S[K-1]);
  
  return 0;
  
}

Measured memory_bytes: 128
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = Integer.parseInt(sc.next());
		String[] s1 = sc.next().split("");
		String[] s2 = sc.next().split("");
		
		
		String ans = "";
		for(int i = 0 ; i < n; i++) {
			
			ans += s1[i];
			ans += s2[i];
		}
		
		
		System.out.println(ans);
		
	}



}


Measured memory_bytes: 21844
fun main(args: Array<String>) {
  val N = readLine()!!.toInt()
  val words = (1..N).map{readLine()!!.toString()}.toList()
  if(judgeDuplicate(words)){
    println("No")
    return
  }

  if(judgeShiritori(words, N)){
    println("Yes")
    return
  }
    println("No")

}

fun judgeDuplicate(words: List<String>): Boolean{
  return words.any{word ->
    words.filter{it == word}.size >= 2
  }
}

fun judgeShiritori(words: List<String>, N: Int): Boolean{
  return (0 .. N - 2).all{index ->
      words[index].takeLast(1) == words[index + 1].take(1)
    }
}

Measured memory_bytes: 31896
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int,int>;

bool has_divisor(int N, int i) {
if (i == N) {
  return false;
}
if (N % i == 0) {
return true;
}
return has_divisor(N, i + 1);
}
 bool is_prime(int N) {
if (N == 1) {
return false;
}
else if (N == 2) {
return true;
}
else {
return !has_divisor(N, 2);
}
}



int main(){
    int N;
    cin >> N;
    for(int i=N;;i++){
        if(is_prime(i)){
            cout<<i<<endl;
            break;
        }

    ;}

    

return 0;


}  



Measured memory_bytes: 256
kr :: (Int -> Bool) -> [Int] -> Int -> [Int]
kr f [] _ = []
kr f [x] i = if f i then [x] else []
kr f (x:xs) i = (kr f [x] i) ++ (kr f xs (i+1))

main = do
    ns <- getLine
    ds <- getLine
    let n = read ns
    let d = map read $ words ds :: [Int]
    let f = (\x -> not $ x `elem` 0:[x*(n+1) | x <- [0..n-1]])
    print $ (sum $ kr f [x*y | x <- d, y<- d] 0) `div`2


Measured memory_bytes: 892
X = input()

s, t = 0, len(X)//2
cnt = 0
used = 0
for x in X:
    if x == 'S':
        s += 1
        if t-used > 0:
            cnt += 1
            used += 1
    else:
        used = max(0, used-1)
        t -= 1

print(len(X)-cnt*2)

Measured memory_bytes: 73628
#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());
  cout << v[N - 1] - v[0] << endl;
}


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

int main(){
  int b,r,g,c,s,t;

  while(cin >> b >> r >> g >> c >> s >> t){
    int m = 100; // _
    if(t == 0) return 0;
    // 777
    m += -3*b + 15*b + 5*b*13;
    t -= b + 5*b;
    // BAR
    m += -3*r + 15*r + 3*r*13;
    t -= r + 3*r;
    // Greap
    m += -3*g + 7*g;
    t -= g;
    // cherry
    m += -c;
    t -= c;
    // star
    m += -3*s;
    t -= 2*s; // 2ñ1ñ³¿
    // -play count
    m += -3*t;
	
    cout << m << endl;
  }

}

Measured memory_bytes: 0
import std.stdio;
import std.string;
import std.array;
import std.conv;
import std.algorithm;
import std.range;
import std.typecons;

void main() {
  uint[string] table;

  auto n = readln.chomp.to!uint;
  foreach (i;0..n) {
    auto key = readln.chomp;
    if (auto p = key in table) {
      ++*p;
    } else {
      table[key] = 1;
    }
  }
  table.rehash;

  auto keys = table.keys;
  auto comp = (Tuple!(string, uint) a, Tuple!(string, uint) b) {
    if (a[1] == b[1]) {
      return a[0] < b[0];
    }
    return a[1] > b[1];
  };
  auto z = zip(keys, keys.map!((a) => table[a])).array.sort!(comp);

  auto m = z.front[1];
  foreach (e;z) {
    if (e[1] < m) {
      break;
    }
    writeln(e[0]);
  }
}


Measured memory_bytes: 36168
#include <bits/stdc++.h>
using namespace std;
#define INF_LL 1LL << 40
#define INF 200000000
#define MOD 1000000007
#define ll long long
#define all(x) x.begin(), x.end()
#define REP(i, a, b) for(int i = a; i < b; i++)
#define rep(i, n) REP(i, 0, n)
// typedef float double;
// typedef priority_queue prique;
typedef pair<int, int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<P> vp;
typedef vector<ll> vl;
typedef vector<vi> matrix;
int dx[4] = {0, 1, 0, -1};
int dy[4] = {1, 0, -1, 0};
int sign[2] = {1, -1};
template <class T> bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T> bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return 1;
    }
    return 0;
}

ll modpow(ll a, ll b, ll m) {
    if(b == 0)
        return 1;
    ll t = modpow(a, b / 2, m);
    if(b & 1) {
        return (t * t % m) * a % m;
    } else {
        return t * t % m;
    }
}
struct edge {
    int to, cap, rev;
};

vector<edge> g[208];
bool used[208];

void add_edge(int from, int to, int cap) {
    g[from].push_back({to, cap, (int)g[to].size()});
    g[to].push_back({from, 0, (int)g[from].size() - 1});
}

int dfs(int v, int t, int f) {
    if(v == t)
        return f;
    used[v] = true;
    rep(i, g[v].size()) {
        edge &e = g[v][i];
        if(!used[e.to] && e.cap > 0) {
            int d = dfs(e.to, t, min(f, e.cap));
            if(d > 0) {
                e.cap -= d;
                g[e.to][e.rev].cap += d;
                return d;
            }
        }
    }
    return 0;
}

int max_flow(int s, int t) {
    int res = 0;
    while(1) {
        memset(used, false, sizeof(used));
        int f = dfs(s, t, INF);
        // cout << f << endl;
        if(f == 0)
            break;
        res += f;
    }
    return res;
}

signed main() {
    int h, w;
    cin >> h >> w;
    vector<string> a(h);
    rep(i, h) cin >> a[i];
    rep(i, h) rep(j, w) {
        if(a[i][j] == 'o') {
            add_edge(i + 1, h + j + 1, 1);
            add_edge(h + j + 1, i + 1, 1);
        } else if(a[i][j] == 'S') {
            add_edge(i + 1, h + j + 1, 1);
            add_edge(h + j + 1, i + 1, 1);
            add_edge(0, i + 1, INF);
            add_edge(0, h + j + 1, INF);
        } else if(a[i][j] == 'T') {
            add_edge(i + 1, h + j + 1, 1);
            add_edge(h + j + 1, i + 1, 1);
            add_edge(i + 1, h + w + 1, INF);
            add_edge(h + j + 1, h + w + 1, INF);
        }
    }
    int res = max_flow(0, h + w + 1);
    if(res >= INF) {
        cout << -1 << endl;
    } else {
        cout << res << endl;
    }
}


Measured memory_bytes: 896
#include <bits/stdc++.h>
#define BIT(n) (1LL << (n))
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPB(i, n) for (int i = 0; i < BIT(n); i++)
#define REPS(i, x) for (int i = 1; i <= (int)(x); i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define FORA(i, n) for (auto &&i : n)
#define FORS(i, m, n) for (int i = m; i <= n; i++)
#define DEBUG(x) cerr << #x << ": " << x << "\n"
#define ALL(v) v.begin(), v.end()
#define fst first
#define snd second
#define mp make_pair
#define pb push_back
#define epb emplace_back
#define int long long
using namespace std;
template < class T > using vec = std::vector< T >;
template < class T > void print(T &x) { cout << x << "\n"; }
typedef long long ll;
const int MOD = 1000000007;
const int INF = 1061109567;
const double EPS = 1e-10;
const double PI = acos(-1.0);
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
signed main() {
  cin.tie(0), ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  int K;
  cin >> K;
  cout << (K / 2) * ((K + 1) / 2) << "\n";
  // print();
}

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

using namespace std;

typedef long long ll;
typedef complex<double> P;

#define EPS (1e-10)
#define rep(i, n) for(int i = 0; i < n; i++)

double dist(P c1, P c2){
    return sqrt((c1.real()-c2.real())*(c1.real()-c2.real()) + (c1.imag()-c2.imag())*(c1.imag()-c2.imag()));
}

double dot(P c1, P c2){
    return c1.real()*c2.real() + c1.imag()*c2.imag();
}

double product(P c1, P c2){
    return c1.real()*c2.imag() - c1.imag()*c2.real();
}

double norm(P c){
    return sqrt(dot(c, c));
}

P intersection(P a1, P a2, P b1, P b2){
    P a = a2-a1, b = b2-b1;
    return a1 + a * (product(b, b1-a1) / product(b, a));
}

bool is_intersected(P a1, P a2, P b1, P b2){
    return ( product(a2-a1, b1-a1) * product(a2-a1, b2-a1) < EPS) && (product(b2-b1, a1-b1) * product(b2-b1, a2-b1) < EPS);
}

P circum_coordinate(P a1, P a2, P a3){
    double px, py;
    double x1, y1, x2, y2, x3, y3;
    x1 = a1.real(); y1 = a1.imag();
    x2 = a2.real(); y2 = a2.imag();
    x3 = a3.real(); y3 = a3.imag();

    py = ((x3-x1)*(x1*x1 + y1*y1 - x2*x2 - y2*y2) - (x2-x1)*(x1*x1 + y1*y1 - x3*x3 - y3*y3))/((x3-x1)*(y1-y2)*2.0 - (x2-x1)*(y1-y3)*2.0);
    if(x2-x1 < EPS) px = ((y1-y3)*2.0*py - x1*x1 - y1*y1 + x3*x3 + y3*y3)/((x3-x1)*2.0);
    else px = ((y1-y2)*2.0*py - x1*x1 - y1*y1 + x2*x2 + y2*y2)/((x2-x1)*2.0);
    return P(px, py);
}

int main(void){
    int N; cin >> N;
    double ans = 2000.0;
    P CO[N];
    rep(i, N){
        double x, y; cin >> x >> y;
        CO[i] = P(x, y);
    }
    for(int i = 0; i < N; i++){
        P p1 = CO[i];
        for(int j = i+1; j < N; j++){
            P p2 = CO[j];
            P center = P((p1.real()+p2.real())/2, (p1.imag()+p2.imag())/2);
            double range = dist(p1, p2)/2;
            bool ok = true;

            for(int k = 0; k < N; k++){
                if(k == i || k == j) continue;
                if(dist(CO[k], center) > range + EPS) ok = false;
            }
            if(ok){
                ans = min(ans, range);
            }
        }
    }

    for(int i = 0; i < N; i++){
        P p1 = CO[i];
        for(int j = i+1; j < N; j++){
            P p2 = CO[j];
            for(int k = j+1; k < N; k++){
                P p3 = CO[k];
                //p1, p2, p3が同一直線上(すなわち外積0) -> continue
                if(abs(product(p2-p1, p3-p1)) < EPS){
                    continue;
                }
                P center = circum_coordinate(p1, p2, p3); //外接円の中心座標
                double range = dist(center, p3); //外接円の半径
                bool ok = true;
                for(int l = 0; l < N; l++){
                    if(l == i || l == j || l == k) continue;
                    if(dist(CO[l], center) > range) ok = false;
                }
                if(ok) ans = min(ans, range);
            }
        }
    }
    double res = ans;
    printf("%.10f\n", res);
}

Measured memory_bytes: 256
s = input()
k = int(input())
c = 0
if s[0] == '1':
  for i in range(len(s)):
    if s[i] != '1':
      if i >= k:
        print(1)
      else:
        print(s[i])
      break
    if i == len(s) - 1:
      print(1)
else:
  print(s[0])
  


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

void insertionSort(int a[], int n);
int main(void){
    int n, i;

    scanf("%d", &n);
    int a[n]; // a を宣言
    for(i=0; i<n;i++)
        scanf("%d", &a[i]);
    insertionSort(a,n);
    return 0;
}

void insertionSort(int a[], int n){
    int i, j, v;

    for(i=0; i<n; i++){
        v = a[i];
        j = i-1;
        while(j>=0 && a[j]>v){
            a[j+1] = a[j];
            j--;
        }
        a[j+1] = v;
        // 数列表示
        printf("%d", a[0]);
        for(j=1; j<n; j++)
            printf(" %d", a[j]);
        printf("\n");
    }
}


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

#define MAX 1001
#define max(a,b) a>b?a:b


int LCS(char x[],char y[]){
  int m=strlen(x),n=strlen(y),i,j,lcs[MAX][MAX];
  for(i=0;i<=m;i++)lcs[i][0]=0;
  for(i=1;i<=n;i++)lcs[0][i]=0;

  for(i=1;i<=m;i++){
	for(j=1;j<=n;j++){
  	if(x[i-1]==y[j-1])lcs[i][j]=lcs[i-1][j-1]+1;
  	else lcs[i][j]=max(lcs[i-1][j],lcs[i][j-1]);
	}
  }
  return lcs[m][n];
}

int main(){
  int n,i;
  char x[MAX],y[MAX];
  scanf("%d",&n);
  for(i=0;i<n;i++){
	scanf("%s%s",x,y);
	printf("%d\n",LCS(x,y));
  }
  return 0;
}



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

#define endl "\n"
#define INF (int) 9e18
#define HELL (int) (1e9 + 7)
#define int long long
#define double long double
#define uint unsigned long long
#define deb(x) cerr << #x << " => " << x << "\n"
#define deba(x) cerr << #x << "\n"; for (auto a : x) cerr << a << " "; cerr << "\n";
#define debm(x) cerr << #x << "\n"; for (auto a : x){for(auto b : a) cerr << b << " "; cerr << "\n";}
#define getMat(x, n, m, val) vector<vector<int>> x(n, vector<int> (m, val))
#define fastio ios_base :: sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
#define pout cout << fixed << setprecision(10)

int fastpow(int a, int b, int m) {
    int res = 1; a %= m; while (b > 0) {
        if (b & 1) res = (res * a) % m;
        a = (a * a) % m; b >>= 1;
    } return res;
}

int now() {
    return chrono::duration_cast<chrono::milliseconds>(chrono::system_clock::now()
    .time_since_epoch()).count();
}

void populate(int index, string s, int n, vector<string> &res, int m) {
    if (index == n + 1) {
        res.push_back(s);
        return;
    }
    for (int i = 0; i <= m + 1; i++) {
        s.push_back('a' + i);
        populate(index + 1, s, n, res, max(m, i));
        s.pop_back();
    }
}

int32_t main() { fastio;
    time_t start = now();

    int n;
    vector<string> res;

    cin >> n;
    populate(2, "a", n, res, 0);
    for (auto r : res) {
        cout << r << endl;
    }

    cerr << "TIME => " << now() - start << endl;
    return 0;
}

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

 int main() {
  long int n, a, b;
  cin >> n >> a >> b;
  long int ans;
  ans =  n/ (a+b);
  long int res;
  res = n - ans*(a+b);
  long int add = 0;
  if (res > a) {
    add = a;
  }else{
    add = res;
  }
  res = ans* a + add;
  cout << res << '\n';
 }


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

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

	if(b-a>0 && c-b>0) {
		cout << "Yes" << endl;
	} else {
		cout << "No" << endl;
	}
	return 0;
}

Measured memory_bytes: 1156
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0;i<(n);i++)
#define N 200000
#define INF 1000000000
typedef long long ll;
#define ALL(v) (v).begin(),(v).end()
#define SZ(x) int(x.size())
#define IN(a) cin>>(a)
#define OUT(a) cout<<(a)<<endl
typedef pair<int,int> P;
const int MAX = 1000000;
const int MOD = 1000000007;
int main(){
	string s;
    IN(s);
    if(s[2]==s[3]&&s[4]==s[5])OUT("Yes");
    else OUT("No");
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
  int K;
  cin >> K;
  int count =-1;
  
  int L;//setting of diviser 
  if(K%7 == 0) L = 9*(K/7);
  else L = 9*K;
  
  if( L%2 == 0 || L%5 == 0 ) cout << count << endl;
  else{
    int r = 10; //余りを格納する変数
    for(int i=1; i<9000000; i++){
      if( r%L == 1){
        count = i;
        break;
      }else {
        r = 10*(r%L);
      }
    }
  cout << count << endl;
  }
  
}

Measured memory_bytes: 3636
n = int(input())
a = [int(e) for e in input().split()]
b = [int(e) for e in input().split()]
result = 0
for i in range(n):
  if a[i] > b[i]:
    result += b[i]
    a[i] -= b[i]
    b[i] = 0
  else:
    result += a[i]
    b[i] -= a[i]
    a[i] = 0
    if a[i + 1] > b[i]:
      result += b[i]
      a[i + 1] -= b[i]
      b[i] = 0
    else:
      result += a[i + 1]
      b[i] -= a[i + 1]
      a[i + 1] = 0
print(result)

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

int main(void){
  int cd=0;
  char c;
  
  for (int i=0; i<3; i++){
    cin >> c;
    cd = (cd<<1) | (c=='R'?1:0);
  }
  cout << (cd["01121123"]) << endl;
  return 0;
}

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

using namespace std;
typedef long long ll;
const ll INF = 1e9;
 
int main(void) {
    string S, T;
    cin >> S >> T;
    int count = 0;
    for (int i = 0; i < 3; i++)
        if (S[i] == T[i])
            count++;
    cout << count << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
using namespace std;
#define INF 1000000007
#define ll long long
#define rep(i, start, end) for(ll i=(ll)start; i<(ll)end; i++)
#define print(a) cout << a << endl;
#define printarray(a, len) rep(i,0,len) cout << a[i] << " ";


int main(){
  cout << fixed << setprecision(10);
  ll n;
  double a, ans = 0;
  cin >> n;
  rep(i, 0, n) {
    cin >> a;
    ans += 1 / a;
  }
  
  print(double(1 / ans));
  
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define mp make_pair
#define vi vector<int>
#define vl vaector<long>
#define vll vector<long long int>
#define vC  vector<char>
#define FastIO ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define db(...) ZZ(#__VA_ARGS__, __VA_ARGS__)
ll pow(ll x, ll y,ll m) { ll res = 1;x=x%m; while (y > 0) { if (y & 1) res = ((res%m) * (x%m))%m; y = y >> 1; x = ((x%m) * (x%m))%m; } return res%m; }
template <typename Arg1> void ZZ(const char* name, Arg1&& arg1){std::cerr << name << " = " << arg1 << endl;}
template <typename Arg1, typename... Args>void ZZ(const char* names, Arg1&& arg1, Args&&... args)
{
	const char* comma = strchr(names + 1, ',');
	std::cerr.write(names, comma - names) << " = " << arg1;
	ZZ(comma, args...);
}
const ll INF = 0xFFFFFFFFFFFFFFFL;
clock_t time_p=clock();
void abhigyan10()
{time_p=clock()-time_p;cerr<<"Time Taken : "<<(float)(time_p)/CLOCKS_PER_SEC<<"\n";}
ll seed;
mt19937 rng(seed=chrono::steady_clock::now().time_since_epoch().count());
inline ll rnd(ll l=0,ll r=INF){return uniform_int_distribution<ll>(l,r)(rng);}
#define clrbuf cin.ignore(numeric_limits<streamsize>::max(),'\n');
#define preciset(x) cout<<setprecision(x)<<fixed;
const ll mod =1000000007;
int main()
{
   
        FastIO

        int n,x,flag=0;
        cin>>n;

        while(n--)
        {
        	cin>>x;
        	if(x&1)
        		continue;
        	else if(x%3==0 || x%5==0)
        		continue;
        	else
        		flag=-1;
        }
        if(flag==-1)
        	cout<<"DENIED";
        else
        	cout<<"APPROVED";
        return 0;

    }

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(ll i=0;i<(n);i++)
#define rrep(i,n) for(ll i = 1; i <= (n); ++i)
#define drep(i,n) for(ll i = (n)-1; i >= 0; --i)
#define all(v) v.begin(),v.end()
#define len(x) (ll)(x).length()
#define maxs(x,y) x = max(x,y)
#define mins(x,y) x = min(x,y)
#define pb push_back
#define sz(x) (ll)(x).size()
#define v(T) vector<T>
#define vv(T) vector<vector<T>>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
ll gcd(ll a,ll b){if(a%b==0){return b;}else{return(gcd(b,a%b));}}
ll lcm(ll a,ll b){return a*b/gcd(a,b);}
const int INF=1e9;
const ll MX = 1e18;
const int MOD=INF+7;
const int di[] = {-1,0,1,0};
const int dj[] = {0,-1,0,1};
const double PI=acos(-1);

int main() {
  ll a,b,k;
  cin>>a>>b>>k;
  if(a>k){
    a-=k;
    cout<<a<<" "<<b<<endl;
    return 0;
  }
  if(a<=k&&a+b>k){
    b-=(k-a);
    a=0;
    cout<<a<<" "<<b<<endl;
    return 0;
  }
  if(a+b<=k){
    a=0;b=0;
  }
  cout<<a<<" "<<b<<endl;
}

Measured memory_bytes: 3644
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define FOR(i,a,b) for(int i=(a); i<(b); i++)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
typedef long long ll;
int main(){
    int n,t; cin >> n >> t;
    vector<int> a(n);
    rep(i,n) cin >> a[i];
    int mini = 1e9+7;
    int diff_maxi = -1e9-7;
    int ans = 0;
    rep(i,n-1){
        mini = min(mini, a[i]);
        int diff = a[i+1] - mini;
        if(diff_maxi < diff){
            ans = 1;
            diff_maxi = diff;
        }
        else if(diff_maxi == diff) ans++;
    }
    cout << ans << endl;
}



Measured memory_bytes: 640
from collections import defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue,copy,time
import numpy as np
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_str(): return list(sys.stdin.readline().split())

ans = 0
H, W = map(int, input().split())

si, sj = 0, 0
gi, gj = H-1, W-1

field = [list(input()) for _ in range(H)]


di = [1, 0, -1, 0]
dj = [0, 1, 0, -1]

dis = [[INF]*W for _ in range(H)]
dis[si][sj] = 0

dq = deque([])
dq.append([si,sj])

while dq:
    p = dq.popleft()
    if p[0] == gi and p[1] == gj:
        break
    for i in range(4):
        ni = p[0] + di[i]
        nj = p[1] + dj[i]
        if 0 <= ni < H and 0 <= nj < W and field[ni][nj] != '#' and dis[ni][nj] == INF:
            dq.append([ni,nj])
            dis[ni][nj] = dis[p[0]][p[1]]+1

path_length = dis[gi][gj]
shiro = 0
for i in range(H):
    for j in range(W):
        if field[i][j] == '.':
            shiro += 1

if path_length != INF:
    ans = shiro - path_length - 1
else:
    ans = -1
print(ans)

Measured memory_bytes: 13116
from collections import Counter

N = int(input())
S = [input() for i in range(N)]
Sc = Counter(S)
Sc1 = Sc.most_common()
#print(Sc1)
m = Sc1[0][1]
ans = []
for s in Sc1:
    if s[1] == m:
        ans.append(s[0])
ans.sort()
for a in ans:
    print(a)


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

#define mod 1000000007
using ll = long long;

int main(){

	int n;
	cin >> n;
	vector<ll> a(n);
	ll sum=0;
	for(int i=0;i<n;i++){ 
		cin >> a[i];
		sum=(sum+a[i])%mod;
	}
	
	ll ans=0;
	for(int i=0;i<n-1;i++){
		sum=sum-a[i];
		sum=(sum+mod)%mod;
		ans=(ans+(a[i]*sum)%mod)%mod;
	}

	cout << ans << endl;

}


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

int main() {
  int N; cin >> N;
  vector<int> order(N);
  for (int i = 1; i <= N; i++) {
    int stu; cin >> stu;
    order[stu-1] = i; 
  }
  for (int i = 0; i < N; i++) {
    if (i) cout << " " << flush;
    cout << order[i] << flush;
  }
  cout << endl;
  return 0;
}

Measured memory_bytes: 1152
#include <cstdio>
using namespace std;
int main(){
  int N;
  scanf("%d",&N);
  int s=0,n=N;
  for(int i=0;i<=10;i++){
    s+=n%10;
    n/=10;
  }
  printf("%s",N%s==0?"Yes\n":"No\n");
  return 0;
}

Measured memory_bytes: 128
import collections as c
ip = lambda : map(int, input().split())

#################
N = int(input())
A = [int(i) for i in input().split()]
minn = 1e9
cminus = 0
czero = 0
s = 0
for i in A:
    minn = min(minn,abs(i))
    if i<0:
        cminus += 1
    elif i==0:
        czero += 1
    s += abs(i)
if cminus%2 == 1:
    s -= 2*minn
print(s)

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

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

#define ALL(a)  begin((a)),end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))

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

#define FF first
#define SS second
template<class S, class T>
istream& operator>>(istream& is, pair<S,T>& p){
  return is >> p.FF >> p.SS;
}
template<class S, class T>
ostream& operator<<(ostream& os, const pair<S,T>& p){
  return os << p.FF << " " << p.SS;
}
template<class T>
void maxi(T& x, T y){
  if(x < y) x = y;
}
template<class T>
void mini(T& x, T y){
  if(x > y) x = y;
}


const double EPS = 1e-10;
const double PI  = acos(-1.0);
const LL MOD = 1e9+7;

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

  LL x; cin >> x;
  LL ans = x / 11 * 2;
  x %= 11;

  if(x > 0){
	x -= 6;
	++ans;
  }
  if(x > 0){
	++ans;
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 764
import sys
import traceback

N, P = [int(i) for i in input().split()]
p = []
ans = 1

class PrimeFractorization:
    def __init__(self):
        self.a = 2

    def decomposit_prime(self, n):
        try:
            while n >= self.a * self.a:
                if n % self.a == 0:
                    p.append(self.a)
                    n //= self.a
                else:
                    self.a += 1
            p.append(n)
        except Exception as e:
            raise

obj = PrimeFractorization()
obj.decomposit_prime(P)

p2 = set(p)

for a in p2:
    if p.count(a) >= N:
        ans *= pow(int(a),int(p.count(a)/N))

if N == 1:
    print(P)
else:
    print(ans)


Measured memory_bytes: 3828
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <complex>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <functional>
#include <iostream>
#include <map>
#include <set>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-9
#define INF 2000000000
#define sz(x) ((int)(x).size())
#define fi first
#define sec second
#define SORT(x) sort((x).begin(),(x).end())
#define all(x) (x).begin(),(x).end()
#define EQ(a,b) (abs((a)-(b))<EPS)
int main()
{
	double a,b;
	while(cin >> a >> b)
	{
		if(a<35.50&&b<71.00)
		{
			cout << "AAA" << endl;
			continue;
		}
		if(a<37.50&&b<77.00)
		{
			cout << "AA" << endl;
			continue;
		}
		if(a<40.00&&b<83.00)
		{
			cout << "A" << endl;
			continue;
		}
		if(a<43.00&&b<89.00)
		{
			cout << "B" << endl;
			continue;
		}
		if(a<50.00&&b<105.00)
		{
			cout << "C" << endl;
			continue;
		}
		if(a<55.00&&b<116.00)
		{
			cout << "D" << endl;
			continue;
		}
		if(a<70.00&&b<148.00)
		{
			cout << "E" << endl;
			continue;
		}
		cout << "NA" << endl;
	}
	return 0;
}

Measured memory_bytes: 1220
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, a, b) for(int i=(a); i<(b); ++i)
#define  REP(i, n) for(int i=0; i<(n); ++i)
#define  ALL(obj) (obj).begin(), (obj).end()
#define  unsigned long ul
#define  long long ll

signed main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  int N, L;
  cin >> N >> L;
  int max=L+N-1;
  int min=L;
  int sum = 0;
  if(min>=0)
  {
    FOR(i,2,N+1) sum += L+i-1;
  }
  else if(max<=0)
  {
    FOR(i,1,N) sum += L+i-1;
  }
  else
  {
    FOR(i,1,N+1) sum += L+i-1;
  }
  cout << sum << endl;
  return 0;
}


Measured memory_bytes: 256