akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;

class Program
{
    static void Main(string[] args)
    {
        var AB = ReadLine().Split(' ').Select(s => long.Parse(s)).ToArray();
        var (A, B) = (AB[0], AB[1]);

        List<long> GetDivisor(long x)
        {
            var res = new List<long>();

            for (long i = 1; i * i <= x; i++)
            {
                if(x % i == 0)
                {
                    res.Add(i);
                    if (x / i != i)
                        res.Add(x / i);
                }
            }

            return res;
        }

        var aDivisor = GetDivisor(A);
        var bDivisor = GetDivisor(B);

        long Gcd(long a, long b) => (b != 0) ? Gcd(b, a % b) : a;

        var commonDivisor = aDivisor.Intersect(bDivisor).OrderBy(x => x).ToArray();

        for (int i = 0; i < commonDivisor.Length; i++)
        {
            if (commonDivisor[i] == -1)
                continue;

            for (int j = i + 1; j < commonDivisor.Length; j++)
            {
                if (commonDivisor[j] == -1)
                    continue;

                if(Gcd(commonDivisor[i], commonDivisor[j]) != 1)
                {
                    commonDivisor[j] = -1;
                }
            }
        }

        var ans = commonDivisor.Count(x => x != -1);

        WriteLine(ans);
    }
}


Measured memory_bytes: 29256
n,money=map(int,input().split())
x=-1
y=-1
z=-1
for i in range(n+1):
  for j in range(n+1-i):
    k=n-i-j
    
    if i*10000+j*5000+k*1000==money:
      x=i
      y=j
      z=k 
      break     
print(x,y,z)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
 
typedef pair<ll, int> p;

#define MOD 1000000007
 
int main() {
	cin.tie(0);
    ios::sync_with_stdio(false);

    int a;
    cin >> a;

    cout << a + a * a + a * a * a << endl;
}

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

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

using namespace std;

int n, k;
int c[100];
int dp[101][16];

int main(){
	cin >> n >> k;
	rep(i, k){
		int a, b;
		cin >> a >> b;
		c[a - 1] = b;
	}

	dp[0][0] = 1;
	rep(i, n){
		rep(j, 16){
			if(c[i]){
				if(j % 4 != c[i] || j / 4 != c[i]){
					dp[i + 1][(j % 4) * 4 + c[i]] = (dp[i][j] + dp[i + 1][(j % 4) * 4 + c[i]]) % 10000;
				}
			}
			else{
				for(k = 1; k < 4; ++k){
					if(j % 4 != k || j / 4 != k){
						dp[i + 1][(j % 4) * 4 + k] = (dp[i][j] + dp[i + 1][(j % 4) * 4 + k]) % 10000;
					}
				}
			}
		}
	}

	int ans = 0;
	rep(j, 16){
		 ans = (dp[n][j] + ans) % 10000;
	}
	cout << ans << endl;;
	return 0;
}

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

#define NEW(p,n){p=malloc((n)*sizeof(p[0]));if(p==NULL){printf("not enough memory\n");exit(1);};}
//pの型の変数n個の要素分のメモリを確保し、そのアドレスをpに代入するマクロ

#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) < (b) ? (a) : (b))

int string_len(char* str){
    int len=0;
    while(str[len]!=0){
        len++;
    }
    return len;
}

int main(void){
    //S[0]~S[N-1]に格納する
    char S[100001];
    scanf("%s",S);

    int N=string_len(S);

    int R=0;
    int B=0;
    for(int i=0;i<N;i++){
        if(S[i]=='0') R++;
        else B++;
    }

    printf("%d\n",MIN(R,B)*2);

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <sstream>
#include <iomanip> 
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <queue>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <functional>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <numeric>

using namespace std;


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

	int n, i, j, k;
	cin >> n >> k;
	vector<int> h(n), dp(n, -1000000000);
	for (i = 0; i < n; i++) cin >> h[i];
	dp[0] = 0;
	for (i = 1; i < n; i++) {
		dp[i] = dp[i - 1] + abs(h[i] - h[i - 1]);
		for (j = 2; j <= k; j++) {
			if (i - j >= 0) dp[i] = min(dp[i], dp[i - j] + abs(h[i] - h[i - j]));
		}
	}

	cout << dp[n - 1] << "\n";
	

	return 0;
}




Measured memory_bytes: 1024
class UnionFind:
    """
    size の要素数の UnionFind を管理する
    data 中の負数の要素が根となる
    """

    def __init__(self, size):
        # 根は子を含む集合のデータ数を負数でもつ
        self.data = [-1] * size

    def merge(self, x, y):
        x = self.root(x)
        y = self.root(y)
        if x == y: return False

        # y の方がデータ数を多く
        if self.data[x] < self.data[y]:
            x, y = y, x

        # y に x をつなげる
        self.data[y] += self.data[x]
        self.data[x] = y
        return True

    def root(self, x):
        if self.data[x] < 0:
            return x
        self.data[x] = self.root(self.data[x])
        return self.data[x]

    def size(self, x):
        """
        根は負数でデータ数を管理しているのでそれを返す
        """
        return -self.data[self.root(x)]

def main():
    N,M=[int(_) for _ in input().split()]
    uf = UnionFind(N)
    for i in range(M):
        x,y,z=[int(_) for _ in input().split()]
        uf.merge(x-1,y-1)

    cnt=0
    for i in range(N):
        if uf.root(i)==i:
            cnt+=1
    print(cnt)


if __name__ == '__main__':
    main()


Measured memory_bytes: 12592
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <list>
#include <queue>
#include <set>
#include <stack>
#include <vector>
using namespace std;
typedef long long ll;
#define rep(i, a, n) for (int i = (a); i < (n); i++)
#define repr(i, n, a) for (int i = (n)-1; i >= (a); i--)
#define repit(it, v) for (auto(it) = (v).begin(); (it) != (v).end(); (it)++)
#define sortt(v) sort((v).begin(), (v).end())
#define sortr(v) sort((v).rbegin(), (v).rend())
#define all(v) (v).begin(), (v).end()
#define co(x) cout << (x)
#define con(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define mkp make_pair
#define mkt make_tuple
#define pub push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
#define fir first
#define sec second
#define res resize
#define ins insert
#define era erase
// inline void fastio() { ios::sync_with_stdio(false), cin.tie(0); }
/******* Variable ***********************************/
const int maxn = 1e6 * 50;
const double inf = 0x3f3f3f3f3f;
const double pi = 3.141592653589;
/******* Function ***********************************/
/******* Main ****************************************/
void Main() {
  int a, b;
  char op;
  while (cin >> a >> op >> b && op != '?') {
    if (op == '+') con(a + b);
    if (op == '-') con(a - b);
    if (op == '*') con(a * b);
    if (op == '/') con(a / b);
  }
}

/*********************************************************
  Smaile!
▕▔╲┊┊┊┊┊┊┊┊┊╱▔▏
┊╲┈╲╱▔▔▔▔▔╲╱┈╱┊
┊┊╲┈╭╮┈┈┈╭╮┈╱┊┊
┊┊╱┈╰╯┈▂┈╰╯┈╲┊┊
┊┊▏╭╮▕━┻━▏╭╮▕┊┊
┊┊╲╰╯┈╲▂╱┈╰╯╱
                      How`s it going?
                              |＼
                      　／￣＼　ヽ
                      ／　　　ヽ |_
                      ￣＼　　　　 ＼
                      ／￣　/|/| /ﾚ､ ヽ＿
                      ￣＼ Yヘ |/ヘ幺　∠
                      　＜_|(･> <･) 6) ／
                      　　 (ﾞ　_　ﾞ／＜
                      　　　＞､ーイ￣￣
                      　　／厂ヽ／￣/＼
                      　 ( ｜　(亀)(>　)▏

                            Take a rest before getting tired!
                                        　　 ●
                                        　　/⌒ヽ
                                        　 ｜ 　|/⌒ヽ(ヽ
                                        　 (｀　∥ー⌒) |
                                        　|￣||￣￣￣￣￣|
                                        　|―||―――――|
                                        　|　Ｕ　　　　　|
                                        　|￣￣￣￣￣￣￣|
                                        　|＿＿＿＿＿＿＿|
                                        　　|―――――|
                                        　　|―――――|
                                        ｗｗＷｗｗＷｗＷＷｗ

************************************************************/
int main() {
  std::cin.tie(nullptr);
  std::ios_base::sync_with_stdio(false);
  std::cout << std::fixed << std::setprecision(15);
  Main();
  return 0;
}


Measured memory_bytes: 3116
#include <bits/stdc++.h>
#define all(x) begin(x), end(x)
#define dbg(x) cerr << #x << " = " << x << endl
#define _ << ' ' <<
using namespace std;
using ll = long long;
using vi = vector<int>;

int f(int n)
{
    int s = 0;
    while (n)
        s += n % 10, n /= 10;
    return s;
}

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    int sol = 1e9;
    for (int a = 1; a < n; ++a)
    {
        int b = n - a;
        int sa = f(a), sb = f(b);
        sol = min(sol, sa + sb);
    }
    cout << sol;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
char a[110];
int fun(int low,int high,char *str,int len)
{
	if(len==0||len==1)
		return 1;
	if(str[low]!=str[high])
		return 0;
	return fun(low+1,high-1,str,len-2);
}
int main()
{
	while(~scanf("%s",a))
	{
		int len = strlen(a);
		if(fun(0,len-1,a,len))
		{
			puts("Yes");
		}
		else
		{
			puts("No");
		}
	}
	return 0;
 } 

Measured memory_bytes: 256
import math

ab = input().split()
a, b_f = int(ab[0]), float(ab[1])

b = round(b_f * 100)

#a_a = a * b_f

#print(a, b_f)
#print(a, b)
#print(a*b)
a = a * b

#print(a_a)

print(a // 100)

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

using namespace std;

#define range(i, m, n) for(int i = m; i < n; i++)
#define husk(i, m, n) for(int i = m; i > n; i--)

struct P
{
    long long x, y;
    int id;
    P operator - (const P &a)const{
        return (P){x - a.x, y - a.y};
    }
    long long operator * (const P &a)const{
        return x * a.y - y * a.x;
    }
    long long operator ^ (const P &a) const {
      return x * a.x + y * a.y;
    }
    bool operator >( const P& a ) const{
        return x == a.x ? y < a.y : x > a.x;
    }
    bool operator <( const P& a ) const{
        return x == a.x ? y > a.y : x < a.x;
    }
};
vector<P> all;
vector<P> vex, upp, dwn;
//sort all
void uphull(){
    int m = 0;
    for(int i = 0; i < all.size(); i++){
        /*if(!i){
            upp.push_back(all[0]);
            continue;
        }*/
        P lar = all[i];
        while(m > 1 && (lar - upp[m - 2]) * (upp[m - 1] - upp[m - 2]) <= 0){
            m--;
            upp.pop_back();
        }
        upp.push_back(lar);
        m++;
    }
}
void dwhull(){
    int m = 0;
    for(int i = 0; i < all.size(); i++){
        P lar = all[i];
        while(m > 1 && (lar - dwn[m - 2]) * (dwn[m - 1] - dwn[m - 2]) >= 0){
            m--;
            dwn.pop_back();
        }
        dwn.push_back(lar);
        m++;
    }
}
void concate(){
    for(int i = 0; i < upp.size(); i++) vex.push_back(upp[i]);
    for(int i = dwn.size() - 2; i > 0; i--) vex.push_back(dwn[i]);
}

long double getAlpha(const P &a, const P &b) {
  return atan2((long double) (a * b), (long double) (a ^ b));
}

int n;

int main() {
  cout.precision(15);
  cin >> n;
  all.resize(n);
  range(i, 0, n) {
    cin >> all[i].x >> all[i].y;
    all[i].id = i;
  }
  sort(all.begin(), all.end());
  uphull();
  dwhull();
  concate();
  long double cur = 2 * 3.141592653589793238462643;
  vector<long double> res(n);
  range(i, 0, (int) vex.size()) {
    P u = vex[(i + vex.size() - 1) % vex.size()];
    P v = vex[(i + 1) % vex.size()];
    u = u - vex[i];
    v = v - vex[i];
    long double t = getAlpha(u, v);
    t = cur / 2 - t;
    res[vex[i].id] = t / cur;
  }
  range(i, 0, n) cout << res[i] << endl;
  return 0;
}


Measured memory_bytes: 256
using System;
using System.Linq;

namespace AizuOnlineJudge
{
    class Program
    {
        static void Main(string[] args)
        {
            var array = Converter(Console.ReadLine());
            Console.WriteLine(Calc(array));
        }

        static string[] Converter(string str)
        {
            return str.Split(' ');
        }

        static string Calc(string[] array)
        {
            return string.Join(" ", array.ToList().OrderBy(s => s).ToArray());
        }
    }
}



Measured memory_bytes: 10632
#include<bits/stdc++.h>
#define rep(i, n) for(int i=0; i<n; i++)
#define repo(i, n) for(int i=1; i<=n; i++)
#define INF 1001001001
#define INFll 100100100100100
// debug用
#define PrintVec(x) for (auto elementPrintVec: x) { cout << elementPrintVec << " "; } cout << endl;

using namespace std;
using ull = unsigned long long;
using ll = long long;
using P = pair<int, int>;
const int mod = 1000000007;

int main(){
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i, n){
    cin >> a[n-1-i];
  }
  vector<int> dp(n, INF);
	for (int i=0; i<n; ++i) {
		*upper_bound(dp.begin(), dp.end(), a[i]) = a[i];
	}
  int ans=lower_bound(dp.begin(), dp.end(), INF) - dp.begin();
    cout << ans << endl;
  return 0;
}


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

//{ START
using namespace std;
#define int int64_t
#define rep(i, a, n) for (int i = (a); i < (n); ++i)
#define reps(i, a, n) for (int i = (a); i > (n); --i)
#define arep(i, x) for (auto &&i : (x))
#define irep(i, x) for (auto i = (x).begin(); i != (x).end(); ++i)
//降順はgreater<T>()
#define all(x) (x).begin(), (x).end()
#define rv(s) reverse((s).begin(), (s).end())
// gcd lcmはそのままok
#define gcd(a, b) __gcd(a, b)
#define bits(n) (1 << (n))
#define pcnt(x) __builtin_popcountll(x)
//配列内等要素削除
#define unique(x) (x).erase(unique((x).begin(), (x).end()), (x).end())
#define Fixed(n) fixed << setprecision(n)
//総和
#define sowa(n) ((n) * ((n) + 1)) / 2
#define pb(x, a) (x).push_back(a)
#define fb(x, a) (x).push_front(a)
#define eb(x, a) (x).emplace_back(a)
#define F first
#define S second
#define cauto const auto &
using P = pair<int, int>;
using Graph = vector<vector<P>>;
template <class T>  //昇順
using min_heap = priority_queue<T, vector<T>, greater<T>>;
template <class T>  //降順
using max_heap = priority_queue<T>;
template <class A, class B>
using umap = unordered_map<A, B>;
template <class A>
using uset = unordered_set<A>;
template <typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val) {  //多次元初期化
  std::fill((T *)array, (T *)(array + N), val);
}
template <class T>
bool chmax(T &a, const T &b) {  //最大値更新 返り値はbool
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
bool chmin(T &a, const T &b) {  //最小値更新 返り値はbool
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
constexpr int INF = 0x3f3f3f3f;
constexpr int LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr int mod1 = 1e9 + 7;
constexpr int mod2 = 998244353;
//} END

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

  int n, m, x;
  cin >> n >> m >> x;
  vector<int> c(n);
  vector<int> a[n];

  rep(i, 0, n) {
    cin >> c[i];
    rep(j, 0, m) {
      int z;
      cin >> z;
      a[i].push_back(z);
    }
  }

  int ans = LINF;
  rep(i, 1, bits(n)) {
    vector<int> sum;
    sum.resize(100, 0);
    int cost = 0;
    rep(j, 0, n) {
      if (i & bits(j)) {
        cost += c[j];
        rep(k, 0, m) sum[k] += a[j][k];
      }
    }

    bool jud = true;
    rep(j, 0, m) if (sum[j] < x) jud = false;
    if (jud) chmin(ans, cost);
  }

  cout << (ans == LINF ? -1 : ans) << '\n';
  return 0;
}

Measured memory_bytes: 3664
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);		
		int A = sc.nextInt();
		int B = sc.nextInt();

		for(int i=0; i<1100; i++){
			if(i*8/100==A && i*10/100==B){
			System.out.println(i);
			return;
			}
		}

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



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

/*class Node{
public:
    int data;
    Node* next;
};

Node* Insert(Node* head, int x, int pos){
    if(pos<1){
        cout<<"INVALID POSITION"<<endl;
        return head;
    }
    int len=0;
    Node* temp=head;
    while(temp!=NULL){
        len++;
        temp=temp->next;
    }
    if(pos>(len+1)){
        cout<<"INVALID POSITION"<<endl;
        return head;
    }
    temp=head;
    if(pos==1){
        Node* temp1=new Node();
        temp1->data=x;
        temp1->next=head;
        head=temp1;
        cout<<"Inserted Successfully..."<<endl;
        return head;
    }
    for(int i=1; i<(pos-1); i++){
        temp=temp->next;
    }
    Node* temp1=new Node();
    temp1->data=x;
    temp1->next=temp->next;
    temp->next=temp1;
    cout<<"Inserted Successfully..."<<endl;
    return head;
}

Node* Delete(Node* head, int pos){
    if(pos<1){
        cout<<"INVALID POSITION"<<endl;
        return head;
    }
    int len=0;
    Node* temp=head;
    while(temp!=NULL){
        len++;
        temp=temp->next;
    }
    if(pos>len){
        cout<<"INVALID POSITION"<<endl;
        return head;
    }
    temp=head;
    if(pos==1){
        Node *temp1=head->next;
        delete(temp);
        head=temp1;
        cout<<"Deleted Successfully..."<<endl;
        return head;
    }
    for(int i=1; i<(pos-1); i++){
        temp=temp->next;
    }
    Node* temp1=temp->next->next;
    delete(temp->next);
    temp->next=temp1;
    cout<<"Deleted Successfully..."<<endl;
    return head;
}

void print(Node* head){
    Node* temp=head;
    cout<<"Linked List is: ";
    while(temp!=NULL){
        cout<<temp->data<<' ';
        temp=temp->next;
    }
    cout<<endl;
}

Node* pairwise_swap(Node* head){*/
    /*Node* fast=head;
    while(fast && fast->next){
        int temp=fast->data;
        fast->data=fast->next->data;
        fast->next->data=temp;
        fast=fast->next->next;
    }
    cout<<"Swapping done..."<<endl;
    return head*/

    //OR

/*    if(head==NULL || head->next==NULL){
        return head;
    }
    Node* remaining=head->next->next;
    Node* newhead=head->next;
    head->next->next=head;
    head->next=pairwise_swap(remaining);
    cout<<"Swapping done..."<<endl;
    return newhead;
}

int main(){
    Node* head=NULL;
    cout<<"PLAY WITH LINKED LISTS..."<<endl;
    while(1){
        string str;
        cin>>str;
        if(str=="INSERT"){
            int x;
            cin>>x;
            int pos;
            cin>>pos;
            head=Insert(head, x, pos);
        }
        else if(str=="DELETE"){
            int pos;
            cin>>pos;
            head=Delete(head, pos);
        }
        else if(str=="PRINT"){
            print(head);
        }
        else if(str=="PAIRWISE_SWAP"){
            head=pairwise_swap(head);
        }
        else if(str=="EXIT"){
            cout<<"Hope you enjoyed playing...Visit Again"<<endl;
            break;
        }
        else{
            cout<<"INVALID COMMAND"<<endl;
        }
    }
}*/

int main(){
    int n;
    cin>>n;
    cout<<((((n+999)/1000)*1000)-n)<<endl;
}


Measured memory_bytes: 3596
#include <iostream>
#include <algorithm>
using namespace std;
int main()
{
    char in[120];
    pair<pair<string,int>,int> p[110];
    int a;
    cin >> a;
    for (int i = 0; i < a; i++)
    {
        int t;
        cin >> in >> t;
        string tmp = in;
        p[i] = make_pair(make_pair(in, -t), i);
    }
    sort(p, p + a);
    for (int i = 0; i < a; i++)
    {
        cout << p[i].second + 1 << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int S,A,B;
int main()
{
  bool flag=false;
  int i=0;
  cin>>S>>A>>B;
  for( i=0;i<=1000;i=i+S){
    if(A<=i&&i<=B)flag=true;
  }
  if(flag){
  cout<<"OK";
  }else{
  cout<<"NG";
  }
  return 0;
}

Measured memory_bytes: 3632
#include <algorithm>
#include <cmath>
#include <deque>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <tuple>
#include <vector>
using namespace std;
typedef long long ll;

int main() {
  ll N, M;
  cin >> N >> M;
  ll a;
  priority_queue<ll> q;
  for (int i = 0; i < N; i++) {
    cin >> a;
    q.push(a);
  }
  ll max_v;
  for (int i = 0; i < M; i++) {
    max_v = q.top();
    q.pop();
    max_v /= 2;
    q.push(max_v);
  }
  ll ans = 0;
  while (!q.empty()) {
    ans += q.top();
    q.pop();
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 1400
#include <bits/stdc++.h>
using namespace std;
int main(){
  string S;
  cin >> S;
  int count = 0;
  for(int i=0;i<S.size()/2;i++){
    if(S[i]!=S[S.size()-i-1])count += 1;
  }
  cout << count << endl;
  return 0;
}

Measured memory_bytes: 256
/*
_____________________$$o____________________o$$$$$o__
___________________o$o_$$o____oo$$$$$$$oo______o$$$$o
______________$o________o$$$$$o___oo$$$$$$$o______$$$
______________$$$ooo________o$$$$o______o$$$$$o_____o
____________oo_____oo_____oo___o$$$$$______$$$$$$____
_________ooooo___$$o_$___oooooo___o$$$$o__o__o$$$$___
_______ooo__ooo$$$$o_$$ooooooooooo__o$$$o__oo_oo$$$o_
______oo_o$$o_$$_o$o_o$o__oooooooooo__o$$$o_oo__o$$$o
____oooooo$$$$o___oo__$$o_ooo_oooooooo__o$$o_ooo_o$$$
___ooooooo__o___oooo__$$ooooo$_oooooooo__o$$__ooo_$$$
_$$o_ooooo___o$$$$$o__o$o__o_$o__oooooooo_o$$o_oo__$$
_$$$o_ooo_________o$$_$$o____$$o_ooooooooo_$$$o_oo_$$
__oo________o$$o____o_$$o____o$ooooooooooo_o$$o_oo_o$
___o$$$$$$$$$$$$$o___$$$o____$$o_oooooooooo_$$$o_o_o$
________o__oo$$$$$o__$$$o____$$o____oooooo__$$$o_o_o$
_________$$$$$$$$$o__$$_____$$$o___________$$$oooooo_
__________o$$$$$$$o_________$$___________o$o___oooooo
___________o$$$$o_______________ooooo__oo$__ooo__oooo
________________________________ooo_$$oo___oooo$o____
________________________________oooo_$$$$$o___oo$$$o_
________________________________ooooo_o$$$$$o_____$$$
________________________________oooooo_o$$$$$$ooo___o
________________________________ooooooo__o$$$$$o_____
*/
#include<bits/stdc++.h>
#define ll long long
#define ft first
#define sd second
#define HageBaIO_KPOCCbI int LOL;scanf("%d", &LOL);for(int i = 0; i < LOL; i++)
#define Terrorist ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
using namespace std;
//BY |3 |<
const int dx[] = {1, 0, -1,  0};
const int dy[] = {0, 1,  0, -1};
//Where I am?
const ll N = 2e5 + 5;
const ll NN = 1e3 + 3;
const ll MOD = (1e9 + 7);
const ll MOD1 = 998244353;
const double PI = 3.14159265;
const int INF32 = 2e9;
const ll INF64 = 2e18;
//Don`t believe!!!//
int n, k, c, dp[N], x, mn;
map<int, vector<int> >mp;
string s;
void KEK(){
	cin>>n>>k>>c>>s;
	for(int i = 0; i < s.size(); i++){
		if(s[i] == 'o'){
			if(i <= c)dp[i] = 1;
			else dp[i] = max(dp[i - 1], dp[i - c - 1] + 1);
			if(dp[i] == k + 1)return;
		}
		else dp[i] = dp[i - 1];
	}
	x = k;
	mn = n - 1;
	for(int i = s.size() - 1; i >= 0; i--){
		if(s[i] == 'o'){
			if(dp[i] > x)mp[dp[i]].push_back(i + 1);
			else if(dp[i] == x && i <= mn){
				mp[dp[i]].push_back(i + 1);
				mn -= c + 1;
				x--;
			}
		}
		if(mn == i)mn--;
	}
	for(int i = 1; i <= k; i++)if(mp[i].size() == 1)cout<<mp[i][0]<<endl;
}
int main(){
	Terrorist
	//HageBaIO_KPOCCbI
	KEK();
}
//TAUMAC, 9| BbIWEJI 3A TObOU!!!
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 



Measured memory_bytes: 24340
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
#define rep(i,m,n) for(int i=m;i<n;i++)
ll mod=1e9+7;

int main(){
  int s,w;
  cin>>s>>w;
  if(w>=s) cout<<"unsafe"<<endl;
  else cout<<"safe"<<endl;
}

Measured memory_bytes: 3632
from collections import defaultdict
from math import gcd


MOD = 1000000007
N = int(input())
both_zeros_cnt = 0
bads = defaultdict(lambda: [0, 0])
for _ in range(N):
    A, B = map(int, input().split())
    if A == 0 and B == 0:
        both_zeros_cnt += 1
        continue
    if B < 0 or (B == 0 and A < 0):
        A, B = -A, -B
    g = gcd(A, B)
    A, B = A // g, B // g
    if A > 0:
        bads[(A, B)][0] += 1
    else:
        bads[(B, -A)][1] += 1


NMAX = 2 * 10 ** 5 + 1
pow2 = [1] * (NMAX + 1)
for i in range(1, NMAX + 1):
    pow2[i] = pow2[i - 1] * 2 % MOD
ans = 1
for k, l in bads.values():
    ans *= pow2[k] + pow2[l] - 1
    ans %= MOD
print((ans + both_zeros_cnt - 1) % MOD)


Measured memory_bytes: 68240
#include <iostream>
#include <vector>
#include <algorithm>
#include <string.h>
#include <iomanip>
#include <math.h>
#include <string>
#include <queue>
#include <map>
#include <set>
#include <functional>

using namespace std;

typedef long long int ll;
typedef std::pair<int, int> pii;
typedef std::pair<ll, int> pli;
typedef std::pair<ll, ll> pll;

#define FOR(i,n,m) for(ll i=(ll)(m);i<(ll)(n);++i)
#define REP(i,n) FOR(i,n,0)
#define IREP(i,n) for(ll i=(ll)(n);i>=0;--i)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll)1e15;

int main()
{
	ll a, b;
	cin >> a >> b;
	string ans = "Positive";
	if (a <= 0 && b >= 0)
	{
		ans = "Zero";
	}
	else if (b<0&&(b-a)%2==0)
	{
		ans = "Negative";
	}
	cout << ans << endl;
	return 0;
}

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

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

using namespace std;
using ll = long long;
using P = pair<int,int>;

int main(){
	
	string S, T;
	
	cin >> S >> T;
	
	string R = T.erase( S.length() );
	
	if( S == T ){
		cout << "Yes";
	}
	else{
		cout << "No";
	}
	
	return 0;
	
}


Measured memory_bytes: 3644
#include<bits/stdc++.h>
#include<iomanip>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
typedef long long ll;
typedef long  l;
typedef pair<int,int> P;
const ll INF=100000000000000001;
const double PI=3.141592653589;


int main(){
  int n,m; cin>>n>>m;
  vector<int> a(n);
  ll ans=0;
  rep(i,n){
    cin>>a[i];
    ans+=a[i];
  }
  vector<P> p(m);
  rep(i,m) cin>>p[i].second>>p[i].first;

  sort(a.begin(),a.end());
  sort(p.begin(),p.end(),greater<P>());
  // rep(i,m){
  //   cout<<p[i].second<<" "<<p[i].first<<endl;
  // }
  int id=0;
  for(int i=0;i<n;i++){
    if(i+p[id].second>=n){
      for(int j=i;j<n;j++){
        if(a[j]<p[id].first){
          ans=ans-a[j]+p[id].first;
        }
      }
    }else{
      for(int j=i;j<i+p[id].second;j++){
        if(a[j]<p[id].first){
          ans=ans-a[j]+p[id].first;
        }
      }
    }
    i+=p[id].second-1;
    id++;
    if(id>=m)
    break;
  }

  cout<<ans<<endl;

  return 0;
}


Measured memory_bytes: 1408
N = int(input())
dishes = list(map(int, input().split()))
satisfaction = list(map(int, input().split()))
additional = list(map(int, input().split()))

res = 0

for i in range(N-1):
    res += satisfaction[i]

    if dishes[i] + 1 == dishes[i+1]:
        res += additional[dishes[i] - 1]

print(res + satisfaction[-1])




Measured memory_bytes: 9124
#include <iostream>
#include <vector>
#include <string.h>
#include <set>
#include <map>
#include <unordered_map>
#include <assert.h>
#include <algorithm>
#include <queue>
#include <bitset>
#include <stack>
#include <chrono>
#include <random>
#define all(x) x.begin(),x.end()
#define ff first
#define ss second
#define ll long long
#define INF 1000000000000000000
#define MOD 1000000007
#define rnd mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define FIO ios_base::sync_with_stdio(false); cin.tie(NULL);
#define uid uniform_int_distribution <int>
using namespace std;
// Read the question carefully and see all the given sample tests
// Think about the correctness before implementing

int main() {
	int n;
	cin >> n;
	vector <int> A(n);
	int mx = -1, pos = -1;
	for (int i = 0; i < n; i++) {
		cin >> A[i];
		if(abs(A[i]) > mx) {
			mx = abs(A[i]);
			pos = i;
		}
	}
	vector <pair<int, int>> ans;
	for (int i = 0; i < n; i++) {
		if(i != pos) {
			A[i] += A[pos];
			ans.emplace_back(pos, i);
		}
	}
	if(A[0] >= 0) {
		for (int i = 1; i < n; i++) {
			A[i] += A[i - 1];
			ans.emplace_back(i - 1, i);
		}
	}
	else {
		for (int i = n - 2; i >= 0; i--) {
			A[i] += A[i + 1];
			ans.emplace_back(i + 1, i);
		}
	}
	for (int i = 1; i < n; i++) {
		assert(A[i] >= A[i - 1]);
	}
	cout << (int) ans.size() << "\n";
	for (auto g: ans) {
		cout << g.ff + 1 << " " << g.ss + 1 << "\n";
	}
}


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

if k==0:
    print(n*n)
    exit()

ans=0
for b in range(k+1,n+1):
    num = n//b
    add=num * (b-k)

    nokori = n-b*num
    if nokori-k+1 > 0:
       add+= nokori - k+1

#    print("  ",b,num,add)
    ans+=add
print(ans)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define erep(i,a,n) for(int i = a;i<=n;i++)
typedef long long ll;
#define int long long
#define vint vector<int>
#define vvint vector<vector<int>>
#define vstring vector<string>
#define vdouble vector<double>
#define vll vector<ll>:
#define vbool vector<bool>
#define INF 1101010101010101010
#define MOD 1000000007
#define P = pair<int,int>;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }

signed main(){
  int n,m;
  cin >> n >> m;
  vvint A(1000000);
  rep(i,0,n){
    int a,b;
    cin >> a >> b;
    A[a].push_back(b);
  }
  int ans = 0;
  priority_queue<int> que;
  rep(i,1,m+1){
    for(auto p:A[i]) que.push(p);
    if(!que.empty()){
      int i = que.top();
      que.pop();
      ans += i;
    }
  }
  cout << ans << endl;
}

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

using namespace std;

#define all(x) begin(x), end(x)

using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using vi = vector<int>;

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

    int x, y, a, b, c;
    cin >> x >> y >> a >> b >> c;
    vi p(a), q(b), r(c);
    for (auto& v : p)
        cin >> v;
    for (auto& v : q)
        cin >> v;
    for (auto& v : r)
        cin >> v;
    sort(all(p));
    sort(all(q));
    sort(all(r));

    constexpr int INF = 1e9;
    ll score = 0;
    int eaten = 0;
    int ex = 0;
    int ey = 0;
    while (eaten < x + y) {
        int p_cost = (p.empty() or ex == x) ? -INF : p.back();
        int q_cost = (q.empty() or ey == y) ? -INF : q.back();
        int r_cost = r.empty() ? -INF : r.back();
        int mx = max({p_cost, q_cost, r_cost});
        if (r_cost == mx) {
            score += mx;
            r.pop_back();
        } else if (ex < x and p_cost == mx) {
            score += mx;
            p.pop_back();
            ++ex;
        } else if (ey < y and q_cost == mx) {
            score += mx;
            q.pop_back();
            ++ey;
        }

        ++eaten;
    }
    
    cout << score << '\n';

    return 0;
}


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

int main(){
    int a,b;
    std::cin >> a >> b;
    if (a*b%2 == 0)
    {
        std::cout << "Even" << endl;
    }else{
        std::cout << "Odd" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;
long long l,r;
long long minn=1e16;
int main()
{
	cin>>l>>r;
	for(long long i=l;i<r;i++)
	{
		for(long long j=i+1;j<=r;j++)
		{
			long long ANS=((i%2019)*(j%2019))%2019;
			if(ANS<minn) minn=ANS;
			if(minn==0)
			{
				cout<<minn<<endl;
				return 0;
			}
		}
	}
	cout<<minn<<endl;
	return 0;
}

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

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef unordered_map<ll, ll> U_MAP;
typedef priority_queue<ll> pq;
typedef priority_queue<ll, vector<ll>, greater<ll>> rpq;
const int INF = 1e9, MOD = 1e9 + 7, ohara = 1e6 + 10;
const ll LINF = 1e18;

#define rep(i, n) for (ll(i) = 0; (i) < (int)(n); (i)++)
#define rrep(i, a, b) for (ll i = (a); i < (b); i++)
#define rrrep(i, a, b) for (ll i = (a); i >= (b); i--)
#define all(v) (v).begin(), (v).end()
#define Size(n) (n).size()
#define Cout(x) cout << (x) << endl
#define doublecout(a) cout << fixed << setprecision(15) << a << endl;
#define fi first
#define se second
#define m_p make_pair
#define p_b push_back

//------ Believe yourself as a genius!!!!!! ------

int dy[] = {1, 0, -1, 0};
int dx[] = {0, 1, 0, -1};
// int dy[]={-1,0,1,-1,1,-1,0,1};int dx[]={-1,-1,-1,0,0,1,1,1};
string alph("abcdefghijklmnopqrstuvwxyz"), s;
ll n, a[ohara], b[ohara], c, d, tmp, m, h, w, x, y, k, q, out;
V g[ohara], kae[ohara];
ll cou[ohara];
ld dp_mae[1000][1000], he[1000];
ld ans;
ll dat[1000];

void uku() {
  ld dp[n + 10] = {};
  rrrep(j, n - 2, 0) {
    rep(k, Size(g[j])) {
      ll to = g[j][k];
      dp[j] += dp[to];
    }
    dp[j] /= (ld)Size(g[j]);
    dp[j] += 1.0;
  }
  ans = dp[0];
}

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

  cin >> n >> m;
  rep(i, m) {
    cin >> a[i] >> b[i];
    a[i]--;
    b[i]--;
    g[a[i]].p_b(b[i]);
  }

  uku();

  rep(i, n - 1) {
    if (Size(g[i]) == 1) continue;
    ld dp[n + 10] = {};
    rrrep(j, n - 2, 0) {
      ld usitapunikiakunwara = -1.0;
      rep(k, Size(g[j])) {
        ll to = g[j][k];
        dp[j] += dp[to];
        if (usitapunikiakunwara <= dp[to]) usitapunikiakunwara = dp[to];
      }
      if (i == j) {
        dp[j] -= usitapunikiakunwara;
        dp[j] /= (ld)(Size(g[j]) - 1.0);
      } else {
        dp[j] /= (ld)Size(g[j]);
      }
      dp[j] += 1.0;
    }
    if (ans >= dp[0]) {
      ans = dp[0];
    }
  }
  doublecout(ans);
  return 0;
}


Measured memory_bytes: 55808
#include<iostream>
#include<cstdio>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
#define INF 1e6
using namespace std;

int dist[200][200];
int mincost[200];
bool used[200];
int n,m,a,b,d;
	
int prim(){
	int ans=0;
	rep(i,n){mincost[i]=INF;used[i]=false;}
	mincost[0]=0;
	while(1){
		int v=-1;
		rep(u,n)if(!used[u] && (v==-1 || mincost[u]<mincost[v]))v=u;
		if(v==-1)break;
		used[v]=true;
		ans+=mincost[v];
		rep(u,n)mincost[u]=min(mincost[u],dist[v][u]);
	}
	return ans;
}

int main(){
	while(cin>>n,n){
		cin>>m;
		rep(i,n)rep(j,n)dist[i][j]=(i==j)?0:INF;
		rep(i,m){scanf("%d,%d,%d",&a,&b,&d);dist[a][b]=dist[b][a]=d/100-1;}
		cout<<prim()<<endl;
	}
	return 0;
}

Measured memory_bytes: 1320
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
#define ll          long long
#define pb          push_back
#define INF         9223372036854775807
#define    endl        '\n'
#define pii         pair<ll int,ll int>
#define vi          vector<ll int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (ll int)x.size()
#define hell        1000000007
#define rep(i,a,b)    for(ll int i=a;i<b;i++)
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define mp          make_pair
#define lower(u)    transform(u.begin(), u.end(), u.begin(), ::tolower);//convert string u to lowercase;
#define upper(u)    transform(u.begin(), u.end(), u.begin(), ::toupper);
using namespace std;

using namespace __gnu_pbds; 
  
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 
#define N  100005

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    int TESTS=1;
//    cin>>TESTS;
    while(TESTS--)
    {
        ll n;
        cin>>n;
        set<string>s;
        rep(i,0,n)
        {
            string c;
            cin>>c;
            s.insert(c);
        }        
        cout<<s.size()<<endl;
    }
    return 0;
}

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

int main()
{
    string S;
    int Q;
    cin >> S >> Q;
    bool hanntenn = false;
    int T,F;
    string C;
    for (int i = 0; i < Q; i++)
    {
        cin >> T;
        if (T == 1)
        {
            hanntenn = !hanntenn;
        }else if (T == 2)
        {
            cin >> F >> C;
            if (F == 1)
            {
                if (hanntenn == true)
                {
                    S += C;
                }else{
                    S.insert(0,C);
                }
            }else if (F == 2)
            {
                if (hanntenn == true){
                    S.insert(0,C);
                }else{
                    S += C;
                }

            }
        }
    }
    if (hanntenn == true){
        reverse(S.begin(),S.end());
    }
    cout << S;
}

Measured memory_bytes: 900
def get_i() #空白区切の入力を数値(整数)の配列で返す
  return gets.chomp.split(" ").map(&:to_i)
end
def get_f() #空白区切の入力を数値(実数)の配列で返す
  return gets.chomp.split(" ").map(&:to_f)
end
def get() #空白区切の入力を文字列の配列で返す
  return gets.chomp.split(" ")
end
def get_nsp() #入力されたものを一文字ずつに区切った文字列の配列で返す
  return gets.chomp.split("")
end
def yn_judge(bool,y="Yes",n="No") #boolに真偽を投げることで、trueならy、falseならnの値を出力する
  return bool ? y : n 
end
def array(size1,init=nil,size2=-1) #size2に二次元配列時の最初の要素数、size1に次の配列の大きさ、initに初期値を投げることでその配列を返す
  if size2==-1
    return Array.new(size1){init}
  else
    return Array.new(size2){Array.new(size1){init}}
  end
end

puts 2.0*3.141592653589793*gets.to_i

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

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

	vector< int > A( N );
	for ( int &a : A )
	{
		cin >> a;
	}

    string ans = "APPROVED";
    for(auto itr = A.begin(); itr != A.end(); ++itr){
        if(*itr % 2 == 0){
            if((*itr % 3 != 0) && (*itr % 5 != 0)){
                ans = "DENIED";
            }
        }
    } 

    cout << ans << endl;

    return 0;
}

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

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

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

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

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

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

int main() {
	ll x;
	cin >> x;

	ll n = x / 11; // (5,6) or (6,5) のペア数でわる
	ll m = x % 11; // 残りの数
	ll result = n*2;

	int min = 1000000;
	rep(i, 2) { // 1, 6 始まりとそれ以外でパターンを分ける
		int count = 0, temp = m;
		bool flag = true;
		while (temp > 0) {
			if (i == 0) { // 1, 6 始まり
				temp -= flag ? 5 : 6;
			} else { // それ以外
				temp -= flag ? 6 : 5;
			}
			count++;
			flag = !flag;
		}
		if (min > count) min = count;
	}

	cout << (result + min) << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
	string s,t;
	cin>>s>>t;
	int mn=1e9;
	for(int i=0;i<=s.size()-t.size();i++){
		int x=0;
		for(int j=0;j<t.size();j++){
			if(s[j+i]!=t[j])x++;
		}
		mn=min(mn,x);
	}
	cout<<mn<<endl;
	return 0;
}

Measured memory_bytes: 3596
#include <bits/stdc++.h>
using namespace std;
 
int main(void) 
{
    int N;
    cin >> N;

    vector<int> A(N);

    for(int i=0;i<N;++i)
    {
        cin >> A[i];
    }

    int ans = 1;

    int gl = 0;
    for(int i=1;i<N;++i)
    {
        int d = 0, k = 0;

        if (A[i-1]<A[i]) d=1;
        else if (A[i-1]>A[i]) d=-1;
        else d = 0;
        if (gl!=0&&d!=0&&gl!=d) 
        {
            ans++;
            gl = 0;
        }
        else
        {
            if (d!=0) gl=d;
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 640
#include <stdio.h>
#define arr_print_d0dn(a,n) for(int i=0;i<(n)-1;++i)put_uint((a)[i]),putchar_unlocked(' ');put_uint((a)[(n)-1]),putchar_unlocked('\n')
#define arr_rprint_d0dn(a,n) for(int i=(n)-1;i>0;--i)put_uint((a)[i]),putchar_unlocked(' ');put_uint(*(a)),putchar_unlocked('\n')
#define arr_print_dndn(a,n) for(int i=0;i<(n);++i)put_uint((a)[i]),putchar_unlocked('\n')
#define arr_rprint_dndn(a,n) for(int i=(n)-1;i>=0;--i)put_uint((a)[i]),putchar_unlocked('\n')


void put_uint(int n) {
    if(!n) {
        putchar_unlocked('0');
        return;
    }
    char buf[11];
    int i = 0;
    while(n) buf[i++] = (char)(n % 10 + '0'), n /= 10;
    while(i--)putchar_unlocked(buf[i]);
}
int get_uint() {
    int n = 0;
    int c = getchar_unlocked();
    if(c < 48 || 57 < c) return c;
    while(47 < c && c < 58) {
        n = 10 * n + (c & 0xf);
        c = getchar_unlocked();
    }
    return n;
}

int insertion_sort(int *a, const int N, const int G) {
    int cnt = 0;
    for(int i = G; i < N; ++i) {
        int tmp = a[i];
        int j = i - G;
        while(j >= 0 && a[j] > tmp) {
            // G: gap
            a[j + G] = a[j];
            j -= G;
            cnt++;
        }
        a[j + G] = tmp;
    }
    return cnt;
}

void shell_sort(int *a, const int N) {
    int cnt = 0;
    // m: g-arr size
    int m = 0;
    int G[100] = {};
    // h: well known value (from Wikipedia)
    for(int h = 1; h <= N; h = 3 * h + 1) {
        G[m] = h;
        m++;
    }
    for(int i = m - 1; i >= 0; --i) {
        // insertion sort with G[i] gap
        cnt += insertion_sort(a, N, G[i]);
    }

    put_uint(m);
    putchar_unlocked('\n');
    arr_rprint_d0dn(G, m);
    put_uint(cnt);
    putchar_unlocked('\n');
    arr_print_dndn(a, N);
}

int main() {
    int n = get_uint();
    int a[n];
    for(int i = 0; i < n; ++i) {
        a[i] = get_uint();
    }
    shell_sort(a, n);
    return 0;
}



Measured memory_bytes: 5504
#include <stdio.h>
int main(){
  int r,D;
  int x[11]={};
  scanf("%d%d%d",&r,&D,&x[0]);
  
  
  for (int i=0;i<=10;i++){
    x[i+1]=r*x[i]-D;
  }
  
  for (int i=1;i<=10;i++){
    printf("%d\n",x[i]);
  }
  
  return 0;
}


Measured memory_bytes: 1732
#include <cmath>
#include <cstdlib>
#include <iostream>
#include <bitset>
#include <deque>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <iterator>
#include <string>
#include <chrono>
#include <random>
#include <tuple>
#include <utility>
#include <fstream>
#include <complex>

const long INF = (1l << 30);
const long LINF = (1l << 60);

long n;
long a[100005];
std::string s[100005];

int main(){
    scanf("%ld", &n);
    for(int i = 0; i < n; i++){
        std::cin >> a[i];
        s[i] = std::bitset<60>(a[i]).to_string();
        //std::cout << s[i] << std::endl;
    }
    bool ans = true;
    for(int i = 0; i < n; i++){
        if(a[i] != 0){
            ans = false;
        }
    }
    if(ans){
        printf("Yes\n");
        return 0;
    }
    for(int i = 0; i < 60; i++){
        long cnt[2] = {0,0};
        for(int j = 0; j < n; j++){
            cnt[s[j][i] - '0']++;
        }
        if(!(cnt[1] == 0 || cnt[0] * 2 == cnt[1])){
            printf("No\n");
            return 0;
        }
    }
    std::set<long> st;
    for(int i = 0; i < n; i++){
        st.insert(a[i]);
    }
    if(st.size() <= 3){
        printf("Yes\n");
    }else{
        printf("No\n");
    }
}


Measured memory_bytes: 11136
def main():
    k = int(input())
    a, b = map(int,input().split())
    a_mod = a % k
    a_dev = a // k
    if a_mod != 0 and (a_dev + 1) * k > b:
        print ("NG")
    else:
        print("OK")
      

if __name__ == '__main__':
  main()

Measured memory_bytes: 9168
#include <algorithm>
#include <iostream>
#include <queue>
#include <stdio.h>
#include <string>

using namespace std;

void solve(int N, int M, vector<pair<long long, long long>> AB) {
  long long rem = M;
  long long ans = 0;
  for (auto x : AB) {
    long long a = x.first;
    long long b = x.second;
    int cnt = min(rem, b);
    ans += a * cnt;
    rem -= cnt;
    if (rem == 0) {
      break;
    }
  }
  printf("%lld\n", ans);
}
int main() {
  int N, M;
  scanf("%d %d", &N, &M);
  vector<pair<long long, long long>> AB(N);
  for (int i = 0; i < N; i++) {
    long long a, b;
    scanf("%lld %lld", &a, &b);
    AB[i] = make_pair(a, b);
  }
  sort(AB.begin(), AB.end());
  solve(N, M, AB);
  return 0;
}


Measured memory_bytes: 3328
#include <bits/stdc++.h>
#define FOR(I,X,Y) for(int (I)=(X);(I)<(Y);(I)++)
#define REP(I,X,Y) for(int (I)=(Y)-1;(I)>=(X);(I)--)
#define ALL(X) (X).begin(),(X).end()
#define INF 1000000007
#define LINF 1000000000000000007
typedef long long ll;
using namespace std;

int main(){
  int A,B,C;
  string S;
  cin >> A >> B;
  cout << (A%2 && B%2 ? "Yes" : "No") << endl;
}


Measured memory_bytes: 256
import java.util.*;

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

		int W = sc.nextInt();
		int H = sc.nextInt();
		int x = sc.nextInt();
		int y = sc.nextInt();
		int r = sc.nextInt();
		
		boolean n = true;
		if(x-r >= 0) {
			if(y-r >= 0){
				if(x+r <= W) {
					if(y+r <= H){
						System.out.println("Yes");
						n = false;
					}
				}
			}
		}
		if(n) System.out.println("No");
		
		
	}
}




Measured memory_bytes: 26204
#include <bits/stdc++.h>
#define base 1000000007LL
#define ll long long
#define X first
#define Y second
#define pb push_back
#define MAXN 21010
#define Scan(a) scanf("%I64d", &a)
#define CLR(a) memset(a,0,sizeof(a))
#define FOR(i,a,b) for(int i=(a),_b=(b); i<=_b; i++)
#define FORE(i,a,b) for(int i=(a),_b=(b); i>=_b; i--)

using namespace std;

typedef pair<ll, ll> II;
typedef vector<II> vi;

string s;

int main()
{
    ios::sync_with_stdio(0);
    //freopen("inp.txt", "r", stdin);
    //freopen("out.txt", "w", stdout);
    cin >> s;
    FOR(i,0,s.length()-1)
        if (s[i] == ',') s[i] = ' ';
    cout << s;
    return 0;
}


Measured memory_bytes: 256
num_list = input().split(" ")
num_list = list(map(lambda x: int(x), num_list))
N, A, B = num_list
out = 0

for n in range(1, N+1):
  n_sum = 0
  tmp_n = n
  
  while(True):    
    div, mod = divmod(tmp_n, 10)
    n_sum += mod
    if div == 0:
      break
    else:
      tmp_n = div
  
  if n_sum >= A and n_sum <= B:
    out += n
print(out)

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

public class Main {
    static StringTokenizer st;
    static BufferedReader br;  
    static PrintWriter out;
 
    public static void main(String[] args) throws IOException {
        br = new BufferedReader(new InputStreamReader(System.in));

        
        int A = nextInt();//health 
        int B = nextInt();//strength 
        int C = nextInt();
        int K = nextInt();
 
        int sum = 0;
  
        if(K>=A){
            sum += A;
            K = K-A;
        }
        else{
            sum += K;
            K=0;
        }
        if(K>=B){  
            K = K-B;
        } 
        else{
            K=0;
        }
        if(K>=C){
            sum += -C;
            K = K-A;
        }
        else{
            sum += -K;
        }
  
        System.out.println(sum);
    }
    
      
    public static int nextInt() throws IOException {
        return Integer.parseInt(next());
    }
    public static long nextLong() throws IOException {
        return Long.parseLong(next());
    }

    public static double nextDouble() throws IOException {
        return Double.parseDouble(next());
    }

    static String next() throws IOException {
        while (st == null || !st.hasMoreTokens())
            st = new StringTokenizer(br.readLine().trim());
        return st.nextToken();
    }
}

Measured memory_bytes: 32592