akhauriyash/Code-Regression huggingface dataset:
#pragma GCC optimize("Ofast")

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pdd;

#define X first
#define Y second

//#include <boost/unordered_map.hpp>
//using namespace boost;

/*
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> rbtree;
rbtree T;
*/

namespace io{
	const int L = (1 << 20) + 1;
	
	char buf[L], *S , *T, c;
	 
	char getchar() {
		if(__builtin_expect(S == T, 0)) {
			T = (S = buf) + fread(buf, 1, L, stdin);
			return (S == T ? EOF : *S++);
		}
		return *S++;
	}
	
	int inp() {
		int x = 0, f = 1; char ch;
		for(ch = getchar(); !isdigit(ch); ch = getchar())
			if(ch == '-') f = -1;
		for(; isdigit(ch); x = x * 10 + ch - '0', ch = getchar());
		return x * f;
	}
	
	unsigned inpu()
	{
		unsigned x = 0; char ch;
		for(ch = getchar(); !isdigit(ch); ch = getchar());
		for(; isdigit(ch); x = x * 10 + ch - '0', ch = getchar());
		return x;
	}
	
	ll inp_ll() {
		ll x = 0; int f = 1; char ch;
		for(ch = getchar(); !isdigit(ch); ch = getchar())
			if(ch == '-') f = -1;
		for(; isdigit(ch); x = x * 10 + ch - '0', ch = getchar());
		return x * f;
	}
	
	char B[25], *outs=B+20, *outr=B+20;
	template<class T>
	inline void print(register T a,register char x=0){
		if(x) *--outs = x, x = 0;
		
		if(!a)*--outs = '0';
		else 
			while(a)
				*--outs = (a % 10) + 48, a /= 10;
		
		if(x)
			*--outs = x;
		
		fwrite(outs, outr - outs , 1, stdout);
		outs = outr;
	}
};

using io :: print;
using io :: inp;
using io :: inpu;
using io :: inp_ll;

ll power(ll a, ll b, ll p)
{
	if (!b) return 1;
	ll t = power(a, b/2, p);
	t = t*t%p;
	if (b&1) t = t*a%p;
	return t;
}

const int MAXN = 200010;
const int MOD = 1000000007;
const int INF = 1000000010;

ll n, k;


int main()
{
	
	cin >> n >> k;
	ll ans = 0;
	ans = (n/k)*(n/k)*(n/k);
	if (k%2 == 0)
	{
		ll m = k/2, c = 0;
		for (ll x = m; x <= n; x += k)
			c ++;
		ans += c*c*c;
	}
	cout << ans << endl;
	
	return 0;
}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-


def main():
    """Function."""
    n = int(input())
    ls = list(map(int, input().split()))

    max_val = max(ls)
    flag = 0
    total = 0
    for i in range(n):
        if ls[i] == max_val:
            if flag == 0:
                flag = 1
                pass
            else:
                total += ls[i]
        else:
            total += ls[i]

    if max_val < total:
        print("Yes")
    else:
        print("No")



if __name__ == "__main__":
    main()


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

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            var s = Console.ReadLine();
            var ss = s.Split(' ');
            int n = int.Parse(ss[0]);
            int l = int.Parse(ss[1]);

            var tastes = new int[n];
            int mintasteabs = Math.Abs(l);
            int mintaste = l;
            for (int i = 0; i < n; i++)
            {
                tastes[i] = l + i;
                var abstaste = Math.Abs(tastes[i]);
                if (abstaste < mintasteabs)
                {
                    mintasteabs = abstaste;
                    mintaste = tastes[i];
                }
            }
            int sumtaste = -mintaste;
            for (int i = 0; i < n; i++)
            {
                sumtaste += tastes[i];
            }
            Console.WriteLine(sumtaste);

            #if DEBUG
            Console.WriteLine("続行するには何かキーを押してください．．．");
            Console.ReadKey();
            #endif
        }
    }
}


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

int main(){
    int l,r,d, cnt;
    cin >> l >> r >> d;
    cnt = 0;
    
    for(int i = l; i<=r; i++) {
        if(i%d==0) cnt++;
    }
    cout << cnt << endl;
    

}

Measured memory_bytes: 3620
#include <iostream>
#include <vector>
#include <climits>
#include <algorithm>
#include <cmath>
#include <map>
#include <set>
#include <string>
#include <bitset>
#include <utility>
#include <numeric>
#include <queue>
#include <stack>

using ll = long long;
using namespace std;

constexpr int MOD = 1e9 + 7;
constexpr ll MOD_LL = ll(1e9) + 7;

int main(void) {
	int a, b, c;
	cin >> a >> b >> c;
	
	if( a == b && b == c && c == a ) {
		if( a % 2 == 0 ) {
			cout << -1 << endl;
			return 0;
		}
	}
	
	int cnt = 0;
	while( a % 2 == 0 && b % 2 == 0 && c % 2 == 0 ) { 
		int at = a / 2;
		int bt = b / 2;
		int ct = c / 2;
		
		a = bt + ct;
		b = at + ct;
		c = at + bt;
		cnt++;
	}
	
	cout << cnt << endl;
	
	return 0;
}


Measured memory_bytes: 256
X  = int(input())

if 400 <= X < 600:
    A = 8
if 600 <= X < 800:
    A = 7
if 800 <= X < 1000:
    A = 6
if 1000 <= X < 1200:
    A = 5
if 1200 <= X < 1400:
    A = 4
if 1400 <= X < 1600:
    A = 3
if 1600 <= X < 1800:
    A = 2
if 1800 <= X < 2000:
    A = 1

print(A)


Measured memory_bytes: 9192
a,b,m=map(int,input().split())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
ans=min(a)+min(b)
for i in range(m):
    x,y,c=map(int,input().split())
    ans=min(ans,a[x-1]+b[y-1]-c)
print(ans)

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

int main()
{
    vector<int> ans;
    while (1)
    {
        int m, min, max;
        cin >> m >> min >> max;
        if (m + min + max == 0)
        {
            break;
        }

        vector<int> scoreList;
        for (int i = 0; i < m; ++i)
        {
            int input;
            cin >> input;
            scoreList.push_back(input);
        }

        int maxDif = 0, answer = min;
        for (int i = min; i <= max; ++i)
        {
            int dif = scoreList[i - 1] - scoreList[i];

            if (dif >= maxDif)
            {
                maxDif = dif;
                answer = i;
            }
        }

        ans.push_back(answer);
    }

    for (int i = 0; i < ans.size(); ++i)
    {
        cout << ans[i] << endl;
    }
}


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

using namespace std;

int t[200];
int a[200], b[200], c[200];
int dp[200][200];

int main()
{
	int d, n; cin >> d >> n;

	for (int i = 0; i < d; ++i) cin >> t[i];

	for (int i = 0; i < n; ++i) cin >> a[i] >> b[i] >> c[i];

	for (int i = 1; i < d; ++i) {
		for (int j = 0; j < n; ++j) if (a[j] <= t[i] && t[i] <= b[j]) {
			for (int k = 0; k < n; ++k) if (a[k] <= t[i - 1] && t[i - 1] <= b[k]) {
				dp[i][j] = max(dp[i][j], dp[i - 1][k] + abs(c[j] - c[k]));
			}
		}
	}

	int ans = 0;

	for (int i = 0; i < n; ++i) ans = max(ans, dp[d - 1][i]);

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

Measured memory_bytes: 1304
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string S, T;
  cin >> S >> T;
  
  int s_size = S.length();
  
  for(int i = 0; i < s_size; i++){
    if(S[i] != T[i]){
      cout << "No";
      break;
    }else if (i == s_size - 1){
	  cout << "Yes";

    }
  }
}

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

int main() {
  int x, y;
  cin >> x >> y;
  if(y % 2 == 0) {
    if(2 * x <= y && y <= 4 * x) cout << "Yes" << endl;
    else cout << "No" << endl;
  } else {
    cout << "No" << endl;
  }
}



Measured memory_bytes: 3592
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
const ll MOD = 1e9 + 7;
const ll INF = 1LL << 60;
const double PI = 3.141592653589793238;
const double EPS = 1e-10;

int main() {
	int N;
	cin >> N;
	vector<int> L;
	for (int i = 0; i < N; i++) {
		int x;
		cin >> x;
		L.push_back(x);
	}
	sort(L.begin(), L.end());
	int sum = 0;
	for (int i = 0; i + 1 < L.size(); i++) sum += L[i];
	if (sum > L[N - 1]) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
}

Measured memory_bytes: 256
//Nihal Mittal - nihal_47
//Strike First , Strike Hard , No Mercy !!

/**⠀⠀⠀⠀⠀⠀⣀⣤⣤⣄⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⣠⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣦⣀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⣰⣿⣿⣿⣿⠿⠿⣿⣿⣿⣿⣿⣿⣿⣧⢀⠀⠀⠀⠀
⠀⠀⠀⣿⣿⣿⠋⠀⠀⠀⠀⠀⠙⠀⠙⣿⣿⣿⣷⢳⢀⠀⠀⠀
⠀⠀⣠⣿⣿⣿⢸⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣿⣿⣿⣿⣿⢀
⠀⠀⣸⣿⣿⣿⠸⠀⠀⠀⠒⠒⠒⠐⠀⠀⢿⣿⣿⣿⣿⣿⠀⠀
⠀⣴⣿⣿⣿⡿⠀⠒⣋⣙⡒⢰⠀⠤⣖⠒⢾⣿⣿⣿⣿⣧⠀⠀
⢺⣿⣿⣿⣿⢀⠀⠀⠉⠉⠉⠸⠀⡇⠉⠉⠀⢿⣿⣿⣿⣄⠀⠀
⠀⠙⣿⣿⣧⢻⠀⠀⠀⠀⠀⠠⠀⠰⠀⠀⠀⣸⠸⣿⣿⠿⠰⠀
⠀⠀⠀⠹⣿⣿⣿⣷⠀⡠⠙⣲⣔⣅⢡⣰⣷⣿⣿⣿⣧⠀⠀⠀
⠀⠀⠀⣼⣿⣿⣿⣿⠀⡿⠭⠭⠭⠭⢿⠀⣿⢻⣿⣿⠃⠀⠀⠀
⠀⠀⠀⠙⠛⣿⢻⠹⣿⠐⠙⠛⠟⠉⢀⣴⡟⢿⣿⡏⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⡟⠀⠀⠻⣦⣤⣶⠾⠋⠀⠀⠁⡦⢄⢀⠀⠀⠀
⠀⠀⠀⠀⡠⠁⡇⠑⢄⠀⠀⠀⠀⠀⠀⠔⠀⠀⠁⠀⠀⠀⠉⠁
⠀⠔⠊⠁⠀⠀⣇⠀⠀⠀⠑⡤⠤⢎⠁⠀⠀⡘⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⢢⠠⠀⡠⢆⠀⠀⡠⠙⢄⠀⡸⠀
**/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ll long long
#define l long
#define mk make_pair
#define pb push_back
#define in insert
#define se second
#define fi first
#define mod 1000000007
#define watch(x) cout << (#x) << " is " << (x) << "\n"
#define all(v) (v).begin(),(v).end()
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(0);
#define pii pair<int,int>
#define maxn 100005
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update> 
using namespace std;
using namespace __gnu_pbds;

signed main()
{
    fast;
   
    ll n,k,i,ans=0;
    cin>>n>>k;
    ll a[n+2];
    for(i=0;i<n;i++) cin>>a[i];
    sort(a,a+n);
    ll mi = min(n,k);
    for(i=0;i<(n-mi);i++)
    {
    	ans += a[i];
    }
    cout<<ans;

}

Measured memory_bytes: 1792
#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
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; }

struct Sieve{
	int n;
	vector<int> f, primes;
	Sieve(int n):n(n), f(n+1){
		f[0] = f[1] = -1;
		for(long long i = 2; i <= n; i++){
			if(f[i]) continue;
			primes.push_back(i);
			f[i] = i;
			for(long long j = i*i; j <= n; j += i){
				if(!f[j]) f[j] = i;
			}
		}
	}
	bool isPrime(int x){return f[x] == x;}
	vector<int> factorList(int x){
		vector<int> res;
		while(x != 1){
			res.push_back(f[x]);
			x /= f[x];
		}
		return res;
	}
	vector<pair<int, int>> factor(int x){
		vector<int> fl = factorList(x);
		if(fl.size() == 0) return {};
		vector<pair<int, int>> res(1, pair<int, int>(fl[0], 0));
		for(int p : fl){
			if(res.back().first == p){
				res.back().second++;
			}
			else{
				res.emplace_back(p, 1);
			}
		}
		return res;
	}
};

int sum[100005];

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int q;
	cin >> q;
	memset(sum, 0, sizeof(sum));
	Sieve sie(100005);
	for(int i = 3; i < 100004; i++){
		sum[i] = sum[i-1];
		if(i%2 == 0) continue;
		if(sie.isPrime(i) && sie.isPrime((i+1)/2)) sum[i]++;
	}
	rep(i,q){
		int l, r;
		cin >> l >> r;
		cout << sum[r] - sum[l-1] << endl;
	}
	return 0;
}

Measured memory_bytes: 1536
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll,ll>;
#define REP(i, n) for (ll i = 0; i < (int)(n); i++)
#define RREP(i, n) for (ll i = (int)(n)-1; i > -1 ; i--)
#define IN(T, x) T x;cin >> x;
#define AIN(T, a, n) vector<T> a(n);REP(i, n){cin >> a[i];}
#define A2IN(T1, a, T2, b, n) vector<T1> a(n);vector<T2> b(n);REP(i, n){cin >> a[i] >> b[i];}
#define ALL(a) (a).begin(),(a).end()
#define SORT(a) sort(ALL(a))
#define RSORT(a) SORT(a);reverse(ALL(a))
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;}
#define OUT(x) cout << x << endl
#define BOUT(b) if(b){OUT("Yes");}else{OUT("No");}
const ll INF = 100000007;

int main() {
  IN(ll, N);
  AIN(ll, T, N);
  IN(ll, M);
  A2IN(ll, P, ll, X, M);
  ll sum = 0;
  for (t : T){
    sum += t;
  }
  REP(i, M){
    ll ans = sum - T.at(P.at(i) - 1) + X.at(i);
    OUT(ans);
  }
}




Measured memory_bytes: 256
//#define _GLIBCXX_DEBUG
#include <iostream>
#include <bits/stdc++.h>
    
    
using namespace std;
#define ll long long
#define ld long double
#define  P pair<ll,ll>
#define FOR(i,n,m) for(ll i=n; i<(ll)m;i++)
#define FORr(i,m,n) for(ll i=n; i>=(ll)m; i--)
#define FORm(i,m) for(auto i=m.begin();i!=m.end();i++)
#define sortAl(v) sort(v.begin(),v.end())
#define sortAlr(v) sort(v.begin(),v.end()); reverse(v.begin(),v.end())
#define cout(n) cout<<fixed<<setprecision(n)
    
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n;
    cin>>n;
    vector<ll> v(n);
    FOR(i,0,n)cin>>v[i];
    ll l=0,r=0;
    ll lp=0,rp=n-1;
    while(lp - rp != 1){
        if(l<=r){
            l += v[lp];
            lp++;
        }
        else{
            r += v[rp];
            rp--;
        }
    }

    cout<<abs(l-r)<<endl;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#ifdef tabr
#include "library/debug.cpp"
#else
#define debug(...)
#endif

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int s, w;
    cin >> s >> w;
    if (s <= w) {
        cout << "un";
    }
    cout << "safe" << '\n';
    return 0;
}

Measured memory_bytes: 3648
import java.io.PrintWriter

fun next() = readLine()!!
fun nextInt() = next().toInt()
fun nextLong() = next().toLong()
fun nextDouble() = next().toDouble()
fun nextList() = next().split(" ")
fun nextIntList() = nextList().map(String::toInt)
fun nextLongList() = nextList().map(String::toLong)
fun nextDoubleList() = nextList().map(String::toDouble)

val pw = PrintWriter(System.out)
fun print(s: Any = "") = pw.print(s)
fun println(s: Any = "") = pw.println(s)

fun <T> Iterable<T>.join(separator: CharSequence = ", ", prefix: CharSequence = "", postfix: CharSequence = "") = joinToString(separator, prefix, postfix)
fun <T> Array<T>.join(separator: CharSequence = ", ", prefix: CharSequence = "", postfix: CharSequence = "") = joinToString(separator, prefix, postfix)

fun main(args: Array<String>) {
    main()
    pw.flush()
}

fun main() {
    val (A, B, C, D) = nextIntList()
    println(Math.max(A * B, C * D))
}

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

int main(int argc, char const *argv[])
{
	int n;
	cin>>n;
    for(int i=1; i<=9; ++i)
    {
        if(n%i==0&&1<=n/i&&n/i<=9)
        {
            cout<<"Yes\n";
            return 0;
        }
    }
    cout<<"No\n";
	return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <vector>
#include <queue>
#define UNVISITED -1
#define maxn 100005
using namespace std;

typedef pair<int, int> pii;

vector<int> G[maxn];
int par[maxn];

int main(int argc, char** argv)
{
	int n, m;
	scanf("%d%d", &n, &m);
	for(int i=0; i<n; i++) par[i] = UNVISITED;
	for(int i=0; i<m; i++)
	{
		int x, y;
		scanf("%d%d", &x, &y);
		G[--x].push_back(--y);
		G[y].push_back(x);
	}
	queue<pii> q;
	q.push(pii(0, -1));
	while(!q.empty())
	{
		int room = q.front().first, p = q.front().second;
		q.pop();
		if(par[room] != UNVISITED) continue;
		par[room] = p;
		for(int i=0; i<G[room].size(); i++)
			q.push(pii(G[room][i], room));
	}
	for(int i=1; i<n; i++)
		if(par[i] == UNVISITED)
		{
			puts("No");
			return 0;
		}
	puts("Yes");
	for(int i=1; i<n; i++) printf("%d\n", par[i] + 1);
	return 0;
}

Measured memory_bytes: 12612
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <functional>
#include <map>
#include <cmath>
#include <queue>
#include <stack>

using namespace std;

class DisJointSet{
public:
    vector<int> p;              //i番目の要素の値はiの親を表す
    vector<int> rank;           //i番目の要素の高さを表す

    DisJointSet(int n){
        p.resize(n, 0);
        rank.resize(n, 0);
        for(int i=0;i<n;i++){
            makeSet(i);
        }
    }

    void makeSet(int x){
        p[x] = x;
        rank[x] = 0;
    }

    //xの属する木の代表値を返す
    int findSet(int x){

        //xとp[x]の親の値が違ったら
        if(x != p[x]){
            p[x] = findSet(p[x]);
        }

        return p[x];
    }

    bool same(int x, int y){
        return findSet(x) == findSet(y);
    }

    //xとyの代表値をくっつける
    void unite(int x, int y){
        link(findSet(x), findSet(y));
    }

    //xとyの木の高さを比べる　負けたら吸収される
    void link(int x, int y){

        //木xのほうが高かったら
        if(rank[x] > rank[y]){
            p[y] = x;
        }else{
            //yのほうが高かったら
            p[x] = y;

            if(rank[x] == rank[y]){
                rank[y]++;
            }
        }
    }



};

int main() {

    int n; scanf("%d", &n);
    int q; scanf("%d", &q);

    DisJointSet disJointSet = DisJointSet(n);

    for(int i=0;i<q;i++){
        int com; scanf("%d", &com);
        int x; scanf("%d", &x);
        int y; scanf("%d", &y);

        if(com == 0){
            disJointSet.unite(x, y);
        }else if(com == 1){
            if(disJointSet.same(x, y)){
                printf("%d\n",1);
            }else{
                printf("%d\n",0);
            }
        }

    }

    return 0;
}


Measured memory_bytes: 3308
#include <iostream>

using namespace std;

int main(int argc, char const *argv[])
{
    long K, S;
    cin >> K >> S;

    long cnt;
    for(int x=0; x <= K; x++){
        for(int y=x; y <= K; y++){
            for(int z=y; z <= K; z++){
                if(x+y+z==S){
                    if(x==y && y==z) cnt++;
                    else if(x==y || y==z) cnt +=3;
                    else cnt += 6;
                }
            }
        }
    }
    cout << cnt << endl;
    return 0;
}


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

int main() {
  string s;
  cin >> s;
  if (s == "SAT"){
    cout << 1 << endl;
  }
  else if (s == "FRI"){
    cout << 2 << endl;
  }
  else if (s == "THU"){
    cout << 3 << endl;
  }
  else if (s == "WED"){
    cout << 4 << endl;
  }
  else if (s == "TUE"){
    cout << 5 << endl;
  } 
  else if (s == "MON"){
    cout << 6 << endl;
  }
  else {
    cout << 7 << endl;
  }
}

Measured memory_bytes: 256
my $N = <STDIN>;
my $h,$n,$w;



foreach $h(1..3500){
foreach $n(1..3500){
	my $tmp;
	$tmp=4*$h*$n-$N*$h-$N*$n;
	next if ($tmp==0);
	next if($tmp<0);

	$w=($N*$h*$n)/$tmp;
#	if($w>0)
	{	
		next if($w != int ($w));

		print "$h $n $w\n";
		exit;
	}
}
}





Measured memory_bytes: 384
#include <bits/stdc++.h>
#define ll long long
using namespace std;
ll n,k,arr[100009],dp[100009];

int main()
{
    cin>>n>>k;
    for(int i=0;i<n;i++){
        cin>>arr[i];
    }
    dp[0]=INT_MAX;
    dp[1]=0;
    for(int i=2;i<=k+1;i++){
        dp[i]=abs(arr[0]-arr[i-1]);
    }
    for(int i=k+2;i<=n;i++){
        ll temp=0,ans=INT_MAX;
        for(int j=i-1;j>=i-k;j--){
            temp=dp[j]+abs(arr[i-1]-arr[j-1]);
            ans=min(ans,temp);
        }
        dp[i]=ans;
    }
    cout<<dp[n];
    return 0;
}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int,int>;
#define rep(i,n) for(int i=0; i<n; i++)
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end()) //sortしてから使う
#define INF 2147483647
#define LLINF 9223372036854775807LL

int main() {
  int x; cin>>x;
  if (x==0) cout << 1 << endl;
  else cout << 0 << endl;
}



Measured memory_bytes: 3640
a, b, k = map(int, input().split())
for i in range(k):
    if (i%2==0):
        if (a%2==1):
            a-=1
        a//=2
        b+=a
    else:
        if (b%2==1):
            b-=1
        b//=2
        a+=b
print(a, b)

Measured memory_bytes: 3060
#include<stdio.h>
int main(void)
{
	int a,b,c,d,n,i,p[100]={0};
	for(i=0;i<4;i++){
		scanf("%d %d",&a,&b);
		if(a==1)
		p[i]=6000*b;
		else if(a==2)
		p[i]=4000*b;
		else if(a==3)
		p[i]=3000*b;
		else if(a==4)
		p[i]=2000*b;
	}
	for(i=0;i<4;i++)
	printf("%d\n",p[i]);
	return 0;
}

Measured memory_bytes: 1840
#include <algorithm>
#include <bitset>
#include <cctype>
#include <complex>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>

using namespace std;

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
template<class T> inline T sqr(T x) {return x*x;}

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;

#define all(a)  (a).begin(),(a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define pb push_back
#define mp make_pair
#define each(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define exist(s,e) ((s).find(e)!=(s).end())
#define range(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)  range(i,0,n)
#define clr(a,b) memset((a), (b) ,sizeof(a))
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

const double eps = 1e-10;
const double pi  = acos(-1.0);
const ll INF =1LL << 62;
const int inf =1 << 29;

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

    int res = 1;
    rep(i, n){
        int a; cin >> a;

        res = res * a / __gcd(res, a);
    }

    cout << res << endl;

	return 0;
}

Measured memory_bytes: 1160
#include<stdio.h>

int main(){
	int N, M, i;
	if(scanf("%d%d", &N, &M));
	for(i=N; i<=M/4; i++){
		if(M%i==0){
			printf("%d\n", M/i);
			return 0;
		}
	}
	if(M%3==0 && M/3>=N){
		printf("3\n");
		return 0;
	}
	if(M%2==0 && M/2>=N){
		printf("2\n");
		return 0;
	}
	printf("1\n");
	return 0;
}


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

#define dump(...) DUMPOUT<<"  ";DUMPOUT<<#__VA_ARGS__<<" :["<<__LINE__<<":"<<__FUNCTION__<<"]"<<std::endl;DUMPOUT<<"    ";dump_func(__VA_ARGS__)
#define PI 3.14159265358979323846
#define EPS 1e-10
#define FOR(i,a,n) for(int i=(a);i<(n);++i)
#define REP(i,n)  FOR(i,0,n)
#define all(j) (j).begin(), (j).end()
#define SZ(j) ((int)(j).size())

const int D = 365;

long long eval(vector<int> out, vector<int> c, vector<vector<int>> s) {
    long long sat = 0;
    vector<int> last(26, 0);
    // for d in range(D):
    REP(d, D) {
        //     assert(1 <= out[d] and out[d] <= 26)
        assert(1 <= out[d] and out[d] <= 26);
        //     j = out[d] - 1
        int j = out[d]-1;
        //     last[j] = d + 1
        last[j] = d+1;
        //     for i in range(26):
        REP(i, 26) {
            //         sat -= (d + 1 - last[i]) * c[i]
            sat -= (d+1-last[i]) * c[i];
        }
        //     sat += s[d][j]
        sat += s[d][j];
        cout << sat << endl;
    }
        
    // print("satisfaction: {}".format(sat))
    return sat;
    // print("score: {}".format(max(0, 1000000 + sat)))
}

int main() {

    int tempD;
    cin >> tempD;

    vector<int> c(26);
    REP(i, 26) cin >> c[i];

    vector<vector<int>> s(D, vector<int>(26));
    REP(d, D) REP(i, 26) cin >> s[d][i];

    vector<int> res(D);

    REP(d, D) cin >> res[d];
    eval(res, c, s);
    

    // REP(d, D) {
    //     int t = 0;
    //     REP(i, 26) {
    //         if (s[d][i] > t) {
    //             t = s[d][i];
    //             res[d] = i+1;
    //         }
    //     }
    // }



    // for (int e : res) cout << e << endl;

    return 0;
}

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

int main() {
 long long int a,b;cin>>a>>b;
  if( min(a,b)==1 ){
    if(a==b==1) cout<<1;
    else if( min(a,b)*(max(a,b)-2) >0) cout<<min(a,b)*(max(a,b)-2);
    else cout<<0;
  }
    
 else cout<<(a-2)*(b-2)<<endl;

}






Measured memory_bytes: 256
import sys
from sys import exit
from collections import deque
from bisect import bisect_left, bisect_right, insort_left, insort_right #func(リスト,値)
from heapq import heapify, heappop, heappush
from math import *

sys.setrecursionlimit(10**6)
INF = 10**20
MOD = 10**9+7

def mint():
    return map(int,input().split())
def lint():
    return list(map(int,input().split()))
def judge(x, l=['Yes', 'No']):
    print(l[0] if x else l[1])
def lprint(l, sep='\n'):
    for x in l:
        print(x, end=sep)

R,G,B,N = mint()
ans = 0
for r in range(N//R+1):
    for g in range(N//G+1):
        tmp = N-R*r-G*g
        if tmp>=0 and tmp%B==0:
            ans += 1
print(ans)

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

typedef long long int LL;
#define REP(n) for(LL i = 0; i < (n); i++)
#define COUT(val) cout << (val) << endl
#define CIN(val) cin >> (val)
#define SORT(vec) sort(vec.begin(), vec.end())
#define SORT_GRE(vec) sort(vec.begin(), vec.end(), greater<LL>())

int main(){
    int a, b;
    cin >> a >> b;
    int ans = 1;
    ans += a-2;
    if(a <= b) ans++;
    cout <<  ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using p = pair<int, int>;
#define INF 1000000000
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repX(i, n ,x) for (int i = x; i < (int)(n); i++)
#define repBack(i, n) for (int i = n; i > 0; i--)

int main() {
    int A,B;
    cin >> A >> B;
    int now = 1;
    int ans = 0;
    while(B>now){
        now += A-1;
        ans ++;
    }
    cout << ans << endl;

    return 0;
}

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

long long GCD(long long a, long long b) {
    if (b == 0) return a;
    else return GCD(b, a % b);
}

int main(void){

  long long a, b;
  cin >> a >> b;
  
  long long gcd = GCD(a, b);
  int result = 0;
  for (long long i = 2; i * i <= gcd; ++i) {
    if (gcd % i != 0) continue;
    result++;
    while (gcd % i == 0) {
        gcd /= i;
    }
  }
  if (gcd != 1) result++;
  cout << result + 1 << endl;
  
  return 0;
}



Measured memory_bytes: 256
//! ----------------------------------------------
//! Framework <https://github.com/vain0x/procon>
//!
//! See the bottom of file for solution.
//! ----------------------------------------------

#![allow(unused_imports)]
#![allow(non_snake_case)]

use std::cell::RefCell;
use std::cmp::{max, min, Ordering};
use std::collections::*;
use std::fmt::{Debug, Display, Formatter, Write as FmtWrite};
use std::io::{stderr, stdin, BufRead, Write};
use std::mem::{replace, swap};
use std::ops::*;
use std::rc::Rc;

/// Print values to standard error if debug mode.
#[allow(unused_macros)]
macro_rules! debug {
    ($($e:expr),*) => {
        #[cfg(debug_assertions)]
        $({
            let (e, mut err) = (stringify!($e), stderr());
            writeln!(err, "\x1B[33m{}\x1B[0m = {:?}", e, $e).unwrap()
        })*
    };
}

/// Read from standard input and parse each word.
/// - `read!(T, U, ..)` parses a line as a tuple of words.
/// - `read![[T]]` parses a line as an array of words.
/// - `read![..; N]` parses `N` lines, using `read!(..)` repeatedly.
#[allow(unused_macros)]
macro_rules! read {
    ([$t:ty] ; $n:expr) =>
        ((0..$n).map(|_| read!([$t])).collect::<Vec<_>>());
    ($($t:ty),+ ; $n:expr) =>
        ((0..$n).map(|_| read!($($t),+)).collect::<Vec<_>>());
    ([$t:ty]) =>
        (rl().split_whitespace().map(|w| w.parse().unwrap()).collect::<Vec<$t>>());
    ($($t:ty),*) => {{
        let buf = rl();
        let mut w = buf.split_whitespace();
        ($(w.next().unwrap().parse::<$t>().unwrap()),*)
    }};
}

/// Read a line from standard input.
#[allow(dead_code)]
fn rl() -> String {
    let mut buf = String::new();
    stdin().read_line(&mut buf).unwrap();

    #[allow(deprecated)]
    buf.trim_right().to_owned()
}

// -----------------------------------------------
// Solution
// -----------------------------------------------

const P: i64 = 1_000_000_007;

fn main() {
    // let N = 2_000_i64;
    // let M = 2_000_i64;
    // let mut S = (0..N)
    //     .map(|i| (1 + i * i % 99_993 * i % 99_993).to_string())
    //     .collect::<Vec<_>>()
    //     .join(" ");
    // let mut T = (0..M)
    //     .map(|i| (1 + i * i % 99_993 * i % 99_997).to_string())
    //     .collect::<Vec<_>>()
    //     .join(" ");

    // println!("{} {}", N, M);
    // println!("{}", S);
    // println!("{}", T);

    let (sn, tn) = read!(usize, usize);
    let S = read![[i64]];
    let T = read![[i64]];

    let mut inc = vec![0; sn + 1];

    // dp[si] = n : S[..si] の部分列と T[..ti] の部分列の組み合わせの総数
    let mut dp = vec![1; sn + 1];

    for ti in 0..tn {
        for z in 0..sn {
            if S[z] == T[ti] {
                inc[z] += dp[z];
                inc[z] %= P;
            }
        }

        for si in 0..sn {
            dp[si + 1] = dp[si] + inc[si] % P;
            dp[si + 1] %= P;
        }

        // debug!(ti, inc, dp);
    }

    println!("{}", dp[sn])
}

/*

4 3
1 2 3 1
2 1 3

#=> 10

*/


Measured memory_bytes: 4352
package main

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

const (
	maxBufferSize     = 2000000 // check
	initialBufferSize = 20000
)

func solve() {
	sc := bufio.NewScanner(os.Stdin)
	buffer := make([]byte, initialBufferSize)
	sc.Buffer(buffer, maxBufferSize)
	// read input
	// write algorithm
	// output answer
	sc.Scan()
	s := sc.Text()

	n := len(s)
	dp := make([][]int64, n+1)
	for i := 0; i < n+1; i++ {
		dp[i] = make([]int64, 13)
	}

	p := make([]int64, n+1)
	p[0] = 1
	for i := 1; i <= n; i++ {
		p[i] = (p[i-1] * 10) % 13
	}
	const MOD int64 = 1000000007
	dp[0][0] = 1
	for i := 1; i <= n; i++ {
		for j := 0; j < 13; j++ {
			if s[i-1] == '?' {
				for x := 0; x < 10; x++ {
					for k := 0; k < 13; k++ {
						if (((p[n-i]*int64(x))%13)+int64(k))%13 == int64(j) {
							dp[i][j] = (dp[i][j] + dp[i-1][k]) % MOD
						}
					}
				}
			} else {
				x := s[i-1] - '0'
				for k := 0; k < 13; k++ {
					if (((p[n-i]*int64(x))%13)+int64(k))%13 == int64(j) {
						dp[i][j] = (dp[i][j] + dp[i-1][k]) % MOD
					}
				}
			}
		}
	}

	fmt.Println(dp[n][5])
}

func main() {
	solve()
}


Measured memory_bytes: 15488
# https://atcoder.jp/contests/abc156/submissions/10277689

# コンテスト中に通せたけどmodintクラスで実装してみる
import sys
read = sys.stdin.readline


def read_ints():
    return list(map(int, read().split()))


class ModInt:
    def __init__(self, x):
        self.x = x % MOD

    def __str__(self):
        return str(self.x)

    __repr__ = __str__

    def __add__(self, other):
        if isinstance(other, ModInt):
            return ModInt(self.x + other.x)
        else:
            return ModInt(self.x + other)

    def __sub__(self, other):
        if isinstance(other, ModInt):
            return ModInt(self.x - other.x)
        else:
            return ModInt(self.x - other)

    def __mul__(self, other):
        if isinstance(other, ModInt):
            return ModInt(self.x * other.x)
        else:
            return ModInt(self.x * other)

    def __truediv__(self, other):
        if isinstance(other, ModInt):
            return ModInt(self.x * pow(other.x, MOD - 2, MOD))
        else:
            return ModInt(self.x * pow(other, MOD - 2, MOD))

    def __pow__(self, other):
        if isinstance(other, ModInt):
            return ModInt(pow(self.x, other.x, MOD))
        else:
            return ModInt(pow(self.x, other, MOD))

    __radd__ = __add__

    def __rsub__(self, other):  # 演算の順序が逆
        if isinstance(other, ModInt):
            return ModInt(other.x - self.x)
        else:
            return ModInt(other - self.x)

    __rmul__ = __mul__

    def __rtruediv__(self, other):
        if isinstance(other, ModInt):
            return ModInt(other.x * pow(self.x, MOD - 2, MOD))
        else:
            return ModInt(other * pow(self.x, MOD - 2, MOD))

    def __rpow__(self, other):
        if isinstance(other, ModInt):
            return ModInt(pow(other.x, self.x, MOD))
        else:
            return ModInt(pow(other, self.x, MOD))


def combination_mod(n, r, mod):
    if r > n:
        return 0  # このような通りの数は無いため便宜上こう定義する
    r = min(r, n - r)
    nf = rf = 1
    for i in range(r):
        nf = nf * (n - i) % mod
        rf = rf * (i + 1) % mod
    return nf * pow(rf, mod - 2, mod) % mod


def combination(n, r):
    if r > n:
        return 0  # このような通りの数は無いため便宜上こう定義する
    r = min(r, n - r)
    nf = rf = ModInt(1)
    for i in range(r):
        nf = nf * (n - i)
        rf = rf * (i + 1)
    return nf / rf


# すべての通り(2^n-1)からnCa,nCbを引けば良い
MOD = 10**9 + 7
n, a, b = read_ints()
# tmp = pow(2, n, MOD) - 1
# ans = tmp - combination_mod(n, a, MOD) - combination_mod(n, b, MOD)
# print(ans % MOD)

tmp = ModInt(2)**n - 1
ans = tmp - combination(n, a) - combination(n, b)
print(ans)


Measured memory_bytes: 40944
#include <iostream>
#include<cstring>
using namespace std;
int main()
{
	char a[100], b[100];
	int n = 0;
	cin >> a;
	int s = strlen(a);
	for (int i = 0; i < s; i++)
	{
		if (a[i] == 'B')
		{
			n--;
			if (n < 0)
				n = 0;
		}
		else b[n++] = a[i];
	}
	b[n] = '\0';
	cout << b;
}

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

int main(){
  string s;
  string headStr,tailStr;
  cin >> s;
  while(true){
    s = s.substr(0,s.size()-1);
    if(s.size() % 2 == 0){
      headStr = s.substr(0,s.size()/2);
      tailStr = s.substr(s.size()/2 );
      //cout << headStr << endl << tailStr << endl;
      if(headStr == tailStr){
        cout << s.size() << endl;
        return 0;
      }
    }

  }
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <functional>
#include <string>
#include <cstdlib>
#include <numeric>
#include <cstdbool>
#include <map> 
using namespace std;

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 long long INF = 1LL << 60;

int main()
{
	int a,b,c;
	cin >> a >> b >> c;
	int res = b / a;
	if (res > c) {
		res = c;
	}
	cout << res << endl;
}


Measured memory_bytes: 256
#include <assert.h>
#include <limits.h>
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <complex>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>
 
using ll = long long;
using P = std::pair<ll, ll>;
 
#define rep(i, a, b) for (ll(i) = (a); i < (b); i++)
#define all(i) i.begin(), i.end()
#define debug(i) std::cerr << "debug " << i << std::endl
 
template <typename T1, typename T2>
std::ostream& operator<<(std::ostream& os, std::pair<T1, T2> pa) {
  return os << pa.first << " " << pa.second;
}
 
template <typename T>
std::ostream& operator<<(std::ostream& os, std::vector<T> vec) {
  for (int i = 0; i < vec.size(); i++)os << vec[i] << (i + 1 == vec.size() ? "" : " ");
  return os;
}
 
template<typename T1,typename T2>
inline bool chmax(T1& a,T2 b){return a<b && (a=b,true);}
 
template<typename T1,typename T2>
inline bool chmin(T1& a,T2 b){return a>b && (a=b,true);}
 
ll pow_mod(ll a, ll b, ll mod=-1) {
  if ((a == 0)||(mod!=-1&&a%mod==0)) {
    return 0;
  }
 
  ll x = 1;
 
  while (b > 0) {
    if (b & 1) {
      x = (mod!=-1)?(x * a) % mod:x*a;
    }
    a = (mod!=-1)?(a * a) % mod:a*a;
    b >>= 1;
  }
  return x;
}
 
// const ll MOD = 998244353;
const ll MOD = 1e9 + 7;



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

  ll n,k;
  std::cin>>n>>k;

  std::vector<ll> a(n);
  rep(i,0,n)std::cin>>a[i];

  std::vector<ll> positivesum(n+1,0),sum(n+1,0);

  rep(i,1,n+1){
    positivesum[i]=positivesum[i-1]+std::max(a[i-1],0ll);
    sum[i]=sum[i-1]+a[i-1];
  }

  ll ans=LLONG_MIN;

  for(ll i=0;i+k<=n;i++){
    ll val=std::max(sum[i+k]-sum[i],0ll);
    val+=positivesum[i]-positivesum[0]+positivesum[n]-positivesum[i+k];
    chmax(ans,val);
  }

  std::cout<<ans;

  return 0;
}

Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define fi first
#define se second
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repp(i, a, b) for (int i = a; i <= (b); ++i)
#define repr(i, a, b) for (int i = a; i >= (b); --i)
#define bit(n) (1LL << (n))
#define len(x) ((ll)(x).size())
#define debug(var) cout << "[" << #var << "]\n" << var << endl
#define int long long
typedef long long ll;
const int INF = 1001001001001001001ll;
const ll LINF = 1001001001001001001ll;
const int MOD = 1000000007;
const double EPS = 1e-9;

template <typename T>
ostream& operator<<(ostream& s, const vector<T>& v) {
  int len = v.size();
  for (int i = 0; i < len; ++i) {
    s << v[i];
    if (i < len - 1)
      s << ' ';
  }
  return s;
}

template <typename T>
ostream& operator<<(ostream& s, const vector<vector<T>>& vv) {
  int len = vv.size();
  for (int i = 0; i < len; ++i) {
    s << vv[i];
    if (i != len - 1)
      s << '\n';
  }
  return s;
}

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

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

__attribute__((constructor)) void initial() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(15);
}

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

  int ans = N * (N - 1) / 2 + M * (M - 1) / 2;
  cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp>
//#include <boost/lexical_cast.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>
using namespace std;
using namespace __gnu_pbds;
#define int long long
#define pb push_back
#define mp make_pair
#define endl '\n'
#define PI acos(-1)
#define bitcount(a) __builtin_popcountll(a)
#define P pair<int,int>
typedef tree<int,null_type,less_equal <int>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;

long mod=1e9+7;
signed main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int l,r;
	cin>>l>>r;
	int ans=((l%2019)*((l+1)%2019))%2019;
	for(int i=l;i<=r&&i<=l+2200;i++)
	{
		int temp;
		for(int j=i+1;j<=i+1+2200&&j<=r;j++)
		{
			temp=((i%2019)*(j%2019))%2019;
			ans=min(ans,temp);
		}
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 256
import java.io.InputStream;
import java.io.PrintStream;
import java.math.BigDecimal;
import java.util.Scanner;

public class Main {
	InputStream in = System.in;
	PrintStream out = System.out;


	public void _main(String[] args) {
		Scanner sc = new Scanner(in);

		int N = sc.nextInt();
		int[] a = new int[N];

		for (int i = 0; i < N; i++) {
			a[i] = sc.nextInt();
		}

		long ans = 0;
		for(int x : a) {
			ans += x-1;
		}
		out.println(ans);

		sc.close();

	}

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

}


Measured memory_bytes: 25704
#include<iostream>
#include<string>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<cstring>
#include<map>
#include<vector>
#include<queue>
#include<climits>
#include<set>
#include<utility>
using namespace std;
typedef long long int ll;
const ll MOD=1e9+7;

int main(){

	int n, ans=0;
	string s;
	string abc="abcdefghijklmnopqrstuvwxyz";
	bool x[26], y[26];
	memset(x, 0, sizeof(x));
	memset(y, 0, sizeof(y));
	cin >> n >> s;
	for(int i=1; i<n-1; i++){
		for(int j=0; j<i; j++){
			for(int k=0; k<26; k++){
				if(s[j]==abc[k]){
					x[k]=true;
				}
			}
		}
		for(int j=i; j<n; j++){
			for(int k=0; k<26; k++){
				if(s[j]==abc[k]){
					y[k]=true;
				}
			}
		}
		int tmp=0;
		for(int j=0; j<26; j++){
			if(x[j] && y[j]){
				tmp++;
			}
		}
		ans=max(ans, tmp);
		memset(x, 0, sizeof(x));
		memset(y, 0, sizeof(y));
	}
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
//string divide[4] = {"dream", "dreamer", "erase", "eraser"};
int main(){
int n;
cin >> n;
int t[110000],x[110000],y[110000];
t[0]=x[0]=t[0]=0;

for (int i = 0;i < n;i++){
    cin >> t[i+1] >> x[i+1] >> y[i+1];
}

bool can = true;
for (int i = 0;i < n;i++){
    int dt = t[i+1] - t[i];
    int dist = abs(x[i+1]-x[i]) + abs(y[i+1]-y[i]);
    if (dt < dist) can = false;
    if (dist % 2 != dt % 2) can =false;
}

    if(can) cout << "Yes" << endl;
    else cout << "No" << endl;
}

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

#define rep(i,x,y) for(int i=(x);i<(y);++i)
#define debug(x) #x << "=" << (x)

#ifdef DEBUG
#define _GLIBCXX_DEBUG
#define print(x) std::cerr << debug(x) << " (L:" << __LINE__ << ")" << std::endl
#else
#define print(x)
#endif

const int inf=1e9;
const int64_t inf64=1e18;
const double eps=1e-9;

template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec){
    os << "[";
    for (const auto &v : vec) {
    	os << v << ",";
    }
    os << "]";
    return os;
}

int a[400],b[400];
int64_t memo[400][401],pow_table[401][401],sum[401][401];
bool done[400][401];
int64_t mod=1000000007;

int64_t power(int64_t a,int64_t b){
    int64_t res=1;
    while(b>0){
        if(b&1) res=res*a%mod;
        a=a*a%mod;
        b/=2;
    }
    return res;
}

int64_t rec(int n,int c){
    if(done[n][c]) return memo[n][c];
    done[n][c]=true;
    int64_t &res=memo[n][c];
    if(n==0){
        rep(x,a[0],b[0]+1) res=(res+pow_table[x][c])%mod;
        return res;
    }
    rep(i,0,c+1) res=(res+rec(n-1,c-i)*(sum[b[n]][i]-sum[a[n]-1][i])%mod+mod)%mod;
    return res;
}

void solve(){
    fill_n((bool*)done,400*401,false);
    int n,c;
    cin >> n >> c;
    rep(i,0,n) cin >> a[i];
    rep(i,0,n) cin >> b[i];
    
    rep(i,0,401){
        pow_table[1][i]=sum[1][i]=1;
        rep(x,2,401){
            pow_table[x][i]=power(x,i);
            sum[x][i]=(sum[x-1][i]+pow_table[x][i])%mod;
        }
    }

    cout << rec(n-1,c) << endl;
}

int main(){
    std::cin.tie(0);
    std::ios::sync_with_stdio(false);
    cout.setf(ios::fixed);
    cout.precision(10);
    solve();
    return 0;
}


Measured memory_bytes: 4224
import java.util.*;
import java.math.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		List<Integer> list = new ArrayList<>();

		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();

		if(a==b && b==c){
			System.out.println("Yes");

		}else{
			
			System.out.println("No");
		}


	}}




Measured memory_bytes: 21844
//Mahir Ratanpara (DA-IICT)
#include<bits/stdc++.h>
using namespace std;
#define Ff(i,a,n) for(i=a;i<n;i++)
#define Fr(i,a,n) for(i=a;i>n;i--)
#define ll long long
#define FAST ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define all(x) x.begin(), x.end()
#define clr(x) memset(x, 0, sizeof(x))
#define sortall(x) sort(all(x))
#define tr(it, a) for(auto it = a.begin(); it != a.end(); it++)
#define rep(i ,n) for(int i = 0 ; i <= (n) ; i ++ )
typedef pair<ll, ll>	pa;
typedef vector<ll>		vc;
typedef vector<pa>		vp;
typedef vector<vc>		vvc;
int mpow(int base, int exp); 
void ipgraph(int m);
void dfs(int u, int par);
const int mod = 1000000007;
const int N = 3e5, M = N;
//=======================

vc g[N];
ll a[N];

int main() {
    FAST;
    string s;
	cin>>s;
	int n=s.size();
	bool ok=true;
	bool ans=true;
	rep(i,n-1){
		if(s[i]!=s[n-1-i]){
		ok=false;
		break;
		}
	}
	rep(i,n/2-1){
    if(ok&&s[i]!=s[n/2-1-i]){
       ans=false;
         break;
    }
    else if(!ok){
      ans=false;
    }
  }
  if(ans) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
    return 0;
}

int mpow(int base, int exp) {
  base %= mod;
  int result = 1;
  while (exp > 0) {
    if (exp & 1) result = ((ll)result * base) % mod;
    base = ((ll)base * base) % mod;
    exp >>= 1;
  }
  return result;
}

void ipgraph(int n, int m){
	int i, u, v;
	while(m--){
		cin>>u>>v;
		g[u-1].pb(v-1);
		g[v-1].pb(u-1);
	}
}

void dfs(int u, int par){
	for(int v:g[u]){
		if (v == par) continue;
		dfs(v, u);
	}
}

Measured memory_bytes: 7552
clst1 = [0]*1001
clst2 = [0]*1001

while True:
    inp = input()
    if inp == '':
        break

    lst = list(map(int, inp.split(',')))
    clst1[lst[0]] +=1

while True:
    try:
        lst = list(map(int,input().split(',')))
        clst2[lst[0]] +=1

    except EOFError:
        break

for i in range(1001):
    if clst1[i]*clst2[i] :
        print(str(i) + ' ' + str(clst1[i]+clst2[i]))


Measured memory_bytes: 5604
N , M , L = map(int,input().split())

lis = [ [float("inf")] * N for i in range(N) ]


for i in range(M):

    A,B,C = map(int,input().split())
    A -= 1
    B -= 1

    lis[A][B] = C
    lis[B][A] = C
    
for k in range(N):

    for i in range(N):

        for j in range(i):    

            if lis[i][j] > lis[i][k] + lis[k][j]:

                lis[i][j] = lis[i][k] + lis[k][j]
                lis[j][i] = lis[i][k] + lis[k][j]

lis2 = [ [float("inf")] * N for i in range(N) ]


for i in range(N):

    for j in range(i):

        if lis[i][j] <= L:
            lis2[i][j] = 1
            lis2[j][i] = 1

for k in range(N):

    for i in range(N):

        for j in range(i):

            if lis2[i][j] > lis2[i][k] + lis2[k][j]:

                lis2[i][j] = lis2[i][k] + lis2[k][j]
                lis2[j][i] = lis2[i][k] + lis2[k][j]

Q = int(input())

for i in range(Q):

    s,t = map(int,input().split())
    s -= 1
    t -= 1

    if lis2[s][t] == float("inf"):
        print (-1)
    else:
        print (lis2[s][t]-1)


Measured memory_bytes: 79448
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
using namespace std ;
typedef long long ll; 
ll dp[200001];

ll power( ll b, ll e)
{
	if(e==0)
		return 1;
	if(e%2)
		return b*power(b*b,(e-1)/2);
	else
		return power(b*b,e/2);
}

ll QuadCompute(ll n)
{

	if(n <= 9)
	{
		return n;
	}
	int dig,rdig,ldig,remdig;
	ll count,bkp;
	for (ll i = 200000; i > n; --i)
	{
		if(i%10 == 0)
		{
			dp[i-1] = dp[i];
			continue;
		}
		else
		{
			dig = log10(i) + 1;
			rdig = i%10;
			ldig = i /(power(10,dig-1));
			remdig = dig - 2;
			count = 0;
			bkp;
			if(ldig == rdig)
			{
				bkp = i;
				bkp = bkp - ldig*power(10,dig-1);
				bkp = (bkp - rdig)/10;

				for(int k = 0; k < remdig; ++k)
				{
					count += power(10,k);
				}
				count += bkp + 1;
				count *= 2;
				count += 1;

			}
			else if(ldig < rdig)
			{
				for(int k = 0; k < remdig; ++k)
				{
					count += power(10,k);
				}
				count *= 2;
			}
			else
			{
				for(int k = 0; k <= remdig; ++k)
				{
					count += power(10,k);
				}
				count *= 2;
			}

			dp[i-1] = dp[i] - count;

		}
	}
	return dp[n];

}


int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	ll n;
	cin >> n;
	dp[200000] = 400000008;
	cout << QuadCompute(n);
	return 0;
}

Measured memory_bytes: 1920
#include <stdio.h>

int main(void)
{
    int n;
    
    scanf("%d", &n);
    
    if(n < 105) {
        printf("0\n");
    } else if(n < 135) {
        printf("1\n");
    } else if(n < 165){
        printf("2\n");
    } else if(n < 189){
        printf("3\n");
    } else if(n < 195){
        printf("4\n");
    } else {
        printf("5\n");
    }
    
    return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <complex>
#include <cstring>
#include <cstdlib>
#include <string>
#include <cmath>
#include <queue>
#include <set>
#include <map>
using namespace std;

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
const int INF = 1<<29;

int par[10]; 
bool istop[10];
int m;
int num[10];

int solve() {
  int res = 0;
  int S = (1<<m)-1;
  while(S < (1<<10)){
    int p = 0;
    REP(i,10)
      if (S>>i&1) num[p++] = i;
    do {
      int sum = 0;
      bool ok = 1;
      REP(i,m) {
        if (num[i]==0 && istop[i]) {
          ok = 0;
          break;
        }
        sum += num[i] * par[i]; 
      }
      if (ok && sum==0) res++;
		}while(next_permutation(num, num+m));
		int x = S & -S, y = S + x;
		S = ((S & ~y) / x >> 1) | y;
	}
  return res;
}

int main() {
  int n;
  while(cin >> n , n) {
    m = 0;
    map<char,int> id;
    memset(par,0,sizeof(par));
    memset(istop,0,sizeof(istop));
    REP(i, n) {
      string s;
      cin >> s;
      int hoge = 1;
      for (int j=s.size()-1; j>=0; --j) {
        int index;
        if (id.count(s[j])) index = id[s[j]];
        else index = id[s[j]] = m++;
        if (i<n-1)
          par[index] += hoge;
        else
          par[index] -= hoge;
        hoge *= 10;
      }
      if (s.size()>1)
        istop[id[s[0]]] = 1;
    }
    cout << solve() << endl;
  }
}

Measured memory_bytes: 936