akhauriyash/Code-Regression huggingface dataset:
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {
  private static class FastScanner {
    private BufferedReader reader = null;
    private StringTokenizer tokenizer = null;

    public FastScanner(InputStream in) {
      reader = new BufferedReader(new InputStreamReader(in));
      tokenizer = null;
    }

    public String next() {
      if (tokenizer == null || !tokenizer.hasMoreTokens()) {
        try {
          tokenizer = new StringTokenizer(reader.readLine());
        } catch (IOException e) {
          throw new RuntimeException(e);
        }
      }
      return tokenizer.nextToken();
    }

    public String nextLine() {
      if (tokenizer == null || !tokenizer.hasMoreTokens()) {
        try {
          return reader.readLine();
        } catch (IOException e) {
          throw new RuntimeException(e);
        }
      }

      return tokenizer.nextToken("\n");
    }

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

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

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

    public int[] nextIntArray(int n) {
      int[] a = new int[n];
      for (int i = 0; i < n; i++)
        a[i] = nextInt();
      return a;
    }

    public long[] nextLongArray(int n) {
      long[] a = new long[n];
      for (int i = 0; i < n; i++)
        a[i] = nextLong();
      return a;
    }
  }

  public static void main(String[] args) {
    FastScanner sc = new FastScanner(System.in);
    long h = sc.nextLong();
    int n = sc.nextInt();
    long[] a = sc.nextLongArray(n);
    long sum = 0;
    for (long ai : a) sum += ai;
    System.out.println(h <= sum ? "Yes" : "No");
  }
}

Measured memory_bytes: 33620
N = int(input())
G = [[-1] * N for i in range(N)]
ans = 0
for i in range(N):
    A = int(input())
    for j in range(A):
        x, y = map(int, input().split())
        G[i][x-1] = y
for bit in range(2**N):
    honests = []
    for i in range(N):
        if bit & (1<<i):
            honests.append(i)
    flag = True
    for j in honests:
        for k in range(N):
            if (k in honests) and G[j][k] == 0:
                flag = False
            elif(k not in honests) and G[j][k] == 1:
                flag = False
    if flag:
        ans = max(ans, len(honests))
print(ans)


Measured memory_bytes: 9132
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vl = vector<ll>;
template<class T> using vc = vector<T>;
template<class T> using vvc = vector<vector<T>>;

#define eb emplace_back
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define repr(i, n) for (ll i = (n)-1; i >= 0; i--)
#define repe(i, l, r) for (ll i = (l); i < (r); i++)
#define reper(i, l, r) for (ll i = (r)-1; i >= (l); i--)
#define repa(i,n) for (auto& i: n)

template<class T> inline bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> inline bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
void init() {cin.tie(0);ios::sync_with_stdio(false);cout << fixed << setprecision(15);}

#ifdef DEBUG
template <class T, class N> void verr(const T& a, const N& n) { rep(i, n) cerr << a[i] << " "; cerr << "\n" << flush; }
ll dbgt = 1; void err() { cerr << "passed " << dbgt++ << "\n" << flush; }
template<class H, class... T> void err(H&& h,T&&... t){ cerr<< h << (sizeof...(t)?" ":"\n") << flush; if(sizeof...(t)>0) err(forward<T>(t)...); }
#endif

const ll INF = 4e18;
const ld EPS = 1e-11;
const ld PI = acos(-1.0L);
const ll MOD = 1e9 + 7;
// const ll MOD = 998244353;
//--------------------------------------------------------------------------------//

int main() {
    init();
    ll N,T;
    cin >> N >> T;
    vl A(N);
    rep(i, N) cin >> A[i];

    vl m(N);
    m[0] = A[0];
    rep(i, N - 1) m[i + 1] = min(m[i], A[i + 1]);

    ll d = 0;
    rep(i, N) chmax(d, A[i] - m[i]);

    ll ans = 0;
    rep(i, N) ans += (A[i] - m[i] == d);

    cout << ans << endl;
}

Measured memory_bytes: 4760
n = gets.chomp.to_i
words = []
n.times do
  words << gets.chomp.to_s
end

ans = "Yes"
if n != words.uniq.length
  ans = "No"
end

previous_last = words[0][0]
words.each do |word|
  unless word.start_with?(previous_last)
    ans = "No"
    break
  end
  previous_last = word[-1]
end

puts ans


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

using namespace std;
typedef long long ll;
typedef long double ld;
const int MOD = 1000 * 1000 * 1000 + 7;

int main() {
	//freopen("in.txt", "r", stdin); freopen("out.txt", "w", stdout);
	int n;
	cin >> n;
	int a, cnt_odd = 0;
	for (int i = 0; i < n; ++i) {
		cin >> a;
		if (a & 1) ++cnt_odd;
	}
	if (cnt_odd & 1) {
		cout << "NO\n";
		return 0;
	}
	cout << "YES\n";	
	return 0;
}


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

namespace _0027
{
    class Program
    {
        static void Main(string[] args)
        {
            string input = "";
            while (!(input = Console.ReadLine()).StartsWith("0"))
            {
                int[] inputMonthDay = input.Split(' ').Select(int.Parse).ToArray();
                DateTime newDay = new DateTime(2004, inputMonthDay[0], inputMonthDay[1]);
                Console.WriteLine(newDay.DayOfWeek);
            }
        }
    }
}



Measured memory_bytes: 17152
#include <algorithm>
#include <bitset>
#include <cfloat>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits.h>
#include <map>
#include <math.h>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <string.h>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<=n;i++)
#define int long long
#define ll long long
#define eps LDBL_EPSILON
#define mod 10000000
#define int long long
#define double long double
#define INF LLONG_MAX/10
#define P pair<int,int>
#define prique priority_queue
using namespace std;
signed main() {
	int n, d;
	cin >> n >> d;
	cout << (n + 2 * d) / (2 * d + 1) << endl;
	return 0;
}

Measured memory_bytes: 256
dataset_count = STDIN.gets.to_i

dataset_count.times{|i|
    point = STDIN.gets.split(" ")
    point.map! {|p| p.to_i }
    a,b,c = point.sort
    if a**2 + b**2 == c**2
        puts "YES"
    else
        puts "NO"
    end
}

Measured memory_bytes: 6104
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
      String[] nyu=sc.nextLine().split("");

 //    String nyu=sc.nextLine();
//int A=Integer.parseInt(nyu[0]);
//int B=Integer.parseInt(nyu[1]);
//int C=Integer.parseInt(nyu);


//double A=Double.parseDouble(nyu[0]);
//double B=Double.parseDouble(nyu[1]);
/*
switch(C){
case 7:
case 5:
case 3:
System.out.println("YES") ;
break;
default:
System.out.println("NO") ;

break;
}
*/

int res=0;

for(String tem:nyu){
if(tem.equals("-")){
res--;
}else{
res++;
}

}

System.out.println(res);



	}
}

Measured memory_bytes: 21844
#include <bits/stdc++.h>
#define pb push_back
#define ll long long
#define in insert
#define sz(x) ((in)(x).size())
using namespace std;
const int N = 123;
double a[N];
int n;
double ans;

void read_file()
{
    freopen("text.in","r",stdin);
    freopen("text.out","w",stdout);
}

void solve()
{
    cin >> n;
    for (int i = 0; i < n; i++)
        cin >> a[i];
    sort(a, a + n);
    double tmp = (a[0] + a[1]) / 2;
    if (n <= 2)
    {
        printf("%.9f\n",tmp);
        return;
    }
    ans = tmp;
   // printf("%.9f\n", tmp);
    for (int i = 2; i < n; i++){
        tmp += a[i];
        tmp/=2;
//        printf("%.9f\n",tmp);
    //    ans += tmp;
    }
    printf("%.9f\n", tmp);
}

int main()
{
    solve();
   // cerr << printf("Time %.2f\n", (double) clock() / CLOCKS_PER_SEC);
    return (0);
}




Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
vector<int>v,q,e;
int main(){
	//freopen("readin.txt","r",stdin);
	int n;
	scanf("%d",&n);
	for(int i = 0;i < n;i++){
		int a;
		scanf("%d",&a);
		if(a%4 == 0)v.push_back(a);
		else if(a&1)q.push_back(a);
		else e.push_back(a);
	}
	vector<int>ans;
	while(!q.empty()){
		ans.push_back(q.back());
		q.pop_back();
		if(!v.empty()){
			ans.push_back(v.back());
			v.pop_back();
		}
	}
	while(!v.empty())ans.push_back(v.back()),v.pop_back();
	while(!e.empty())ans.push_back(e.back()),e.pop_back();
	for(int i = 0;i < ans.size() - 1;i++)if((ans[i]*ans[i + 1])%4 != 0)return puts("No"),0;
		puts("Yes");
}

Measured memory_bytes: 1404
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pi;
typedef pair<pi, pi> pp;
typedef pair<ll, ll> pl;
const double EPS = 1e-9;
const ll MOD = 998244353;
const int inf = 1 << 30;
const ll linf = 1LL << 60;

int n, w;
ll p[100];
int sz[100];
vector<pi> e[100];
bool saw[100];

void dfs (int v, int par, vector<ll>& dp) {
    rep(i,e[v].size()) {
        if (e[v][i].first == par) continue;
        if (saw[e[v][i].first]) continue;
        vector<ll> tmp(w+1, -linf);
        for (int j = e[v][i].second; j <= w; j++) {
            tmp[j] = dp[j-e[v][i].second];
        }
        dfs(e[v][i].first, v, tmp);
        rep(j,w+1) dp[j] = max(dp[j], tmp[j]);
    }
    rep(i,w+1) dp[i] += p[v];
}

int calc_sz (int v, int p) {
    sz[v] = 1;
    rep(i,e[v].size()) {
        if (e[v][i].first == p) continue;
        if (saw[e[v][i].first]) continue;
        calc_sz(e[v][i].first, v);
        sz[v] += sz[e[v][i].first];
    }
    return sz[v];
}

int get_cen (int v, int p, int s) {
    rep(i,e[v].size()) {
        if (e[v][i].first == p) continue;
        if (saw[e[v][i].first]) continue;
        if (sz[e[v][i].first]*2 >= s) return get_cen(e[v][i].first, v, s);
    }
    return v;
}

int main() {
    cin >> n >> w;
    rep(i,n) cin >> p[i];
    rep(i,n-1) {
        int u, v, c;
        cin >> u >> v >> c;
        u--; v--;
        e[u].push_back(pi(v,c));
        e[v].push_back(pi(u,c));
    }
    ll ans = 0;
    queue<int> que;
    que.push(0);
    while (!que.empty()) {
        int q = que.front(); que.pop();
        if (saw[q]) continue;
        int s = calc_sz(q, q);
        int c = get_cen(q, q, s);
        rep(i,e[c].size()) {
            if (saw[e[c][i].first]) continue;
            que.push(e[c][i].first);
        }
        vector<ll> dp(w+1, -linf);
        dp[0] = 0;
        dfs(c, c, dp);
        ans = max(ans, *max_element(dp.begin(), dp.end()));
        saw[c] = true;
    }
    cout << ans << endl;
}



Measured memory_bytes: 32592
#include <bits/stdc++.h>
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define all(x) x.begin(), x.end()
#define endl "\n"
#define sz(x) (int)(x).size()
using namespace std;
typedef long long int lli;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;

int main() {

  #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    freopen("error.txt", "w", stderr);
  #endif

    ios::sync_with_stdio(0);
    cin.tie(0);

    ll n;
    cin >> n;
    ll sum = 0;
    for (ll i = 1; i <= n; i++) {
        if (i % 3 == 0 && i % 5 == 0)
            continue;
        else if (i % 3 == 0)
            continue;
        else if (i % 5 == 0)
            continue;
        else
            sum += i;
    }
    cout << sum << endl;
    return 0;
}

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

ans = [0 for _ in range(n+1)]

for i in range(n):
    ans[i+1] = ans[i] + l[i]

num = 2020202020
for i in range(1,n):
    num = min(num,abs(ans[n] - ans[i]*2))

print(num)


Measured memory_bytes: 26268
N=int(input())
n1,n2,n4=0,0,0
for i in input().split():
  if int(i)%4==0:
    n4+=1
  elif int(i)%2==0:
    n2+=1
  else:
    n1+=1
if n2==0:
  if n4>=n1-1:
    print("Yes")
  else:
    print("No")
else:
  if n4>=n1:
    print("Yes")
  else:
    print("No")
    
   

Measured memory_bytes: 11480
n=int(input())
n+=1
a=list(map(int,input().split()))
nokori=[0]*n

gen=0
for i in range(n):
    m=n-i-1
    gen+=a[m]
    nokori[m]=gen

kazu=[0]*n
kazu[0]=1
kano=True

for i in range(1,n):
    active=kazu[i-1]-a[i-1]
    if(active<=0):
        kano=False
        #print("だめ")
        break
    kazu[i]=min(active*2,nokori[i])

if(kazu[n-1]!=a[n-1]):
    kano=False

if(kano):
    print(sum(kazu))
else:
    print(-1)

Measured memory_bytes: 22144
'''h2d5
ポイントは重複組み合わせ（仕切りと中身）と素因数因数分解
N+素因数分解の指数-1から指数を選ぶ組み合わせ（指数-1が仕切りの枚数）
nPr=n!/(n-r)!   
nCr=n!/(n-r)!*r!=(n*(n-1)*...*(n-r+1))/r!(分子分母は共にｒ個)
'''
import math
MOD=10**9+7

def comb(n,r):
  nPr=1
  fact_r=1
  for i in range(r):
    nPr*=n-i
    fact_r*=r-i
  return nPr//fact_r

N,M=map(int,input().split())
fact={}
for i in range(2,int(math.sqrt(M))+1):
  if M==1:
    break
  while(M%i==0):#エラトステネスの篩
    M//=i
    if not i in fact:#素因数がなければ追加
      fact[i]=1
    else:#素因数があれば増加
      fact[i]+=1  
if M!=1:#素数のケース
  fact[M]=1
  
answer=1
for r in fact.values():
  answer*=comb(N+r-1,r)#重複組み合わせ
  answer%=MOD
  
print(answer)

Measured memory_bytes: 3064
#ifdef DEBUG_IS_VALID
#define DEB 1 
#define _LIBCPP_DEBUG 0
#else
#define DEB 0
#define NDEBUG
#endif

#include <bits/stdc++.h>
using namespace std;

#define ALL(g) (g).begin(),(g).end()
#define REP(i, x, n) for(int i = x; i < n; i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i, x, n) for(int i = x; i >= n; i--)
#define rrep(i, n) RREP(i,n,0)
#define pb push_back
#pragma GCC optimize ("-O3")

using namespace std;

#define DUMPOUT cout
#define dump(...) if(DEB) DUMPOUT<<"  "<<#__VA_ARGS__<<" :["<<__LINE__<<":"<<__FUNCTION__<<"]"<<endl<<"    "; if(DEB) dump_func(__VA_ARGS__)
template<typename T1,typename T2>ostream& operator << (ostream& os, pair<T1,T2> p){cout << "(" << p.first << ", " << p.second << ")"; return os;}
template<typename T>ostream& operator << (ostream& os, vector<T>& vec) { os << "{"; for (int i = 0; i<vec.size(); i++) os << vec[i] << (i + 1 == vec.size() ? "" : ", "); os << "}"; return os; }
template<typename T>ostream& operator << (ostream& os, set<T>& st){cout << "{"; for(auto itr = st.begin(); itr != st.end(); itr++) cout << *itr << (next(itr)!=st.end() ? ", " : ""); cout << "}"; return os;}
template<typename T1,typename T2>ostream& operator << (ostream& os, map<T1,T2> mp){cout << "{"; for(auto itr = mp.begin(); itr != mp.end(); itr++) cout << "(" << (itr->first) << ", " << (itr->second) << ")" << (next(itr)!=mp.end() ? "," : ""); cout << "}"; return os; }

void dump_func(){DUMPOUT << endl;}
template <class Head, class... Tail>void dump_func(Head&& head, Tail&&... tail){ DUMPOUT << head; if (sizeof...(Tail) == 0) { DUMPOUT << " "; } else { DUMPOUT << ", "; } dump_func(std::move(tail)...);}
template<class T> inline bool chmax(T& a,T const& b){if(a>=b) return false; a=b; return true;}
template<class T> inline bool chmin(T& a,T const& b){if(a<=b) return false; a=b; return true;}

using ll = long long;
using P = pair<int,int>;
using Pl = pair<ll,ll>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;
using vp = vector<Pl>;
using vvp = vector<vp>;

const int INF = 1<<29;
const long long LINF=1LL<<59;


void solve(long long N, long long K, std::vector<long long> V){
  ll ans = 0;
  rep(K2,K+1){
    // 全体 : K2
    rep(x,K2+1){
      // remove : x
      ll s = K2-x;
      rep(l,s+1){
        // pick : s
        ll r = s-l;
        // [0,l), [N-r,N)
        dump(l,r,x,K2);
        vl temp;
        if(N-r<=l) temp = V;
        else{
          rep(i,l) temp.pb(V[i]);
          REP(i,N-r,N) temp.pb(V[i]);
        }
        sort(ALL(temp));
        rep(i,min(x,int(temp.size()))){
          if(temp[i]>=0) break;
          temp[i] = 0;
        }
        ll ts = 0;

        for(auto t:temp) ts += t;
        chmax(ans,ts);
      }
    }
  }
  cout << ans << endl;
}

int main(){
  long long N;
  scanf("%lld",&N);
  long long K;
  scanf("%lld",&K);
  std::vector<long long> V(N);
  for(int i = 0 ; i < N ; i++){
    scanf("%lld",&V[i]);
  }
  solve(N, K, std::move(V));
  return 0;
}


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

#ifdef LOCAL
#define debug(var) cerr << (#var) << " = " << (var) << endl;
#else
#define debug(var)
#endif

void init() {
  ios_base::sync_with_stdio(0);
  cin.tie(0); cout.tie(0);
}

const int mod = 1e9+7;
const int N = 1e5+23;

int n;
string l;

long long dp[N][2];

long long rek(int pos, int f) {
  if (pos == n) return 1;
  long long &ret = dp[pos][f];
  if (ret != -1) return ret;
  ret = 0;
  int lmt = f?1:(l[pos]-'0');
  for (int i = 0; i <= lmt; ++i) {
    int nf = f;
    if (f == 0 && i < lmt) nf = 1;
    long long tmp = rek(pos+1, nf);
    if (i == 1) tmp = tmp*2%mod;
    ret = (ret + tmp) % mod;
  }
  return ret;
}

void solve() {
  memset(dp, -1, sizeof(dp));
  cin >> l;
  n = l.size();
  cout << rek(0, 0);
}

int main() {
  init();
  int t = 1; //scanf("%d", &t);
  while (t--) {
    solve();
  }
  return 0;
}


Measured memory_bytes: 13112
#include <iostream>
#include <string>

typedef long long ll;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define MOD 1000000007
using namespace std;

#ifdef DEBUG
    #define IFD if(true)
#else
    #define IFD if(false)
#endif

int main()
{
    string S, T;
    cin >> S >> T;

    int ans = 0;
    rep(i, 3) {
        if(S[i] == T[i]) ans++;
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
MOD = 10**9+7
N = int(input())
A = list(map(int,input().split()))
ruiseki = [A[i] for i in range(N)]

for i in range(1,N):
    ruiseki[i]=ruiseki[i]+ruiseki[i-1]

ans = 0
for i in range(1,N):
    ans =(ans + ((A[i]%MOD)*(ruiseki[i-1]%MOD))%MOD)%MOD

print(ans)


Measured memory_bytes: 102080
#include<bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); i++)
#define vi vector<int>
#define all(x) (x).begin(),(x).end()
#define INF (1<<30)-1
using ll = long long;
using namespace std;
template<class T> inline bool chmax(T &a, const T &b){ if(a<b) { a=b; return 1; } return 0; }
template<class T> inline bool chmin(T &a, const T &b){ if(b<a) { a=b; return 1; } return 0; }

int main(){
  cin.tie(0), ios::sync_with_stdio(false);
  string k; cin >> k;
  int n = stoi(k);
  if(n % 2 == 0){
    cout << -1;
    return 0;
  }
  int cnt = k.size();
  int tmp = 0;
  rep(i,k.size()){
    tmp *= 10;
    tmp += 7;
  }
  while(true){
    int res = tmp/n;
    tmp -= res*n;
    if(tmp == 0){
      cout << cnt;
      return 0;
    }
    tmp *= 10;
    tmp += 7;
    cnt++;
    if(1e8 < cnt) break;
  }
  cout << -1;
  cout << "\n";
  return 0;
}


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

#define int long long



signed main() {
    int N;
    cin >> N;
    vector<int> A(N);
    for(int i=0; i<N; i++){
        cin >> A[i];
    }
    vector<int> l(N,A[0]), r(N,A[N-1]);

    for(int i=1; i<N; i++){
        l[i] = max(l[i-1], A[i]);
    }
    for(int i=N-2; i>=0; i--){
        r[i] = max(r[i+1], A[i]);
    }
    
    for(int i=0; i<N; i++){
        if(i==0) cout << r[1] << endl;
        else if(i==N-1) cout << l[N-2] << endl;
        else
            cout << max(l[i-1], r[i+1]) << endl;
    }
    
    
    return 0;
}


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

using namespace std;

typedef long long LL;

const int N = 1010;

int n, m;
char g[N][N];

void calc(int r, int c)
{
    int dx[3] = {-1, 0, 1};
    int dy[3] = {-1, 0, 1};

    int cnt = 0;
    for(int i = 0; i < 3; i++)
        for(int j = 0; j < 3; j++)
            if(i != 1 || j != 1)
                if(g[r - dx[i]][c - dy[j]] == '#')
                    cnt++;

    g[r][c] = cnt + '0';
}

int main()
{
    cin >> n >> m;
    for(int i = 1; i <= n; i++)
        scanf("%s", g[i] + 1);

    for(int i = 1; i <= n; i++)
        for(int j = 1; j <= m; j++)
            if(g[i][j] == '.')
                calc(i, j);

    for(int i = 1; i <= n; i++)
        puts(g[i] + 1);

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <climits>
#include <cmath>
#include <utility>
#include <string>
#include <cstring>
#include <functional>

using namespace std;

const int mo = 2019;

int main() {

	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	
	long long l, r;
	cin >> l >> r;
	if (r - l + 1 >= 2019) {
		cout << 0 << endl;
		return 0;
	}

	long long ans = mo;
	for (long long i = l; i < r && ans > 0; ++i)
		for (long long j = i+1; j <= r; ++j)
			ans = min(ans, i * j % mo);

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<string>
#define mm(a,x) memset(a,x,sizeof(a))
#define sync std::ios::sync_with_stdio(false);std::cin.tie(0)
#define ll long long
using namespace std;
string s,t;
int main(void)
{
    sync;
    cin>>s>>t;
    int res=0x3f3f3f3f;
    for(int l=0;l+t.size()<=s.size();++l)
    {
        string now=s.substr(l,t.size());
        int sum=0;
        for(int i=0;i<now.size();++i)
            sum+=(now[i]!=t[i]);
        res=min(sum,res);
    }
    cout<<res<<endl;
    return 0;
}

Measured memory_bytes: 3180
#include <stdio.h>

int yen(int w)
{
	int yen = 1150;
	
	if (w > 0){
		if (w < 10){
			yen += 125 * (w % 10);
			w -= w % 10;
		}
		else {
			yen += 125 * 10;
			w -= 10;
		}
	}
	if (w > 0){
		if (w < 10){
			yen += 140 * (w % 10);
			w -= w % 10;
		}
		else {
			yen += 140 * 10;
			w -= 10;
		}
	}
	if (w > 0){
		yen += 160 * w;
	}
	
	return (yen);
}

int main(void)
{
	int w;
	
	while (scanf("%d", &w), w != -1){
		printf("%d\n", 4280 - yen(w - 10));
	}
	
	return (0);
}

Measured memory_bytes: 600
#include<stdio.h>
#include<string.h>
int main(){
  char s[5];
  scanf("%s",s);
  int n=strlen(s);
  if(n==3){
    printf("%c%c%c\n",s[2],s[1],s[0]);
  }
  else puts(s);
  return 0;
}


Measured memory_bytes: 128
#include<cstdio>
#include<cmath>
#include<iostream>
#include<algorithm>
#include<queue>
using namespace std;
struct edge{long long int to,cost;};
struct info{
    long long int p,co;
    bool operator<(const info &a)const{
        if (co==a.co )p>a.p;
        return co>a.co ;
    }
};
vector<edge> E[100001];
long long int mini[100001];
void dijkstra(int s,int g){
    for(int i=0;i<100001;i++)mini[i]=2000000000000000000;
    mini[s]=0;
    priority_queue<info>Q;
    info kari;
    kari.p=s,kari.co=0;
    Q.push(kari);
    while(!Q.empty()){
        info now=Q.top ();Q.pop();
        for(int i=0;i<E[now.p].size();i++){
            if(mini[E[now.p][i].to]>mini[now.p]+E[now.p][i].cost){
                mini[E[now.p][i].to]=mini[now.p]+E[now.p][i].cost;
                kari.p=E[now.p][i].to,kari.co=mini[E[now.p][i].to];
                Q.push(kari);
            }
        }
    }
}
int N,M,s,t;
long long int lis[100000][4];
long long int miniA[100001],miniB[100001];
int main(){
    cin>>N>>M>>s>>t;
    for(int i=0;i<M;i++){
        for(int j=0;j<4;j++)cin>>lis[i][j];
    }

    for(int i=0;i<M;i++){
        edge kariedge;
        kariedge.to=lis[i][1];
        kariedge.cost=lis[i][2];
        E[lis[i][0]].push_back(kariedge);
        kariedge.to=lis[i][0];
        kariedge.cost=lis[i][2];
        E[lis[i][1]].push_back(kariedge);
    }
    dijkstra(s,0);
    for(int i=0;i<100001;i++)miniA[i]=mini[i];

/*
    for(int i=1;i<=4;i++){
        for(int j=0;j<E[i].size();j++){
            printf("[%d]->[%lld] [%lld]\n",i,E[i][j].to,E[i][j].cost);
        }
    }
*/



    for(int i=0;i<100001;i++){
        E[i].clear();
    }

    for(int i=0;i<M;i++){
        edge kariedge;
        kariedge.to=lis[i][1];
        kariedge.cost=lis[i][3];
        E[lis[i][0]].push_back(kariedge);
        kariedge.to=lis[i][0];
        kariedge.cost=lis[i][3];
        E[lis[i][1]].push_back(kariedge);
    }
    dijkstra(t,0);
    for(int i=0;i<100001;i++)miniB[i]=mini[i];

    for(int i=1;i<5;i++){
        //printf("[%lld][%lld]\n",miniA[i],miniB[i]);
    }

    long long int ansmini=2000000000000000000;
    long long int ans[100003];
    for(int i=N;1<=i;i--){
        ans[i]=min(ansmini,miniA[i]+miniB[i]);
        ansmini=min(ansmini,miniA[i]+miniB[i]);
    }
    for(int i=1;i<=N;i++){
        cout<<1000000000000000-ans[i]<<endl;
    }
    return 0;
}


Measured memory_bytes: 15616
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <stdio.h>
#include <cmath>
#include <cctype>
#include <map>

const int INT_INF = 1000000000;                 // 10^9
const long long LONG_INF = 1000000000000000000; // 10^18

using namespace std;

int main()
{
    string s;
    cin >> s;

    for (int i = 0; i < 3; i++)
    {
        if (s[i] == s[i + 1])
        {
            cout << "Bad" << endl;
            return 0;
        }
    }

    cout << "Good" << endl;

    return 0;
}

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

using namespace std;

#define rep(i , l , r) for(int i = (l) , ___ = (r) ; i <= ___ ; ++i)
#define per(i , r , l) for(int i = (r) , ___ = (l) ; i >= ___ ; --i)

#define DEBUG(...) fprintf(stderr , __VA_ARGS__)

template<typename T>inline int chkmin(T &x , const T &y){ return x > y ? x = y , 1 : 0; }
template<typename T>inline int chkmax(T &x , const T &y){ return x < y ? x = y , 1 : 0; }

template<typename T>inline T read(T &f)
{
	f = 0 ; int x = 1 ; char c = getchar();
	while(!isdigit(c)) x = c == '-' ? -1 : 1 , c = getchar();
	while(isdigit(c)) (f *= 10) += c & 15 , c = getchar();
	return f *= x;
}

using int64 = long long;
using uint64 = unsigned long long;

const int N = 300000 + 5 , KCZ = 998244353;

int n ; char S[N];

inline int inc(const int &x) { return x >= KCZ ? x - KCZ : x; }
inline int dec(const int &x) { return x < 0 ? x + KCZ : x; }
inline void add(int &x , const int &y) { x = inc(x + y); }
inline void sub(int &x , const int &y) { x = dec(x - y); }

int a , b , c , Ans = 1 , ab , bc , ac;

int main()
{
	read(n) , scanf("%s" , S + 1);
	rep(i , 1 , 3 * n)
	{	
		if(S[i] == 'R') // a
		{
			if(bc != 0)
			{
				Ans = 1ll * Ans * (bc--) % KCZ;
			}
			else if(b)
			{
				Ans = 1ll * Ans * (b--) % KCZ;
				ab++;
			}
			else if(c)
			{
				Ans = 1ll * Ans * (c--) % KCZ;
				ac++;
			}
			else a++;
		}
		else if(S[i] == 'G') // b
		{
			if(ac != 0)
			{
				Ans = 1ll * Ans * (ac--) % KCZ;
			}
			else if(a)
			{
				Ans = 1ll * Ans * (a--) % KCZ;
				ab++;
			}
			else if(c)
			{
				Ans = 1ll * Ans * (c--) % KCZ;
				bc++;
			}
			else b++;
		
		}
		else // c
		{
			if(ab != 0)
			{
				Ans = 1ll * Ans * (ab--) % KCZ;
			}
			else if(b)
			{
				Ans = 1ll * Ans * (b--) % KCZ;
				bc++;
			}
			else if(a)
			{
				Ans = 1ll * Ans * (a--) % KCZ;
				ac++;
			}
			else c++;	
		}
	}
	rep(i , 1 , n) Ans = 1ll * Ans * i % KCZ;
	cout << Ans << endl;
	return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#define rep(i,n); for(int i = 0;i < (n);i++)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
long double pi = acos(-1);
const int INF = 1001001001;


// 最小公倍数を求める
int euqlid (int a, int b){
  int temp;
  temp = a % b;
  if(temp == 0)return b;
  return euqlid(b,temp);
}
ll conbination(ll a,ll b){
  ll u = 1;
  ll d = 1;
  while(b != 0){
    u *= a;
    d *= b;
    a--;
    b--;
  }
  return u / d;
}
int strtoint(char s){
  return (int(s-'0'));
}
char changeS(char alpha){
  if(0x41 <= alpha and alpha <= 0x5A)return (alpha + 0x20);
  else if(0x61 <= alpha and alpha <= 0x7A)return (alpha - 0x20);
  return alpha;
}
int fact(int n){
  if(n == 1)return 1;
  return n * fact(n-1);
  }



int main(){
  string a,b,c;
  cin >> a >> b >> c;
  cout << changeS(a[0]) << changeS(b[0]) << changeS(c[0]) << endl;
}


Measured memory_bytes: 256
h, w = [int(x) for x in input().split()]
s_list = [input() for _ in range(h)]

iso_flag = [[True] * w for _ in range(h)]
for i in range(h):
    for j in range(w):
        if s_list[i][j] == ".":
            continue

        flag_r = True
        if j < w - 1 and s_list[i][j + 1] == "#":
            flag_r = False
            iso_flag[i][j + 1] = False
        
        flag_d = True
        if i < h - 1 and s_list[i + 1][j] == "#":
            flag_d = False
            iso_flag[i + 1][j] = False
        
        if iso_flag[i][j] and flag_r and flag_d:
            print("No")
            exit()
print("Yes")

Measured memory_bytes: 3064
//In The Name Of Allah
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define sz(x) (int)(x.size())
#define double long double 
#define fi first
#define se second
#define pii pair<int, int>

signed main() {
	ios::sync_with_stdio(false); cin.tie(nullptr);
  int D, G;
  cin >> D >> G;
  int p[D], c[D];
  for (int i = 0; i < D; i++) {
    cin >> p[i] >> c[i];
  }
  int ans = 123423588979;
  for (int b = 0; b < (1 << D); b++) {
    int g = G, num = 0;
    for (int i = 0; i < D; i++) {
      if (b & (1 << i)) {
        num += p[i];
        g -= p[i] * (i + 1) * 100 + c[i];
      }
    }
    if (g > 0) {
      for (int i = D - 1; i >= 0 && g > 0; i--) {
        if (!(b & (1 << i))) {
          if ((p[i] - 1) * (i + 1) * 100 > g) {
            int cl = ceil(g / ((i + 1) * 100));
            g -= cl * (i + 1) * 100;
            num += cl;
          } else {
            g -= (p[i] - 1) * (i + 1) * 100;
            num += p[i] - 1;
          }
        }
      }
    }
    if (g <= 0) {
      ans = min(ans, num);
    }
  }
  cout << ans << "\n";
}



Measured memory_bytes: 256
#include<iostream>

using namespace std;

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

int t[16][17];
int dp[1 << 16];
int INF = 10e8;

int main(){
    while(1){
        int n;
        cin >> n;
        if(n==0) break;

        REP(i, n){
            REP(j, n+1){
                int ct;
                cin >> ct;
                t[i][j] = ct;
            }
        }

        REP(i, 1 << n){
            dp[i] = INF;
        }
        dp[0] = 0;

        REP(i, 1 << n){
            REP(j, n){
                if((i>>j) & 1) continue;
                int tmpmin = t[j][0];
                REP(k, n){
                    if((i>>k) & 1){
                        tmpmin = min(tmpmin, t[j][k+1]);
                    }
                }
                dp[i|1<<j] = min(dp[i|1<<j], dp[i] + tmpmin);
            }
        }
        cout << dp[(1 << n) - 1] << endl;
    }
}

Measured memory_bytes: 3300
let rec seq s t = if s > t then [] else s :: seq (s + 1) t

let comb lst = 
  let rec iter ret = function
    | [] -> ret
    | hd :: tl -> iter (ret @ List.map (fun x -> hd :: x) ret) tl
  in iter [[]] lst

let _ = 
  try
    while true do
      let n, s = Scanf.scanf "%d %d\n" (fun x y -> (x, y)) in
      if n = 0 && s = 0 then
        raise End_of_file
      else
        Printf.printf "%d\n" @@ List.length @@ List.filter (fun x -> x = s) @@ List.map (List.fold_left (+) 0) @@ List.filter (fun x -> List.length x = n) @@ comb @@ seq 0 9
    done
  with
    End_of_file -> ()

Measured memory_bytes: 4596
import java.util.*;

class Main{
    public static void main(String[] args){
        Scanner cin = new Scanner(System.in);
        String line;
        int n = 0;
        int h = 0;
        int w = 0;
        
        for(int i = 0; cin.hasNext(); i++){
	        line = cin.nextLine();
	        
	        if(i == 0) {
	            n = Integer.parseInt(line);
	            
	        } else if(i == 1) {
	            h = Integer.parseInt(line);
	            
	        } else if(i == 2) {
	            w = Integer.parseInt(line);
	            
	        } else {
	            
	        }
	        
        }
        
        int _h = n - h;
        int _w = n - w;
        
        if(_h < 0 || _w < 0) {
            System.out.println(0);
            
        } else {
            System.out.println((_h + 1) * (_w + 1));
        
        }
        
    }
    
}


Measured memory_bytes: 21716
n = int(input())
a = list(map(int,input().split()))
ans = 0
tmp_id = 1
ng = True
for i in range(n):
    if a[i]!=tmp_id:
        ans+=1
    else:
        tmp_id+=1
        ng = False
if ng:
    ans = -1
print(ans)

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

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

if n % 2 == 0:
    left = sorted([i*2+1 for i in range(n//2)], reverse=True)
    for i in range(len(left)):
        left[i] = A[left[i]]
    print(' '.join(list(map(str, left)) + [str(A[j*2]) for j in range(n//2)]))
else:
    left = sorted([i*2+2 for i in range(n//2)], reverse=True)
    for i in range(len(left)):
        left[i] = A[left[i]]
    print(' '.join(list(map(str, left)) + [str(A[0])] + [str(A[j*2+1]) for j in range(n//2)]))


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

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

  vector<int> cards(N);
  for (int i=0; i<N; i++){
    cin >> cards.at(i);
  }
  
  int score=1;
  int mochipoint;
  
  for (int i=1; i<N; i++){
    mochipoint=1;
    for (int j=0; j<i; j++){
      if(cards.at(j) == cards.at(i)){
        mochipoint=0;
        break;
      }
    }
    score += mochipoint;
  }
  cout << score << endl;
}


Measured memory_bytes: 3624
#include <bits/stdc++.h>
#define MOD 1000000007
#define INF 1000000000
#define LINF 1000000000000000000
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define bit(n) (1LL<<(n))
using namespace std;

typedef pair<int, int> P;
typedef pair<long long, long long> LLP;

int main() {

    int N, M, X;
    cin >> N >> M >> X;

    vector<int> C(N);
    vector<vector<int>> A(N, vector<int>(M));
    rep(i,N) {
        cin >> C[i];
        rep(j,M) cin >> A[i][j];
    }

    int ans = INF;

    rep(i,bit(N)) {
        vector<int> count(M, 0);
        int money = 0;
        rep(j,N) {
            if (i & bit(j)) {
                money += C[j];
                rep(k,M) count[k] += A[j][k];
            }
        }
        sort(count.begin(), count.end());
        if (count[0] >= X) ans = min(ans, money);
    }
    
    cout << (ans == INF ? -1 : ans) << endl;

    return 0;
}

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

int main(){
  string str1, str2;
  int n,t=0,h=0;
  cin>>n;
  
  for(int i=0;i<n;i++){
  cin>>str1>>str2;
  if ( str1>str2) t+=3;
  else if ( str1 < str2 ) h+=3;
  else {t+=1;h+=1;};
  }
  cout << t << " "<<h<<endl;
  return 0;
}


Measured memory_bytes: 3144
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
using datas=pair<ll,ll>;
using tdata=pair<ll,datas>;
using vec=vector<ll>;
using mat=vector<vec>;
using pvec=vector<datas>;
using pmat=vector<pvec>;
#define For(i,a,b) for(i=a;i<b;i++)
#define bFor(i,a,b) for(i=a;i>=b;i--)
#define rep(i,N) For(i,0,N)
#define rep1(i,N) For(i,1,N)
#define brep(i,N) bFor(i,N-1,0)
#define all(v) (v).begin(),(v).end()
#define allr(v) (v).rbegin(),(v).rend()
#define vsort(v) sort(all(v))
#define vrsort(v) sort(allr(v))
#define mod 1000000007
#define endl "\n"
#define output(v) do{bool f=0;for(auto i:v){cout<<(f?" ":"")<<i;f=1;}cout<<endl;}while(0)

long mmid(long a,long b,long c){return a<b?(b<c?b:max(a,c)):(b>c?b:min(a,c));}

ll modinv(ll a) {
  ll b=mod,u=1,v=0,t;
  while(b){
    t=a/b;
    a-=t*b; swap(a,b);
    u-=t*v; swap(u,v);
  }
  return (u+mod)%mod;
}

ll moddevide(ll a,ll b){return (a*modinv(b))%mod;}

ll modncr(ll n,ll r){
  ll i,plus=1;
  rep(i,r){
    plus=(plus*(n-i))%mod;
    plus=moddevide(plus,i+1);
  }
  return plus;
}

ll modncrlistp[200000],modncrlistm[200000];

ll modncrs(ll n,ll r){
  ll i,j;
  if(modncrlistp[n]==0){
    for(i=n;i>=0;i--){
      if(modncrlistp[i])break;
    }
    if(i<0){
      modncrlistp[0]=1;
      rep1(i,n+1){
        modncrlistp[i]=(modncrlistp[i-1]*i)%mod;
      }
    }else{
      For(j,i+1,n+1){
        modncrlistp[j]=(modncrlistp[j-1]*j)%mod;
      }
    }
  }
  if(modncrlistm[n]==0){
    for(i=n;i>=0;i--){
      if(modncrlistm[i])break;
    }
    if(i<0){
      modncrlistm[0]=1;
      rep1(i,n+1){
        modncrlistm[i]=(modncrlistm[i-1]*modinv(i))%mod;
      }
    }else{
      For(j,i+1,n+1)modncrlistm[j]=(modncrlistm[j-1]*modinv(j))%mod;
    }
  }
  return (((modncrlistp[n]*modncrlistm[r])%mod)*modncrlistm[n-r])%mod;
}

ll gcd(ll a,ll b){if(!b)return a;return (a%b==0)?b:gcd(b,a%b);}

ll countdigits(ll n){
  ll ans=0;
  while(n){n/=10;ans++;}
  return ans;
}

ll sumdigits(ll n){
  ll ans=0;
  while(n){ans+=n%10;n/=10;}
  return ans;
}

vec eratosthenes(ll N){
  ll i;
  vec ch(N+1,1),p;
  ch[0]=ch[1]=0;
  rep(i,N+1){
    if(ch[i]){
      p.push_back(i);
      for(ll j=2;i*j<=N;j++){
        ch[i*j]=0;
      }
    }
  }
  return ch;
}

int main(){
  ll i,N,A,B,C,D,sa;
  cin>>N>>A>>B>>C>>D;
  sa=B-A;
  rep(i,N){
    if(C*i-D*(N-i-1)<=sa&&sa<=D*i-C*(N-i-1)){
      cout<<"YES"<<endl;
      return 0;
    }
  }
  cout<<"NO"<<endl;
  return 0;
}

Measured memory_bytes: 764
#include<iostream>
#include<vector>
#include<cmath>
#include<algorithm>
#include<iomanip>
#include<map>
#define ran(x) (x).begin(),(x).end()
using namespace std;
int main() {
	int n; cin >> n;
	vector<int> a(n);
	for(int i = 0; i < n; ++i) {
		cin >> a[i];
	}
	int k = 0;
	map<int, int> b;
	for(int i = 0; i < n; ++i) {
		++b[k];
		k = a[k]-1;
		if(b[k] > 1)
			return cout << -1 << endl, 0;
		if(k == 1)
			return cout << i+1 << endl, 0;
	}//*/
}

Measured memory_bytes: 8292
#include<iostream>
#include<set>
#include<stack>
#include<queue>
#include<string>
#include<algorithm>//min,max,swap,rand,reverse,sort,lower_bound
#include<functional>
#include<vector>
#include<list>
#include<map>
#include<tuple>
#include<cmath>//abs, sin, cos
#include<bitset>
using namespace std;

int main()
{
	int N, Y, t, flag=0, count=0;
	int i, j, k;
	cin >> N >> Y;
	for (i = 0; i <= N; i++) {
		for (j = 0; j <= N-i; j++) {
			//if (N > i + j)
				//break;
			if ((10000 * j) + (5000 * i) + (1000 * (N - j - i)) == Y && i + j + (N - i - j) <= N) {
				flag = 1;
				break;
			}
		}
		if (flag == 1)
			break;
	}
	if (flag == 1) {
		cout << j << " " << i << " " << N-j-i << endl;
	}
	else
		cout << "-1 -1 -1" << endl;

	return 0;
}

Measured memory_bytes: 3196
#include <float.h>
#include <inttypes.h>
#include <limits.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <unistd.h>
#include <math.h>
#ifdef __cplusplus
#include <bits/stdc++.h>
#endif

uint32_t nextpint(void){ char c=getchar_unlocked(); while(c<'0'||'9'<c) c=getchar_unlocked(); uint32_t x=0; while('0'<=c && c<='9'){ x=x*10+c-'0'; c=getchar_unlocked(); } return x; }
uint32_t nextstr(char *s){ char c=getchar_unlocked(); while(c==' '||c=='\n') c=getchar_unlocked(); uint32_t len=0; while(c!=' '&&c!='\n'){ *s++=c; len++; c=getchar_unlocked(); } *s='\0'; return len; }
void printint(uint32_t x){ if(x<0){x=-x; putchar_unlocked('-');}else if(x==0){putchar_unlocked('0');} int d=0; char s[10]; while(x){ s[d]='0'+x%10; x/=10; d++; } for (int i=d-1; i>=0; i--) putchar_unlocked(s[i]); putchar_unlocked('\n'); }
void rsort_str(void *base, const int count, const int size);

char str[200000][11];

int main(void){
	uint32_t n=nextpint();
	for(uint32_t i=0; i<n; i++){
		nextstr(str[i]);
	}
	rsort_str(str, n, 11);
	uint32_t ans=1;
	for(uint32_t i=1; i<n; i++){
		if(strcmp(str[i], str[i-1])) ans++;
	}
	printint(ans);
}

void rsort_str(void *base, const int count, const int size){
	char (*a)[size]=base;
	char (*b)[size]=malloc(count*size);
	int c[0x100];
	for(int j=9; j>=0; j--){
		memset(c, 0, sizeof(c)); for(int i=0; i<count; i++){ c[a[i][j]]++; } for(int i=1; i<0x100; i++) c[i]+=c[i-1]; for(int i=count-1; i>=0; i--){ memcpy(&b[--c[a[i][j]]], a[i], size); }{void *t=a; a=b; b=t;}
	}
	free(b);
}


Measured memory_bytes: 5568
# -*- coding: utf-8 -*-
import numpy as np

n, d = map(int, input().split())
xl = []

for i in range(n):
    l = list(map(int, input().split()))
    xl.append(l)

ans = 0
for i in range(n-1):
    for j in range(i+1,n):
        dis = np.array(xl[i])-np.array(xl[j])
        squ = np.square(dis)
        su = np.sum(squ)
        sqr = np.sqrt(su)
        if sqr.is_integer():
            ans += 1

print(ans)


Measured memory_bytes: 12504
import math

N = int(input())

n = math.log((1 - (N * (1 - 26) // 26)), 26)

n = math.ceil(n)

S = 26 * (1 - 26 ** (n - 1)) // (1 - 26)

M = N - S - 1


res = ''

arr = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v",
       "w", "x", "y", "z"]

for i in range(n):
    index = i + 1

    s = M % (26 ** index)

    t = s // (26 ** i)

    res = arr[t] + res

    M -= s

print(res)


Measured memory_bytes: 9216
#include <bits/stdc++.h>
#define rep(i,s,n) for(int i=s;i<=n;i++)
using namespace std;
int main(){
	string a,b;
	cin>>a>>b;
	int l=b.length();
	int t=0;
	rep(i,0,l-1){
		if(a[i]==b[i])
			t++;
	}
	if(t==l-1)
		cout<<"Yes\n";
	else
		cout<<"No\n";
}
	

Measured memory_bytes: 3560
//高知能系Vtuberの高井茅乃です。
//Twitter: https://twitter.com/takaichino
//YouTube: https://www.youtube.com/channel/UCTOxnI3eOI_o1HRgzq-LEZw

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

#define INF 1999999999
#define REP(i,n) for(int i=0;i<n;i++)
#define REP1(i,n) for(int i=1;i<=n;i++)
#define MODA 1000000007 

int main() {
    int ans = 0;
    int tmp;
    
    int n, m;
    cin >> n >> m;
    vector<int> x(n);
    int sum = 0; 
    REP(i, n){
        cin >> x[i];
        sum += x[i];
    }
    sort(x .begin(), x.end());
    bool tr = true;
    REP1(i, m){
        if(4 * m * x[n-i] < sum ) tr = false;
    }
    //cout << ans << endl;
    if (tr) cout << "Yes" << endl;
    else cout << "No" << endl;
    
}

Measured memory_bytes: 256
n=int(input())
mod, ans=7+10**9, 0
a=list(map(int, input().split()))
b=[0]
for l in range(n):
    b.append(b[l]+a[l])
for k in range(n-1):
    s=(b[n]-b[k+1])%mod
    ans+=a[k]*s
    ans%=mod
print(ans)

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

int main(){
  
  int n;
  cin >> n;
  
  vector<int> a(n+1),b(n+1);
  for(int i = 1; i <= n; i++){
    cin >> a.at(i);
    b.at(a.at(i)) += 1;
  }
  
  for(int i = 1; i <= n; i++){
    cout << b.at(i) << endl;
  }
  
}

Measured memory_bytes: 4776
#include <bits/stdc++.h>
typedef long long ll;
#define rep(i,n) for(ll i=0;i<(n);i++)
#define repr(i,n) for(ll i=(n-1);i>=0;i--)
#define pb push_back
#define mp make_pair
#define all(x) x.begin(),x.end()
#define br cout << "\n";
using namespace std;
const int INF = 1e9;
const int MOD = 1e9+7;
using Graph = vector<vector<ll>>;
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;}

// 0 false, 1 true 
// string to int : -48
// ceil(a)  1.2->2.0
// c++17	g++ -std=c++17 a.cpp

int main() {
    std::cout << std::fixed << std::setprecision(15);
    string s;
    cin >> s;
    //AGCT
    ll ans = 0;
    ll count = 0;
    rep(i,s.size()){
        if(s[i] == 'A' || s[i] == 'G' || s[i] == 'C' || s[i] == 'T'){
            count++;
        }else{
            chmax(ans, count);
            count = 0;
        }
    }
    chmax(ans, count);
    cout << ans << endl;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using ll = long long;
#define FOR(i, k, n) for(ll i = (k); i < (n); i++)
#define FORe(i, k, n) for(ll i = (k); i <= (n); i++)
#define FORr(i, k, n) for(ll i = (k)-1; i > (n); i--)
#define FORre(i, k, n) for(ll i = (k)-1; i >= (n); i--)
#define REP(i, n) FOR(i, 0, n)
#define REPr(i, n) FORre(i, n, 0)
#define ALL(x) (x).begin(), (x).end()
#define ALLr(x) (x).rbegin(), (x).rend()
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
using namespace std;

const int INF = 1001001001;

int main(void){
  int n;
  cin >> n;
  int ans = 0;
  REP(i, n){
    int l, r;
    cin >> l >> r;
    ans += r-l+1;
  }
  cout << ans << endl;
  return 0;
}

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

typedef long long ll;
typedef unsigned long long ull;

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

  vector<vector<pair<ll, ll>>> xy(n);
  for (ll i = 0; i < n; ++i) {
    ll a;
    cin >> a;
    for (ll j = 0; j < a; ++j) {
      ll x, y;
      cin >> x >> y;
      x--;
      xy[i].push_back(make_pair(x, y));
    }
  }

  ll ans = 0;
  for (ll bit = 1; bit < (1 << n); ++bit) {
    bool ok = true;
    ll c = 0;
    for (ll i = 0; i < n; ++i) {
      if ((bit >> i) & 1) {
        ++c;
        for (ll j = 0; j < xy[i].size(); ++j) {
          ll x = xy[i][j].first;
          ll y = xy[i][j].second;
          ok = ok && (((bit >> x) & 1) == y);
        }
      }
    }
    if (ok) {
      ans = max(ans, c);
    }
  }

  cout << ans << endl;
  
  return 0;
}

Measured memory_bytes: 384
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;

namespace AOJ0077
{
    class Program
    {
        static void Main()
        {
            var regex = new Regex(@"@(?<length>\d)(?<character>.)");

            ReadInputs()
                .Select(line => regex.Replace(line,
                    match =>
                        new string(match.Groups["character"].Value[0],
                            int.Parse(match.Groups["length"].Value))))
                .ForEach(Console.WriteLine);

        }

        private static IEnumerable<string> ReadInputs()
        {
            string line;
            while ((line = Console.ReadLine()) != null)
            {
                yield return line;
            }
        } 
    }

    public static class EnumerableExtensions
    {
        public static void ForEach<T>(this IEnumerable<T> source, Action<T> action)
        {
            foreach (var item in source)
            {
                action(item);
            }
        }
    }
}

Measured memory_bytes: 12228
#include <bits/stdc++.h>
using namespace std;
template<typename T = int> vector<T> create(size_t n){ return vector<T>(n); }
template<typename T, typename... Args> auto create(size_t n, Args... args){ return vector<decltype(create<T>(args...))>(n, create<T>(args...)); }
int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	long long n, k;
	cin >> n >> k;
	n %= k;
	cout << min(n, k - n) << '\n';
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <map>
#include <numeric>
#include <string>
#include <cmath>
#include <iomanip>
#include <queue>
#include <list>
#include <stack>
#include <cctype>
#include <cmath>

using namespace std;

/* typedef */

typedef long long ll;

/* constant */
const int NIL = -1;
const int INF = 1 << 30;
const int MAX = 250;
const int mod = 1000000007;
const double pi = 3.141592653589;
/* global variables */
int n;

/* function */
int leftChild(int ind);
int rightChild(int ind);
int parent(int ind);
void maxHeapify(vector<int>& A, int ind);
void buildMaxHeap(vector<int>& A);

/* main */
int main(){

    cin >> n;
    vector<int> H(n+1, 0);
    for (int  i = 1; i <= n; i++) cin >> H[i];

    buildMaxHeap(H);

    for (int  i = 1; i <= n; i++) {
        cout << ' ';
        cout << H[i];
    } cout << '\n';

    return 0;

}

void maxHeapify(vector<int> &A, int ind) {
    int l = leftChild(ind);
    int r = rightChild(ind);
    int largest;
    if (l <= n && A[l] > A[ind])
        largest = l;
    else 
        largest = ind;
    if (r <= n && A[r] > A[largest])
        largest = r;
   
    if (largest != ind) {
        swap(A[largest], A[ind]);
        maxHeapify(A, largest);
    }
}

void buildMaxHeap(vector<int>& A) {
    int tree_size = n;
    for (int i = tree_size / 2; i >= 1; i--)
        maxHeapify(A, i);
}

int leftChild(int ind) {
    return ind * 2;
}

int rightChild(int ind) {
    return ind * 2 + 1;
}
int parent(int ind) {
    return ind / 2;
}




Measured memory_bytes: 4608