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

bool check(vector<int> P, vector<int> sP, int N) {
    for (int i = 0; i < N; i++) {
        if (P[i] != sP[i]) return false;
    }
    return true;
}

string solve(vector<int> P, vector<int> sP, int N) {
    for (int i = 0; i < N; i++) {
        for (int j = i; j < N; j++) {
            // if (i == j) continue;
            swap(P[i], P[j]);
            if (check(P, sP, N)) return "YES";
            swap(P[j], P[i]);
        }
    }
    return "NO";
}

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

    int N;
    cin >> N;
    vector<int> P(N);
    vector<int> sP(N);
    for (int i = 0; i < N; i++) {
        cin >> P[i];
        sP[i] = P[i];
    }
    sort(sP.begin(), sP.end());
    cout << solve(P, sP, N) << endl;
}

Measured memory_bytes: 256
nl = lambda: list(map(int, input().split()))
sl = lambda: input().split()
n = lambda: int(input())
s = lambda: input()

S = s()
T = s()

cands = set()
for i in range(len(S) - len(T) + 1):
    match = True
    for j in range(len(T)):
        if S[i+j] == T[j] or S[i+j] == '?':
            continue
        match = False
        break
    if match:
        cand = S[:i] + T + S[i+len(T):]
        scand = ''
        for c in cand:
            if c == '?':
                scand += 'a'
            else:
                scand += c
        cands.add(scand)

if len(cands) == 0:
    print('UNRESTORABLE')
else:
    print(sorted(list(cands))[0])


Measured memory_bytes: 3064
n=int(input())
h=[int(i) for i in input().split()]
for i in range(n):
  if i==0:
    tmp=h[i]
    ans=tmp
  else:
    if tmp<h[i]:
      ans= ans + h[i] - tmp
      tmp=h[i]
    else:
      tmp=h[i]
print(ans)

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

public class Main {
	FastScanner in = new FastScanner(System.in);
	PrintWriter out = new PrintWriter(System.out);

	public void run() {
		int n = in.nextInt();
		int max = 590 * 333;
		for (int i = 0; i < n; i++) {
			int y = in.nextInt(), m = in.nextInt(), d = in.nextInt();
			int days = 0;
			days += 590 * ((y-1) / 3);
			days += 195 * ((y-1) % 3);
			if (y % 3 == 0) {
				days += 20 * (m - 1);
			} else {
				days += 39 * ((m-1) / 2);
				days += 20 * ((m-1) % 2);
			}
			days += d-1;
			System.out.println(max - days);
		}
		out.close();
	}

	public static void main(String[] args) {
		new Main().run();
	}

	public void mapDebug(int[][] a) {
		System.out.println("--------map display---------");

		for (int i = 0; i < a.length; i++) {
			for (int j = 0; j < a[i].length; j++) {
				System.out.printf("%3d ", a[i][j]);
			}
			System.out.println();
		}

		System.out.println("----------------------------");
		System.out.println();
	}

	public void debug(Object... obj) {
		System.out.println(Arrays.deepToString(obj));
	}

	class FastScanner {
		private InputStream stream;
		private byte[] buf = new byte[1024];
		private int curChar;
		private int numChars;

		public FastScanner(InputStream stream) {
			this.stream = stream;
			//stream = new FileInputStream(new File("dec.in"));

		}

		int read() {
			if (numChars == -1)
				throw new InputMismatchException();
			if (curChar >= numChars) {
				curChar = 0;
				try {
					numChars = stream.read(buf);
				} catch (IOException e) {
					throw new InputMismatchException();
				}
				if (numChars <= 0)
					return -1;
			}
			return buf[curChar++];
		}

		boolean isSpaceChar(int c) {
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}

		boolean isEndline(int c) {
			return c == '\n' || c == '\r' || c == -1;
		}

		int nextInt() {
			return Integer.parseInt(next());
		}

		long nextLong() {
			return Long.parseLong(next());
		}

		double nextDouble() {
			return Double.parseDouble(next());
		}

		String next() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isSpaceChar(c));
			return res.toString();
		}

		String nextLine() {
			int c = read();
			while (isEndline(c))
				c = read();
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isEndline(c));
			return res.toString();
		}
	}
}

Measured memory_bytes: 16920
#include<bits/stdc++.h>
using namespace std;
const int N = 200010;
int n, m, ans;
int a[N], cnt[N], b[N];
int main()
{
	scanf("%d%d", &n, &m);
	ans = n;
	for(int i = 1; i <= n; ++i) 
	{
		scanf("%d", &a[i]);
		++cnt[a[i]];
		int pos = a[i] - cnt[a[i]] + 1;
		if(pos > 0)
		{
			if(b[pos] == 0) --ans;
			++b[pos]; 
		}
	}
	while(m--)
	{
		int x, y; 
		scanf("%d%d", &x, &y);
		int pos = a[x] - cnt[a[x]] + 1;
		if(pos > 0)
		{
			if(b[pos] == 1) ++ans; 
			--b[pos];
		}
		--cnt[a[x]];
		a[x] = y;
		++cnt[a[x]];
		pos = a[x] - cnt[a[x]] + 1;
		if(pos > 0)
		{
			if(b[pos] == 0) --ans;
			++b[pos];
		}
		printf("%d\n", ans);
	}
	return 0;
}

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

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int d,t,s;
  cin>>d>>t>>s;
  if(t*s>=d){
    cout<<"Yes"<<"\n";
  }else{
    cout<<"No"<<"\n";
  }
  return 0;
}

Measured memory_bytes: 3620
#include <bits/stdc++.h>
//#include <ext/pb_ds/tree_policy.hpp>
//#include <ext/pb_ds/assoc_container.hpp>

using namespace std;
//using namespace __gnu_pbds;

#define ll       long long
#define DS       pair<int, int>
#define READ(f)  freopen(f, "r", stdin)
#define WRITE(f) freopen(f, "w", stdout)

const int N = 2e5 + 5;
const int MOD = 1e9 + 7;
const double PI = 2 * acos(0.0);
//template<typename T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    int block = n / 100;
    int rem = n % 100;
    for (int i = 5; i >= 1; i--) {
        if (rem < i) continue;
        int cnt = rem / i;
        if (rem % i) cnt++;
        if (cnt <= block) {
            puts("1");
            return 0;
        }
    }
    puts(rem == 0 ? "1" : "0");
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define cs const 
#define fr first 
#define se second
#define ls (now<<1)
#define rs (now<<1|1)
#define mid ((l+r)>>1)
#define mp make_pair
#define pb push_back
#define ppb pop_back
#define low(i) (i&(-i))
#define par pair<int,int>
#define cn(x) memset(x, 0, sizeof(x))
#define rep(i, x, y) for(int i=x; i<=y; ++i)
#define sep(i, x, y) for(int i=x; i>=y; --i)
#define fore(i, x) for(int i=fir[x]; i; i=nex[i])
 
cs int G = 3;
cs int ff = 2e6 + 1;
cs int inf = 1e18 + 1;
cs int base = 2333;
cs int M = 1e9 + 7;

int n, m;
struct Node {int x, y, z;} a[ff];
bool cmp(Node A, Node B) { return A.z < B.z;
}
void init()
{
	cin >> n; int ans = 0;
	rep(i, 1, n) scanf("%lld %lld", &a[i].x, &a[i].y), a[i].z = a[i].x + a[i].y;
	sort(a + 1, a + 1 + n, cmp); ans = max(ans, a[n].z - a[1].z);
	
	rep(i, 1, n) a[i].z = 1e10 - a[i].x + a[i].y;
	sort(a + 1, a + 1 + n, cmp); ans = max(ans, a[n].z - a[1].z);
	
	rep(i, 1, n) a[i].z = 1e10 + a[i].x - a[i].y;
	sort(a + 1, a + 1 + n, cmp); ans = max(ans, a[n].z - a[1].z);
	
	rep(i, 1, n) a[i].z = 2e10 - a[i].x - a[i].y;
	sort(a + 1, a + 1 + n, cmp); ans = max(ans, a[n].z - a[1].z);
	
	cout << ans;
}
signed main()
{
	int Ts = 1;
	while(Ts--)
		init();
}

Measured memory_bytes: 8300
N, M, C = map(int, input().split(" "))
B = input().split(" ")
sums = C
counts = 0
for i in range(N):
    A = input().split(" ")
    for j in range(M):
        sums += int(A[j]) * int(B[j])
    if sums > 0:
        counts += 1
    sums = C

print(counts)


Measured memory_bytes: 3060
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    divisors.sort(reverse = True)
    return divisors

import heapq
#from collections import deque
import sys
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
#mod = 10**9 + 7
inf = float('inf')
ans = int(0)

N, K = LI()
A = LI()
cou = int(0)
sumA = sum(A)
anscandi = make_divisors(sumA)
#print(anscandi)

for i in anscandi:
    Smod = int(0)
    que = []
    for j in range(N):
        que.append((A[j] % i) *(-1))
        Smod += A[j] % i
    need = Smod//i
    heapq.heapify(que)
    for _ in range(need):
        heapq.heappop(que) * (-1)
    if K>=(sum(que)*(-1)):
        ans = i
        break


print(ans)


Measured memory_bytes: 51800
#include <bits/stdc++.h>
using namespace std;
int main()
{
    string x;
    cin >> x;
    for(int i = 0 ; i <x.size(); i++){
        if(x[i] == ','){
            x[i] = ' ';
        }
        cout << x[i];

    }
    cout << endl;
	return 0;
}


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

using namespace std;

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

    string str;
    int s2[4];
    cin >> str;

    transform(begin(str), end(str), s2, [](char c) { return c - '0'; });

    int ops;
    for (int i = 0; i < 2 * 2 * 2; i++)
    {
        int sum = s2[0];
        int op;
        if (i & 0b001)
            op = -1;
        else
            op = 1;
        sum = sum + op * s2[1];
        if (i & 0b010)
            op = -1;
        else
            op = 1;
        sum = sum + op * s2[2];
        if (i & 0b100)
            op = -1;
        else
            op = 1;
        sum = sum + op * s2[3];
        if (sum == 7)
        {
            ops = i;
            break;
        }
    }
    cout << s2[0];
    if (ops & 0b001)
        cout << "-";
    else
        cout << "+";
    cout << s2[1];
    if (ops & 0b010)
        cout << "-";
    else
        cout << "+";
    cout << s2[2];
    if (ops & 0b100)
        cout << "-";
    else
        cout << "+";
    cout << s2[3];

    cout << "=7" << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
#define rep(i,n) for(ll i=0;i<(n);i++)
#define init(a,i) for(int k=0;k<(i);k++)(a)[k]=0
#define in(a,i) for(int k=0;k<(i);k++)cin>>(a)[k]
#define all(a)  (a).begin(),(a).end()
#define mod 1000000007
#define inf 2147483647
#define range(x,a,b) (a)<=x&&x<=(b)
int main(){
	int n;
	cin>>n;
	int count=0,m=0,d1,d2;
	rep(i,n){
		cin>>d1>>d2;
		if(d1==d2){
			count++;
			m=max(count,m);
		}
		else{
			m=max(count,m);
			count=0;
		}
	}
	if(m>=3){
		cout<<"Yes";
	}
	else{
		cout<<"No";
	}
	return 0;
}

Measured memory_bytes: 3628
// 🐋💭
import Foundation

func readInts() -> [Int] {
    return readLine()!.split(separator: " ").map { Int($0)! }
}

func readInt() -> Int {
    return Int(readLine()!)!
}

///最大公約数を返す
func gcd(_ m:Int, _ n:Int) -> Int {
    if n == 0 {return m}
    return gcd(n, m % n)
}

///素数判定(試し割り)
func isPrime(_ x:Int) -> Bool {
    if x <= 1 || x % 2 == 0 { return false }
    if x == 2 { return true }
    for i in stride(from: 3, to: Int(ceil(sqrt(Double(x)))), by: 2){
        if x % i == 0 {
            return false
        }
    }
    return true
}

//https://program-life.com/669
///実行速度の計測
func exectionTime(action: () -> Void) {
    let startDate = Date()
    action()
    let endDate = Date()
    print(endDate.timeIntervalSince(startDate))
}

// https://melheaven.hatenadiary.jp/entry/atcoder144
///約数の配列を返す
func makeDivisors(_ n:Int) -> [Int] {
    var divisors = [Int]()
    for i in 1..<Int(pow(Double(n), 0.5)) + 1 {
        if n % i == 0{
            divisors.append(i + n / i)
        }
    }
    
    return divisors
}

//https://riptutorial.com/ja/swift/example/14738/インデックスを知らずに配列から要素を削除する
extension Array where Element: Equatable {
    
    mutating func remove(_ element: Element) {
        _ = index(of: element).flatMap {
            self.remove(at: $0)
        }
    }
}

func binarySearch(rifgt:Int, key:Int, ary:[String]) -> Int{
    var left = 0
    var right = rifgt
    
    while abs(right - left) > 1 {
        let mid = left + (right - left) / 2
        
        if Int(ary[mid])! < key {
            left = mid
            
        } else {
            right = mid
        }
    }
    return left
}

func arrangement (prev:String, ary:[String], returnVal:[String]) -> [String] {
    var returnVal = returnVal
    if ary.count == 0 {
        returnVal.append(prev)
        return returnVal
    }
    
    for s in ary {
        let wprev = prev + s
        var wary = ary
        wary.remove(s)
        returnVal = arrangement(prev: wprev, ary: wary, returnVal: returnVal)
    }
    return returnVal
}

func main() {
    let n = readInt()
    let aryB = readInts()
    //_______________________ここまで入力
    
    var aryA = [Int](repeating: 0, count: n)
    aryA[0] = aryB[0]
    aryA[aryA.count - 1] = aryB[aryB.count - 1]
    for i in 2..<n {
        aryA[i-1] = min(aryB[i - 1], aryB[i - 2])
    }
    
    print(aryA.reduce(0) { $0 + $1 })
    
}

main()


Measured memory_bytes: 13572
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)
        {
            new Program().Solve(new ConsoleInput(Console.In, ' '));
        }

        public void Solve(ConsoleInput cin)
        {
            var X = cin.ReadLong;

            long ans = 0;
            long newValue = 100;

            while (true) 
            {
                if(newValue >= X) 
                {
                    break;
                }
                newValue = (long)(newValue * 1.01);
                ans++;
            }

            WriteLine(ans);
        }

    }


    public class ConsoleInput
    {
        private readonly System.IO.TextReader _stream;
        private char _separator = ' ';
        private Queue<string> inputStream;
        public ConsoleInput(System.IO.TextReader stream, char separator = ' ')
        {
            this._separator = separator;
            this._stream = stream;
            inputStream = new Queue<string>();
        }

        public string Read
        {
            get
            {
                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 { get { return _stream.ReadLine(); } }
        public int ReadInt { get { return int.Parse(Read); } }
        public long ReadLong { get { return long.Parse(Read); } }
        public double ReadDouble { get { 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: 27848
#include<bits/stdc++.h>
using namespace std;
int n;
int last[9];
int res[9];//第i行棋子放置的列数res[i]
int used[9];//第j行是否放置了棋子
int isAccept(int i, int j){//检查与已经放置过的棋子是否有冲突
    for(int p = 1; p <= 8; p++){//p代表行,res[p]代表p行对应的列
        if(used[res[p]]){
            if(j == res[p] || abs(i - p) == abs(j - res[p])) return 0;
        }
    }
    return 1;
}
void dfs(int i){//i为递归深度
    if(i == 9) {
        for(int k = 0; k <= 8; k++) last[k] = res[k];
        //for (int re : res) printf("%d ", re);
        //cout<<endl;
        return ;
    }
    if(used[res[i]]) {
        dfs(i+1);
    }
    else{
        for(int j = 1; j <= 8;j++){//i行j列
            if(!used[j] && isAccept(i, j)){
                res[i] = j;
                used[j] = 1;
                dfs(i+1);
                res[i] = 0;
                used[j] = 0;
            }
        }
    }

}
int main(){
    scanf("%d", &n);
    memset(res, 0, sizeof(res));
    memset(used, 0, sizeof(used));
    for (int i = 0; i < n; i++) {
        int a, b;
        scanf("%d %d", &a, &b);
        res[a+1] = b+1;
        used[b+1] = 1;
    }
    dfs(1);
    for(int i = 1; i <= 8; i++){
        for(int j = 1; j <= 8; j++){
            printf("%c", (j == last[i]) ? 'Q' : '.');
        }
        printf("\n");
    }
    return 0;
}


Measured memory_bytes: 3156
#include <iostream>
#include <string>
#define rp(i,n) for(long long i=0;i<n;i++)

using namespace std;
using ll = long long;

int main(void)
{
    ll n,a,b,s,t,ans;
    cin>>n>>a>>b;
    s=n/(a+b);
    t=n%(a+b);
    if(t>a){ans=(s+1)*a; } else ans = s*a+t;
    cout<<ans<<endl;


    return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;
#define rep(i, begin, n) for (int i = begin; i < n; i++)
#define repe(i, begin, n) for (int i = begin; i <= n; i++)
#define repr(i, begin, n) for (int i = begin; i > begin - n; i--)
#define repre(i, begin, end) for (int i = begin; i >= end; i--)

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

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

const int inf = INT_MAX;
const int MOD = 1000000007;
const long long INF = LLONG_MAX;

// -------------------------------------------------------

int sx, sy, tx, ty;

int main() {
  cin >> sx >> sy >> tx >> ty;
  int dx = tx - sx;
  int dy = ty - sy;
  rep(i, 0, dy) { cout << "U"; }
  rep(i, 0, dx) { cout << "R"; }
  rep(i, 0, dy) { cout << "D"; }
  rep(i, 0, dx) { cout << "L"; }
  cout << "L";
  rep(i, 0, dy + 1) { cout << "U"; }
  rep(i, 0, dx + 1) { cout << "R"; }
  cout << "D";
  cout << "R";
  rep(i, 0, dy + 1) { cout << "D"; }
  rep(i, 0, dx + 1) { cout << "L"; }
  cout << "U";
}


Measured memory_bytes: 3596
def solve1():
    N, M = [int(s) for s in input().split()]
    if N == M == 0:
        return False
    taro = [int(input()) for _ in range(N)]
    taro.sort()
    hana = [int(input()) for _ in range(M)]
    hana.sort()
    diff = sum(taro) - sum(hana)
    ans = compare(diff, taro, hana);
    if ans is None:
        print("-1")
    else:
        t, h = ans
        print("{0} {1}".format(t, h))
    return True
    
def compare(diff, taro, hana):
    if len(taro) == 0 or len(hana) == 0:
        return None
    t = taro[0]
    h = hana[0]
    d = (t-h)*2
    if d < diff:
        return compare(diff, taro[1:], hana)
    if d == diff:
        return t, h
    else:
        return compare(diff, taro, hana[1:])
    
if __name__ == "__main__":
    while(solve1()):
        pass

Measured memory_bytes: 7792
#include <bits/stdc++.h>
using namespace std;
#define int long long int
#define mp make_pair
#define pb push_back
#define F first
#define S second
const int N=200001;
#define M 1000000007
#define double long double
#define BINF 1000000000000000001
#define init(arr,val) memset(arr,val,sizeof(arr))
#define MAXN 15000001
const int LG = 22;



#undef int
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
#define int long long int

	
	int n,a,b;
	cin>>n>>a>>b;
	int x=a+b;

	if(x>n) x=x-n;
	else x=0;

	cout<<min(a,b)<<' '<<x;



return 0;
}

Measured memory_bytes: 256
//Gvs Akhil (Vicennial)
#include<bits/stdc++.h>
#define int long long
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple
#define ld(a) while(a--)
#define tci(v,i) for(auto i=v.begin();i!=v.end();i++)
#define tcf(v,i) for(auto i : v)
#define all(v) v.begin(),v.end()
#define rep(i,start,lim) for(long long (i)=(start);i<(lim);i++)
#define sync ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define osit ostream_iterator
#define INF 		0x3f3f3f3f
#define LLINF       1000111000111000111LL
#define PI 			3.14159265358979323
#define endl '\n'
#define trace1(x)                cerr<<#x<<": "<<x<<endl
#define trace2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define trace4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define trace5(a, b, c, d, e)    cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
#define trace6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl
const int N=1000006;
using namespace std;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef long long ll;
typedef vector<long long> vll;
typedef vector<vll> vvll;
typedef long double ld;
typedef pair<int,int> ii;
typedef vector<ii> vii;
typedef vector<vii> vvii;
typedef tuple<int,int,int> iii;
typedef set<int> si;
typedef complex<double> pnt;
typedef vector<pnt> vpnt;
typedef priority_queue<ii,vii,greater<ii> > spq;
const ll MOD=1000000007LL;
template<typename T> T gcd(T a,T b){if(a==0) return b; return gcd(b%a,a);}
template<typename T> T power(T x,T y,ll m=MOD){T ans=1;while(y>0){if(y&1LL) ans=(ans*x)%m;y>>=1LL;x=(x*x)%m;}return ans%m;}
int32_t main(){
	int n,k; cin>>n>>k;
	vi v(n);
	rep(i,0,n) cin>>v[i];
	sort(all(v)); reverse(all(v));
	int sum=0;
	rep(i,0,k) sum+=v[i];
	cout<<sum;
}



Measured memory_bytes: 764
#include <algorithm>
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <string>
#include <utility>
#include <vector>

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

using namespace std;
typedef long long int ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef pair<int, int> PI;
const ll mod = 1e9 + 7;



int main(void) {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  VI f(n);
  vector<VI> p(n, VI(11));
  REP(i, 0, n) {
    REP(j, 0, 10) {
      int x;
      cin >> x;
      f[i] |= x << j;
    }
  }
  REP(i, 0, n) {
    REP(j, 0, 11) {
      cin >> p[i][j];
    }
  }
  ll ma = -1e16;
  REP(bits, 1, 1 << 10) {
    ll tot = 0;
    REP(i, 0, n) {
      tot += p[i][__builtin_popcount(f[i] & bits)];
    }
    ma = max(ma, tot);
  }
  cout << ma << endl;
}


Measured memory_bytes: 256
fn get_input() -> String {
    let mut word = String::new();
    std::io::stdin().read_line(&mut word).unwrap();
    word.trim().to_owned()
}
 
fn main() {
    let (a, b) = {
        let line = get_input();
        let mut split = line.split_whitespace();
        let a:i64 = split.next().unwrap().parse().unwrap();
        let b:i64 = split.next().unwrap().parse().unwrap();
        (a,b)
    };
    println!("{}", if b % a == 0 { a + b } else { b - a } );
}

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

int main() {
  int N,M;
  cin >>N >>M;
  vector<int> X(M);
  for(int i= 0;i<M;i++){
    cin >> X[i];
  }
  sort(X.begin(),X.end());
  int ans = X[M-1]-X[0];
  
  vector<int> d(M-1);
  for(int i= 0;i<M-1;i++){
    d[i] = X[i+1]-X[i];
  }
  sort(d.begin(),d.end());
  reverse(d.begin(),d.end());
  
  if(N == 1) cout << ans << endl;
  else if(N>=2 && N<M){
    for(int i = 2;i<=N;i++){
      ans -= d[i-2];
    }
    cout << ans << endl;
  }
  else if(N>=M) cout << 0 << endl;

}


Measured memory_bytes: 1024
#include<iostream>
#include<map>
#include<set>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<stack>
#include<limits>
#include<sstream> 
#include<unordered_map>      

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef int itn;
typedef vector<int> vi;
typedef vector<ll> vl;

const int inf = numeric_limits<int>::max() >> 2;
const ll linf = numeric_limits<ll>::max() >> 2;
const ull ulinf = numeric_limits<ull>::max() >> 2;
const double pi = acos(-1);
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
const int dx8[8]={-1,0,1,-1,1,-1,0,1};
const int dy8[8]={-1,-1,-1,0,0,1,1,1};

#define p_queue(i) priority_queue<i> 
#define rp_queue(i) priority_queue<i, vector<i>, greater<i>> 
#define umap(i,j) unordered_map<i,j>
#define P(p) cout<<(p)<<endl
#define PS(p) cout<<(p)<< " "
#define IN cin >> 
#define rep(i,m,n) for(int i = (m); i < (int)(n); i++)
#define rrep(i,m,n) for(int i = (m-1); i >= (int)(n); i--)
#define inrep(n,a) for(int i = 0; i < (int)(n); i++)cin >> a[i];
#define mod(i) ((i)%(ll)(1e9 + 7))
#define divm(a,b) (mod(a * modpow((ll)b,(ll)(1e9+5))))
#define rsort(a,b,c) sort(a, b, greater<c>())
#define vsort(v) sort(v.begin(), v.end());
#define rvsort(v) sort(v.end(), v.begin());
#define ft first
#define sd second
#define pb push_back
#define it insert
#define sz(x) ((int)(x).size())
#define lb(a,n,k) (lower_bound(a,a+n,k) - a) 
#define vlb(a,k)  (lower_bound(a.begin(),a.end(),k) - a.begin())
#define ub(a,n,k) (upper_bound(a,a+n,k) - a) 
#define vub(a,k)  (upper_bound(a.begin(),a.end(),k) - a.begin())
#define YES cout<<"YES"<< endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl  
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
#define ret return

ll modpow(ll i,ll j){ ll tmp=1; while(j){ if(j%2)tmp=mod(tmp*i);i=mod(i*i);j/=2;}return tmp;}
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }

vector<string> split(const string &str, char sep){
    vector<string> v;
    stringstream ss(str);
    string buffer;
    while( getline(ss, buffer, sep) ) {
        v.push_back(buffer);
    }
    return v;
}

//ll ncr[100][100];
//ll nCr(int n, int r){if(n==r) ret ncr[n][r] = 1; if(r==0) ret ncr[n][r] = 1; if(r==1) ret ncr[n][r] = n;if(ncr[n][r]) ret ncr[n][r]; ret ncr[n][r] = nCr(n-1,r) + nCr(n-1,r-1);}

//ll npr[100][100]={};
//ll nPr(int n,int r){if(npr[n][r])ret npr[n][r];if(r==0)ret npr[n][r] = 1;if(r==1)ret npr[n][r] = n;ret npr[n][r] = n * nPr(n-1,r-1);}

//ll nHr(int n,int r){ret nCr(n+r-1,r);}

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


int main(){
    int a,b,c,d;
    IN a >> b >> c >> d;

    if((abs(a-b) <= d && abs(b-c) <= d) || abs(a-c) <= d)Yes;
    else No;
    
    return  0;
    
}



Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <limits.h>
#include <time.h>
int main(){
    int n,i,r=0,ans=0;
    scanf("%d",&n);
    char c[n];
    for(i=0; i<n; i++){
        scanf("%s",&c);
    }
    for(i=0; i<n; i++){
        if(c[i]=='R')r++;
    }
    ans=r;
    for(i=0; i<r; i++){
        if(c[i]=='R')ans--;
    }
    printf("%d",ans);
    return 0;
}

Measured memory_bytes: 1920
#include <bits/stdc++.h>
#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(vec) vec.begin(), vec.end()
#define rALL(vec) vec.rbegin(), vec.rend()
using namespace std;
using ll = long long;

int main() {
    int a;
    cin >> a;
    cout << a + a*a + a*a*a << endl;
    return 0;
}

Measured memory_bytes: 3632
using System.Linq;
using System.Collections.Generic;
using System;

public class hello
{
    public static void Main()
    {
        var allcard = new List<int> { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13 };
        var scard = new List<int>();
        var hcard = new List<int>();
        var ccard = new List<int>();
        var dcard = new List<int>();

        var n = int.Parse(Console.ReadLine().Trim());
        for (int i = 0; i < n; i++)
        {
            string[] line = Console.ReadLine().Trim().Split(' ');
            switch(line[0])
            {
                case "S":
                    scard.Add(int.Parse(line[1]));
                    break;
                case "H":
                    hcard.Add(int.Parse(line[1]));
                    break;
                case "C":
                    ccard.Add(int.Parse(line[1]));
                    break;
                 case "D":
                    dcard.Add(int.Parse(line[1]));
                    break;
                default:
                    break;
            }
        }
        var z = allcard.Except(scard).ToList();
        z.Sort();
        foreach (var ss in z)
            Console.WriteLine("S {0}", ss);
        var zz = allcard.Except(hcard).ToList();
        zz.Sort();
        foreach (var ss in zz)
            Console.WriteLine("H {0}", ss);
        var zzz = allcard.Except(ccard).ToList();
        zzz.Sort();
        foreach (var ss in zzz)
            Console.WriteLine("C {0}", ss);
        var zzzz = allcard.Except(dcard).ToList();
        zzzz.Sort();
        foreach (var ss in zzzz)
            Console.WriteLine("D {0}", ss);



    }
}



Measured memory_bytes: 18340
G[9999],v[9999],i,a,b;main(N){for(;scanf("%d",&N)*N;printf("%d\n",b)){for(i=0;b=i<N*N;G[i++]=a+b*N)v[i]=-scanf("%d%d",&a,&b);for(;i--;b+=v[a]==i)for(a=i;v[a]<0;a=G[a])v[a]=i;}}

Measured memory_bytes: 0
#include<iostream>
#include<cmath>
#define PLEN 1000010

using namespace std;

int dish[30];
bool oprime[PLEN];
bool data[PLEN];

int main () {

	for ( int i=0; i<PLEN; i++ ) {
		oprime[i++] = false;
		oprime[i] = true;
	}

	oprime[2] = true;

	int limit;
	limit = (int)(sqrt((double)PLEN));

	for ( int i=3; i<limit; i+=2 ) {
		if ( oprime[i] ) {
			for ( int j=1; j<PLEN; j+=2 ) {
				if ( j != i ) {
					if ( (j % i) == 0 ) {
						oprime[j] = false;
					}
				}
			}
		}
	}

	oprime[1] = false;

	while(true) {
		int dishNum;
		cin >> dishNum;

		int budget;
		cin >> budget;

		if ( dishNum == 0 )
			break;


		for ( int i=0; i<=budget; i++ ) {
			data[i] = false;
		}


		for ( int i=0; i<dishNum; i++ ) {
			cin >> dish[i];
			data[dish[i]] = true;
		}

		int count = 1;

		while ( true ) {
			bool done = false;

			for ( int i=0; i<=budget; i++ ) {
				if ( data[i] ) {
					for ( int j=0; j<dishNum; j++ ) {
						if ( i + dish[j] <= budget ) {
							if ( !data[i+dish[j]] ) {
								data[i+dish[j]] = true;
								done = true;
							}
						}
					}
				}
			}

			if ( !done )
				break;
		}

		int answer = 0;

		for ( int i=0; i<=budget; i++ ) {
			if ( data[i] ) {
				if ( oprime[i] ) {
					if ( answer < i )
						answer = i;
				}
			}
		}
		
		if ( answer != 0 )
			cout << answer << endl;
		else
			cout << "NA" << endl;
	}
}

Measured memory_bytes: 2816
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <cmath>
#include <numeric>
#include <utility>
#include <iomanip>

using namespace std;
using int64 = long long;

struct aaa{aaa(){cin.tie(nullptr); ios::sync_with_stdio(false); cout<<fixed<<setprecision(20);};}aaa;

int main() {
    int n;
    cin >> n;
    int ans = INT_MAX;
    for (int i=0; i<n; i++) {
        int a;
        cin >> a;
        int cnt = 0;
        while (a%2 == 0) {
            a /= 2;
            cnt++;
        }
        ans = min(ans, cnt);
    }
    cout << ans << endl;
}


Measured memory_bytes: 3156
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define PI 3.141592653589793
#define rep(i, n) for (int i = 0; i < (n); i++)
#define REP(i, a, n) for (int i = a; i < (n); i++)
#define rrep(i, n, k) for (int i = (n); i >= (k); i--);
#define all(x) (x).begin(), (x).end()
#define vi vector<int>
template<class T> istream &operator>>(istream&is,vector<T>&v){for(auto &elemnt:v)is>>elemnt;return is;}
template<class T,class U> istream &operator>>(istream&is,pair<T,U>&p){is>>p.first>>p.second;return is;}
template<class T>vector<T> make_vector(size_t a){return vector<T>(a);}
template<class T, class... Ts>auto make_vector(size_t a, Ts... ts){return vector<decltype(make_vector<T>(ts...))>(a, make_vector<T>(ts...));}
const int MOD = 1e9 + 7;
const int INF = 9e18;

signed main(){
    vector<int> T(2), A(2), B(2), dif(2);
    cin >> T >> A >> B;
    for (int i = 0; i <= 1; i++) {
        A[i] *= T[i];
        B[i] *= T[i];
        dif[i] = B[i] - A[i];
    }
    if ((dif[0] < 0 && dif[1] < 0) || (dif[0] > 0 && dif[1] > 0)) {
        cout << 0 << endl;
        return 0;
    }
    if (dif[0] < 0 && dif[1] > 0) {
        dif[0] *= -1;
        dif[1] *= -1;
    }
    int next = dif[0] + dif[1];
    if (next > 0) {
        cout << 0 << endl;
        return 0;
    } else if (next == 0) {
        cout << "infinity" << endl;
        return 0;
    }
    int ans = (dif[0] / abs(next)) * 2 + (dif[0] % abs(next) != 0);
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
//#define cerr if (false) cerr
#define db(x) cerr << #x << "=" << x << endl
#define db2(x, y) cerr << #x << "=" << x << "," << #y << "=" << y << endl
#define db3(x, y, z) cerr << #x << "=" << x << "," << #y << "=" << y << "," << #z << "=" << z << endl
#define dbv(v) cerr << #v << "="; for (auto _x : v) cerr << _x << ", "; cerr << endl
#define dba(a, n) cerr << #a << "="; for (int _i = 0; _i < (n); ++_i) cerr << a[_i] << ", "; cerr << endl
template <typename A, typename B>
ostream& operator<<(ostream& os, const pair<A, B>& x) {
	return os << "(" << x.first << "," << x.second << ")";
}
typedef long long ll;
typedef long double ld;
ll solve(int W, int H, int K) {
	K = 2 * K - 2;
	ll ans = 0;
	for (int x = 1; x < W; ++x) {
		int lim = min(H - 1, (K + 2 * W) / (W - x));
		for (int y1 = 1; y1 <= lim; ++y1) {
			int rhs = K - (W - x) * y1 + __gcd(x, y1);
			// x * y2 <= rhs + (W, |y1-y2|) + (W-x, y2)
			int bound = min(H - 1, max(0, rhs / x));
			ans += bound;
			int lim2 = min(H - 1, (rhs + 2 * W - x) / x);
			for (int y2 = bound + 1; y2 <= lim2; ++y2) {
				if (x * y2 <= rhs + __gcd(W, abs(y1 - y2)) + __gcd(W - x, y2))
					++ans;
			}
		}
	}
	return ans;
}
int main() {
	int w, h, k;
	scanf("%d%d%d", &w, &h, &k);
	ll ans = 2 * (solve(w, h, k) + solve(h, w, k));
	printf("%lld\n", ans);
}


Measured memory_bytes: 3776
#include <stdio.h>
  
#define MAX 45
  
int res[MAX];
  
  
main()
{
    int n;      
    int i;
    scanf("%d", &n);
  
    res[0] = 1;
    res[1] = 1;
  
    for (i = 2; i <= n; i++)
        res[i] = res[i - 1] + res[i - 2];
  
    printf("%d\n", res[n]);
  
    return 0;
  
}

Measured memory_bytes: 596
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <numeric>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <time.h>
#include <list>

using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<(n);++i)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define reps(x,c) for(auto x:c)
#define all(x) begin(x), end(x)
#define pb(a) emplace_back(a) 
#define mp(a,b) make_pair((a),(b))
#define pl pair<ll,ll>
#define INF 2147483600
#define MOD 1000000007
#define fi first
#define se second
#define dbg(x) cout << #x"="<< (x) << endl
#define dbgv(x) cout<<#x<<endl;reps(y,x){cout<<y<<" ";}cout<<endl

int main(){
  char c;
  multiset<char> s;
  rep(i,6){
    cin>>c;
    s.insert(c);
  }
  cout<<s.count('1')<<endl;
  return 0;
}

Measured memory_bytes: 256
'use strict'

function main(input) {
  input = input
    .trim()
    .split(' ')
    .map(v => ~~v)
  const tmp = input[0] - input[1]

  console.log(Math.max(0, input[2] - tmp))
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'))

Measured memory_bytes: 21192
from itertools import product
from collections import deque
import numpy as np
inputs = open(0).readlines()
class Grid():
    def __init__(self, grid, w=0, h=0, function=lambda x: x):
        self.w = w = w if w else len(grid[0])
        self.h = h = h if h else len(grid)
        dtype = type(function(grid[0][0]))
        self.grid = np.empty((h, w), dtype=dtype)
        for i, row in zip(range(h), grid):
            for j, val in zip(range(w), row):
                self.grid[i][j] = function(val)
    
    def is_valid_x(self, x):
        return 0 <= x < self.w
    def is_valid_y(self, y):
        return 0 <= y < self.h
    def is_valid_xy(self, x, y):
        return self.is_valid_x(x) and self.is_valid_y(y) 
    
    def __iter__(self):
        return iter(self.grid)
    def __repr__(self):
        return '\n'.join([' '.join(map(str, row)) for row in self.grid])
    def __getitem__(self, x):
        return self.grid[x]
    def __setitem__(self, x, val):
        self.grid[x] = val

h, w = map(int, inputs[0].split())
grid = Grid(inputs[1:], function=lambda x: int(x == '#'))

def dfs(root):
    count = 1
    x, y = root
    grid[y, x] = 0
    stack = [root]
    while stack:
        x, y = stack.pop()
        grid[y, x] = 0
        for dx, dy in zip([1, 0, -1, 0], [0, 1, 0, -1]):
            if grid.is_valid_xy(x+dx, y+dy) and grid[y+dy, x+dx]:
                stack.append((x+dx, y+dy))
                count += 1
    return count
    
ans = 'Yes'
for i, j in product(range(h), range(w)):
    if grid[i, j]:
        if dfs((j, i)) == 1:
            ans = 'No'
            break
print(ans)

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

int n,m;
int a[100005];
int f[32][100005];
int cnt[32];


int main()
{
	scanf("%d%d",&n,&m);
	for(int i=1;i<=n;++i)
	    scanf("%d",&a[i]);
	for(int i=1;i<=n;++i)
	{
		int now=0;
		int k=a[i];
		while(k)
		{
			k/=2;
			++now;
		}
		f[now][++cnt[now]]=a[i];
	}
	int l=0;
	for(int i=31;i>=1;--i)
	{
		if(l==m) break; 
		sort(f[i] + 1 ,f[i] + 1 + cnt [i]);
		while(l < m && cnt[i] )
		{
			++l;
			f[i-1][ ++ cnt[i-1]] = f[i][cnt[i]] / 2;
			cnt[i]--;
		}
	}
	long long ans=0;
	for(int i=0;i<=31;++i)
		for(int j=1;j<=cnt[i];++j)
		    ans+=f[i][j];//cout<<f[i][j]<<" ";
	printf("%lld\n",ans);
	return 0;
}

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


int main(){
    int k,n;
    std::cin >> k >> n;
    std::vector<int> A(n);
    for(int i = 0 ; i < n;i++){
        std::cin >> A[i];
    }
    std::vector<std::pair<int,int>> Distance_Label(n);
    Distance_Label[0] = std::make_pair(A[0] + k - A[n-1],0);
    for(int i = 1 ; i < n;i++){
        Distance_Label[i] = std::make_pair(A[i]-A[i-1],i);
    }
    std::sort(Distance_Label.begin(),Distance_Label.end());
    std::cout << k - Distance_Label[n-1].first <<std::endl;
    return 0;
}

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

int main() {
  map<string, int> mp;
  string s;
  while (cin >> s) {
    mp[s]++;
  }
  string frq, lng;
  for (auto& e : mp) {
    if (e.second > mp[frq]) {
      frq = e.first;
    }
    if (e.first.size() > lng.size()) {
      lng = e.first;
    }
  }
  cout << frq << " " << lng << "\n";
}


Measured memory_bytes: 3088
def division(n):
    if n < 2:
        return []
    prime_fac = []
    for i in range(2,int(n**0.5)+1):
        cnt = 0
        while n % i == 0:
            n //= i
            cnt += 1
        if cnt!=0:prime_fac.append((i,cnt))
    if n > 1:
        prime_fac.append((n,1))
    return prime_fac

n = int(input())
div = division(n)
ans = 0
for i,e in div:
    b = 1
    while b <= e:
        e -= b
        b += 1
        ans += 1
print(ans)


Measured memory_bytes: 9440
import numpy as np
n,m,x=map(int,input().split())
MAX=9999999999

c=[]
a=[]
for i in range(n):
    ca=list(map(int,input().split()))
    c.append(ca[0])
    a.append(ca[1:])

c=np.array(c)
a=np.array(a)

pat=2**n
ans=MAX
for i in range(pat):
    pat_i=bin(i)[2:].zfill(n)
    ai=np.array([0 for _ in range(m)])
    ansi=0

    for j in range(len(pat_i)):
        if(pat_i[j]=='1'):
            ansi+=c[j]
            ai+=a[j]

    if(min(ai)>=x):
        ans=min(ans,ansi)

if(ans!=MAX):
    print(ans)
else:
    print(-1)

Measured memory_bytes: 27260
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define REP(i, n) for(int i = 1; i <= (int)(n); i++)
const long long INF = 1LL << 60;
int main() 
{
    int n, k;
    cin >> n >> k;
    long long res=k;

    rep(i,n-1){
        res *= (k-1); 
    }
    cout << res << endl;
}

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

template <typename T> inline void rd(T& x) {
	int si = 1; char c = getchar(); x = 0;
	while(!isdigit(c)) si = c == '-' ? -1 : si, c = getchar();
	while(isdigit(c)) x = x * 10 + c - 48, c = getchar();
	x *= si;
}
template <typename T, typename... Args>
inline void rd(T& x, Args&... args) { rd(x); rd(args...); }
#define fi first
#define se second
#define mkp std::make_pair
typedef long long ll;
typedef double ff;
typedef std::pair <int, int> pii;
const int kN = 4e5 + 5, kInf = 0x3f3f3f3f;
const ll kMod = 998244353, kInfLL = 0x3f3f3f3f3f3f3f3fLL;

int n, ans = kInf; char str[kN];
int main() { 
#ifndef ONLINE_JUDGE
	freopen("a.in", "r", stdin);
	freopen("a.out", "w", stdout);
#endif
	int T = 1; //rd(T);
	while(T--) {
		scanf("%s", str + 1); n = strlen(str + 1);
		for(char t = 'a'; t <= 'z'; ++t) {
			int nxt = n + 1, cur_ans = 0;
			for(int i = n; i; --i) {
				if(str[i] == t) nxt = i;
				cur_ans = std::max(cur_ans, nxt - i);
			}
			ans = std::min(ans, cur_ans);
			//printf("%c %d\n", t, cur_ans);
		}
		printf("%d\n", ans);
	} return 0;
}

Measured memory_bytes: 3820
import 'dart:async';
import 'dart:io';
import 'dart:convert';

Stream<String> get lineStream =>
    stdin.transform(utf8.decoder).transform(const LineSplitter());

Future<List<String>> readLines() async {
  final lines = <String>[];
  await for (var line in lineStream) {
    lines.add(line);
  }
  return lines;
}

void main() async {
  final lines = await readLines();
  final x = int.parse(lines[0]);
  print(x >= 30 ? 'Yes' : 'No');
}


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

using namespace std;

int main(){
  long x,y;
  cin >> x >> y;
  cout << labs(labs(x) - labs(y)) + (x*y < 0) + (x*y == 0 && x > y)+ 2*(x-y > 0 && x*y > 0) << endl;
  return 0;
}


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

using namespace std;

int main()
{
    int n;
    cin>>n;
    
    int a[n];
    
    for(int i=0;i<n;i++)
    cin>>a[i];
    
    int dp[n];
    
    dp[0]=0;
    dp[1]=abs(a[0]-a[1]);
    for(int i=2;i<n;i++)
    {
        dp[i]=min((dp[i-1]+abs(a[i]-a[i-1])),(dp[i-2]+abs(a[i]-a[i-2])));
    }
    
    cout<<dp[n-1];
   return 0;
}

Measured memory_bytes: 1152
#include"bits/stdc++.h"
using namespace std;

void Main() {
	long long A, B, C, K, cnt;
	long long minNum;
	cin >> A >> B >> C >> K;
	cnt = min(A, K);
	if (A + B < K) {
		cnt = cnt - min(C, (K - (A + B)));
	}
	cout << cnt << endl;
}
int main() {
	std::cout << std::fixed << std::setprecision(15);
	Main();
}


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

//type
#define ll long long
typedef pair<int, int> P;
//定数
#define INF 1000000000000 //10^12:∞
#define MOD 1000000007    //10^9+7:合同式の法
#define MAXR 100000       //10^5:配列の最大のrange
//略記
#define PB push_back //挿入
#define MP make_pair //pairのコンストラクタ
#define F first      //pairの一つ目の要素
#define S second     //pairの二つ目の要素
#define Z class
// OTHER
// xの二乗を返す (関数テンプレート版)
template <typename T>
T square(T x) { return x * x; }
#define chmax(x, y) (x = max(x, y))
#define chmin(x, y) (x = min(x, y))
// loop
#define rep(i, n) for (int i = 0; i < (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--)
#define FORA(i, I) for (const auto &i : I)

// vector
#define ALL(x) x.begin(), x.end()

// output
#define YES() printf("YES\n")
#define NO() printf("NO\n")
#define isYES(x) printf("%s\n", (x) ? "YES" : "NO")
#define Yes() printf("Yes\n")
#define No() printf("No\n")
#define ln cout << '\n'
template <Z A>
void pr(A a)
{
  cout << a;
  ln;
}
template <Z A, Z B>
void pr(A a, B b)
{
  cout << a << ' ';
}

int ans = 0;
bool check = 0;
string s, t;
int N = 3;
vector<int> v(N);
int a, b;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

int main()
{
  int c, d;
  cin >> a >> b >> c;
  if ((a + b) >= c)
    Yes();
  else
    No();
  return 0;
}

Measured memory_bytes: 3640
#include "bits/stdc++.h"
using namespace std;

int get(int y, int m, int d) {
        int ans = 0;
        int dai = (y - 1) / 3;
        ans += dai * 200;
        ans += (y - 1 - dai) * 195;
        if (y % 3 == 0) {
                ans += 20 * (m - 1);
                ans += d;
        } else {
                if (m == 1) {
                        ans += d;
                } else if (m == 2) {
                        ans += 20;
                        ans += d;
                } else if (m == 3) {
                        ans += 39;
                        ans += d;
                } else if (m == 4) {
                        ans += 59;
                        ans += d;
                } else if (m == 5) {
                        ans += 78;
                        ans += d;
                } else if (m == 6) {
                        ans += 98;
                        ans += d;
                } else if (m == 7) {
                        ans += 117;
                        ans += d;
                } else if (m == 8) {
                        ans += 137;
                        ans += d;
                } else if (m == 9) {
                        ans += 156;
                        ans += d;
                } else if (m == 10) {
                        ans += 176;
                        ans += d;
                }
        }
        return ans;
}

int main() {
        int i, j;
        int n;
        cin >> n;
        int b = get(1000, 1, 1);
        while (n --) {
                int ans = 0;
                int y, m, d;
                cin >> y >> m >> d;
                int a = get(y, m, d);
                cout << b - a << endl;
        }
        return 0;
}

Measured memory_bytes: 3068