akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>

int main(void){
    int i,j,k,l;
    int n;
    int a[10000];
    long int sum,max;
    
    while(1){
        
        scanf("%d",&n);
        if(n==0)break;
    
        max=-11111111111;
        
        for(i=0;i<n;i++){
            scanf("%d",&a[i]);
        }
        
        for(i=0;i<n;i++){
            sum=0;
            for(j=i;j<n;j++){
                sum+=a[j];
                if(sum>max){
                    max=sum;
                }
            }
        }
        printf("%ld\n",max);
    }
    return(0);
}

Measured memory_bytes: 616
#include <iostream>
#include <vector>
#include <cstdlib>
using namespace std;
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}

const long long INF = 1LL << 60;

int N, K;
long long h[100010];

long long dp[100100];

int main() {
    cin >> N >> K;
    for (int i = 0; i < N; i++) cin >> h[i];
    for (int i = 0; i < N; i++) dp[i] = INF;

    dp[0] = 0;

    for (int i = 0; i < N; i++) {
        for (int j = 1; j <= K; j++) {
            chmin(dp[i + j], dp[i] + abs(h[i] - h[i + j]));
        }
    }

    cout << dp[N - 1] << endl;

    return 0;
}

Measured memory_bytes: 1792
#include "bits/stdc++.h"

#define pb push_back
#define pob pop_back
#define pf push_front
#define pof pop_front
#define eb emplace_back
#define rep(i, a, b) for (long i = (a); i <= (b); ++i)
#define per(i, a, b) for (long i = (a); i >= (b); --i)
#define mmst(v) memset(v, 0, sizeof(v))

template<typename T1,typename T2> inline void chmin(T1 & a, T2 b) { if (a > b) a = b; }
template<typename T1,typename T2> inline void chmax(T1 & a, T2 b) { if (a < b) a = b; }

const long kMax2 = 109;
const long kMax3 = 1009;
const long kMax4 = 10009;
const long kMax5 = 100009;
const long kMax6 = 1000009;
const long kMax9 = 1000000010;
const long kInfI = 0x3F3F3F3F;
const float kInfF = 1e15;
const long long kMod = 1000000007;

const long long kMAX = 1000000000;

using namespace std;
using ll = long long;

inline int readInt() {
  char c = getchar();
  while(!isdigit(c) && c != '-') c = getchar();
  int sigma = 1;
  if (c == '-') {
    sigma = -1;
    c = getchar();
  }
  int x = 0;
  while (isdigit(c)) {
    x = x * 10 + c - '0';
    c = getchar();
  }
  return x * sigma;
}

template <class T>
void PrintVector(const vector<T> & v) {
  for (const auto & e: v) {
    cout << e << endl;
  }
}

template <class T>
void PrintVector(const vector<T> & v, int n) {
  rep(i, 0, n - 1) {
    cout << v[i] << endl;
  }
}

double dist(double lhs, double rhs) {
  return sqrt(lhs * lhs + rhs * rhs);
}

int main() {
  long n, m, k, a, b;
  string s;
  double ans;
  vector<double> x, y;

  vector<long> pr;

  cin >> n;
  rep(i, 0, n - 1) { pr.pb(i); }
  rep(i, 0, n - 1) {
    double x0, y0;
    cin >> x0 >> y0;
    x.pb(x0);
    y.pb(y0);
  }
  do {
    rep(i, 0, n - 2) {
      ans += dist((x[pr[i]] - x[pr[i + 1]]), (y[pr[i]] - y[pr[i + 1]]));
    }
  } while(next_permutation(pr.begin(), pr.end()));
  rep(i, 2, n) {
    ans /= double(i);
  }
  cout << std::setprecision(14) << ans << endl;
  return 0;
}


Measured memory_bytes: 256
package main
import (
  "fmt"
  "os"
  "bufio"
  "strings"
  "strconv"
  "sort"
)

// var f, _ = os.Open("input.txt")
// var rdr = bufio.NewReaderSize(f, 1000000)
var rdr = bufio.NewReaderSize(os.Stdin, 1000000)

func read_line() string {
    buf := make([]byte, 0, 1000000)
    for {
        l, p, e := rdr.ReadLine()
        if e != nil {
            panic(e)
        }
        buf = append(buf, l...)
        if !p {
            break
        }
    }
    return string(buf)
}

func upper(Ls [] int, val int) int {
    var low int = 0
    var high int = len(Ls)
    mid := (high + low) / 2
    for high - low > 1 {
        if Ls[mid] > val {
            high = mid
        } else {
            low = mid
        }
        mid = (high + low) / 2
    }

    if Ls[low] > val {
        return low
    }
    return high
}

func upper_equal(Ls [] int, val int) int {
    var low int = 0
    var high int = len(Ls)
    mid := (high + low) / 2
    for high - low > 1 {
        if Ls[mid] >= val {
            high = mid
        } else {
            low = mid
        }
        mid = (high + low) / 2
    }

    if Ls[low] >= val {
        return low
    }
    return high
}

func main() {
    // as := make([] int, 5)
    // for i, word := range strings.Split(read_line(), " ") {
    //     as[i], _ = strconv.Atoi(word)
    // }

    N, _ := strconv.Atoi(read_line())
    Ls := make([] int, N)
    for i, L := range strings.Split(read_line(), " ") {
        Ls[i], _ = strconv.Atoi(L)
    }

    sort.Ints(Ls)    

    var res int = 0
    for i := 0; i < N; i++ {
        for j := i + 1; j < N; j++ {
            max_index := upper_equal(Ls, Ls[j] + Ls[i])
            min_index := upper(Ls, Ls[j] - Ls[i])
            res += max_index - min_index
            if min_index <= i && i < max_index {
                res--
            }
            if min_index <= j && j < max_index {
                res--
            }
        }
    }

    fmt.Println(res / 3)
}

Measured memory_bytes: 2816
/*AOJ No.0592 Average Score*/

#include <stdio.h>

int main(){

  int i;
  int t=0;
  int a;

  for(i=0;i<5;i++){
    scanf("%d",&a);
    
    if(a>=40){
      t+=a;
    }

    else if(a<40){
      t+=40;
    }
  }

  printf("%d\n",t/5);

  return 0;
}

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

int main() {
  int n, k;
  cin >> n >> k;
  vector<int> h(n);
  rep(i, n) cin >> h.at(i);
  int count = 0;
  rep(i, n) {
    if(h.at(i) >= k) count++;
  }
  cout << count << endl;
}


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

#define DIV 1000000007 

long long n, a, b;

long long modpow(long long ori, long long po){
	long long res = 1;
	while(po > 0){
		if(po&1){
			res *= ori;
			res %= DIV;
		}
		ori *= ori;
		ori %= DIV;
		po >>= 1;
	}
	return res;
}

//nCk
long long combination(long long n, long long k){
	if(n == 0 && k == 0)return 1;
	if(n < k || n < 0)return 0;

	long long ue = 1;
	long long shita = 1;

	for(long long i = 0; i < k; i++) {
		ue *= (n - i);
		ue %= DIV;
	}

	for(long long i = 1; i <= k; i++) {
		shita *= modpow(i, DIV - 2);
		shita %= DIV;
	}
	return (ue * shita)%DIV;
}


int main(){
	cin >> n >> a >> b;

	long long ans = modpow(2, n);

	ans -= combination(n, a);
	ans -= combination(n, b);
	ans--;
	ans += DIV * 10L;
	ans %= DIV;
	cout << ans << endl;

}

Measured memory_bytes: 3600
#include<cstdio>
#include<cstring>
#include<functional>
#include<algorithm>
#include<vector>
#include<iostream>
using namespace std;
int main(void)
{
	int i,j,x,tousa,atom;
	int n,flg;
	vector<int> nae;
	vector<int> cp;
	while(1) {
		cin >> n;
		if(n==0) break;
		nae.resize(n+1);
		cp.resize(n);
		for(i=0;i<n+1;i++) cin >> nae[i];
		for(i=0;i<n+1;i++) {
			atom=nae[i];	
			x=0;
			for(j=0;j<n+1;j++) {
				if(i!=j){
					cp[x]=nae[j];
					x++;
				}
			}
			tousa=0;
			flg=0;
			for(j=0;j<n-1;j++) {
				if(j==0) tousa=cp[j+1]-cp[j];
				else {
					if(tousa!=cp[j+1]-cp[j]) flg=1;
				}
			}
		//	cout << flg << atom << endl;
			if(flg==0) break;
		
		}
		cout << atom <<endl;
	}
	exit(0);
}
	

Measured memory_bytes: 1212
import std.stdio, std.algorithm, std.conv, std.array, std.string, std.math, std.typecons, std.numeric;

alias AB = Tuple!(int, "a", int, "b");

void main()
{
    auto nm = readln.split.to!(int[]);
    auto N = nm[0];
    auto M = nm[1];
    AB[] abs;
    foreach (_; 0..M) {
        auto ab = readln.split.to!(int[]);
        abs ~= AB(ab[0]-1, ab[1]-1);
    }
    sort!"a.a < b.a"(abs);
    int n, c = N+1;
    foreach (i; 0..N) {
        if (c == i) {
            ++n;
            c = N+1;
        }
        while (!abs.empty && abs[0].a == i) {
            if (abs[0].b < c) c = abs[0].b;
            abs = abs[1..$];
        }
    }
    writeln(n);
}

Measured memory_bytes: 4092
#include <bits/stdc++.h>
using namespace std;
#define lli long long int
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    lli n,a,b,ans;
  cin>>n>>a>>b;  
  if(a==0)     {cout <<"0";return 0;}
ans=n/(a+b);
ans=ans*a;
lli x=0;
x=n%(a+b);
if(x/a==0) ans=ans+x;
else  ans=ans+a;
cout<<ans;
  
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rf(x) (x)=0;while(*p<48)p++;while(47<*p)(x)=((x)<<3)+((x)<<1)+(*p++&15);
#define pb push_back
#define eb emplace_back
#define sz(V) ((int)(V).size())
#define befv(V) ((V)[(sz(V)-2)])
#define allv(V) ((V).begin()),((V).end())
#define sorv(V) sort(allv(V))
#define revv(V) reverse(allv(V))
#define univ(V) (V).erase(unique(allv(V)),(V).end())
#define clv(V) (V).clear()
#define upmin(a,b) (a)=min((a),(b))
#define upmax(a,b) (a)=max((a),(b))
#define rb(x) ((x)&(-(x)))
#define INF (0x3f3f3f3f)
#define INFLL (0x3f3f3f3f3f3f3f3fll)
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;

unordered_map<int, bool> MP;

bool isinv;
int N;

bool ask(int i) {
	auto it = MP.find(i);
	if(MP.end() != it) return it->second;

	printf("%d\n", i);
	fflush(stdout);

	char str[10];
	scanf(" %s", str);

	if('V' == str[0]) {
		exit(0);
	}

	return 'F' == str[0];
}

void f(int s, int e) {
	if(s == e) {
		ask(s);
		return;
	}

	int m = (s+e) >> 1;
	bool ret = ask(m) ^ isinv;

	if((m & 1) == ret) {
		f(m+1, e);
	} else {
		f(s, m);
	}
}

int main() {
	scanf("%d", &N);

	isinv = ask(0);
	f(1, N-1);

	return 0;
}

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

int main(){
	int a[4];
	int b[4];
	while(cin>>a[0]){
		cin>>a[1]>>a[2]>>a[3]>>b[0]>>b[1]>>b[2]>>b[3];
		int hit=0,blow=0;
		for(int i=0;i<4;i++){
			if(a[i]==b[i])hit++;
			for(int j=0;j<4;j++){
				if(i!=j){
					if(a[i]==b[j])blow++;
				}
			}
		}
		cout<<hit<<" "<<blow<<endl;
	}
	return 0;
}

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

int main()
{
    int n;
    cin >> n;
    int ans = (n + 1) / 2;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3616
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define ff(i,n) for(i=0;i<n;i++)
int main()
{
   ll t;
   t = 1;
   while(t--)
   {
   		ll i,j,k,n,ans=0;
		cin>>n;
		ll arr[n];
		ff(i,n)
			cin>>arr[i];
		for(i=0;i<n;i++)
		{
			for(j=i+1;j<n;j++)
			{
				for(k=j+1;k<n;k++)
				{
					if(arr[i]!=arr[j] && arr[i]!=arr[k] && arr[j]!=arr[k])
					{
						ll sum = arr[i] + arr[j] + arr[k];
						ll maxi = max(arr[i],max(arr[j],arr[k]));
						sum = sum - maxi;
						if(sum>maxi)
							ans++;			
					}	
				}	
			}	
		}			  	
		cout<<ans;
   }
   return 0 ;
} 

Measured memory_bytes: 3632
#include<stdio.h>
#include<math.h>
int main(){
  int N,L[10],S,P;
  S=0;
  P=0;
  scanf("%ld\n",&N);
  for(int i=0;i<N;i++){
    scanf("%ld",&L[i]);
    S=S+L[i];
    if(P<=L[i])
      P=L[i];
  }
  if(S-P>P)
    printf("Yes");
  else
    printf("No");
}


Measured memory_bytes: 128
#include<iostream>
using namespace std;
int main()
{
	char a[6];
	for(int i=0;i<6;i++)
	{
		cin>>a[i];
	}
	if(a[0]!=a[1]&&a[2]==a[3]&&a[4]==a[5])
	{
		cout<<"Yes"<<endl;
	}
	else
	{
		cout<<"No"<<endl;
	}
	return 0;
} 

Measured memory_bytes: 256
import qualified Data.Text as T
import qualified Data.Text.IO as T
import qualified Data.Text.Read as T

main :: IO ()
main = do
  (r : _) <- map unsafeSignedDecimal . T.words <$> T.getLine :: IO [Int]
  print (3 * r * r)

unsafeSignedDecimal :: T.Text -> Int
unsafeSignedDecimal s = case T.signed T.decimal s of
  Right (n, _) -> n


Measured memory_bytes: 508
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
using ll = __int128_t;
using Int = long long int;

const ll INF = 1LL << 60;
Int W, H, V, T, x, y, p, q;

ll find_upper(ll X, ll cy, ll ty, ll piv) {
    ll ub = T*V, lb = piv-1;
    while(ub - lb > 1) {
        ll mid = (ub + lb) / 2;
        ll Y = cy*mid + ty;

        ll dx = X - x, dy = Y - y;
        if(dx*dx + dy*dy > T*T*V*V) {
            ub = mid;
        }
        else {
            lb = mid;
        }
    }
    return ub;
}

ll find_lower(ll X, ll cy, ll ty, ll piv) {
    ll ub = piv, lb = -T*V;
    while(ub - lb > 1) {
        ll mid = (ub + lb) / 2;
        ll Y = cy*mid + ty;

        ll dx = X - x, dy = Y - y;
        if(dx*dx + dy*dy <= T*T*V*V) {
            ub = mid;
        }
        else {
            lb = mid;
        }
    }
    return ub;
}

bool is_valid(ll X, ll cy, ll ty, ll k) {
    ll Y = cy*k + ty;
    ll dx = X - x, dy = Y - y;
    return dx*dx + dy*dy <= T*T*V*V;
}

Int solve(ll cx, ll tx, ll cy, ll ty) {
    Int ret = 0;
    for(ll k=-T*V; k<=T*V; k++) {
        ll X = cx*k + tx, dx = X - x;
        if(dx*dx > T*T*V*V) continue;
        
        ll piv = INF;
        for(int k=-2; k<=2; k++) {
            if(is_valid(X, cy, ty, k)) {
                piv = k;
                break;
            }
        }
        if(piv == INF) continue;
        ll ub = find_upper(X, cy, ty, piv);
        ll lb = find_lower(X, cy, ty, piv);
        ret += ub - lb;
    }
    return ret;
}

int main() {
    cin >> W >> H >> V >> T >> x >> y >> p >> q;

    Int ans = 0;
    ans += solve(2*W,     p, 2*H,     q);
    ans += solve(2*W,     p, 2*H, 2*H-q);
    ans += solve(2*W, 2*W-p, 2*H,     q);
    ans += solve(2*W, 2*W-p, 2*H, 2*H-q);

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


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

int main(){
  int a,b,i,j,dd=0,cc=0,ff=0,ss=0;

  while(1){
    dd=0;
    cc=0;
    ff=0;
    cin >> a >> b;
    if(a==0 && b==0)break;
    ss=b-a;
    
    if(ss>=1000){
      ff=ss/1000;
      ss=ss%1000;
    }
    if(ss>=500){
      cc=ss/500;
      ss=ss%500;
    }
    if(ss>=100){
      dd=ss/100;
      ss=ss%500;
    }




    cout << dd <<" "<< cc <<" "<< ff<< endl;

  }





}

Measured memory_bytes: 0
#pragma region RegionDefs
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#include <boost/function.hpp>
#define rep(i,n) for(int i=0,i##_len=(n);i<i##_len;++i)
#define reps(i,j,n) for(int i=(j),i##_len=(n);i<i##_len;++i)
#define repr(i,n) for(int i=(n);i>=0;--i)
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef pair<int,int> P;
typedef vector<int> V;
typedef priority_queue<int> PQ;
typedef priority_queue<int,V,greater<int>> PQG;
typedef long long ll;
const int INF = 1e9;
void in() {}
template<class Head, class... Tail>
void in(Head&& head, Tail&&... tail)
{
    cin >> head;
    in(move(tail)...);
}
#define IN(...) int __VA_ARGS__; in(__VA_ARGS__)
#define VIN(v, n) V v(n); for(auto& _elem:v)cin>>_elem
struct UnionFind
{
    vector<int> par;

    UnionFind(int n) : par(n)
    {
        rep(i, n) par[i] = i;
    }

    int root(int x)
    {
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y)
    {
        int rx = root(x);
        int ry = root(y);
        if (rx == ry) return;
        par[rx] = ry;
    }

    int same(int x, int y)
    {
        return root(x) == root(y);
    }
};
#pragma endregion RegionDefs

void solve()
{
    int n, m; cin >> n;
    VIN(v, n);
    double sum = 0;
    rep(i, n)
    {
        sum += 1.0 / v[i];
    }
    cout << 1 / sum << endl;
}

int main()
{
    cin.tie(0); cout.tie(0);
    ios::sync_with_stdio(false);
    cout << setprecision(numeric_limits<double>::max_digits10);

    solve();

    return 0;
}

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

struct Dinic {
  struct Edge{ int to, cap, rev; };
  int n, init;
  vector<vector<Edge>> g;
  vector<int> itr, level;

  Dinic() {}
  Dinic(int n, int INF = 1e9) : n(n), g(n), init(INF) {}

  void addEdge(int u, int v, int c) {
    int szU = g[u].size();
    int szV = g[v].size();
    g[u].push_back({v, c, szV});
    g[v].push_back({u, 0, szU - 1});
  }
  void bfs(int s) {
    level = vector<int>(n, -1);
    queue<int, deque<int>> que({s});
    level[s] = 0;
    while (!que.empty()) {
      int u = que.front(); que.pop();
      for (auto&& e : g[u]) {
        int v = e.to;
        if (level[v] < 0 && e.cap > 0) {
          level[v] = level[u] + 1;
          que.push(v);
        }
      }
    }
  }
  int dfs(int u, int t, int c) {
    if (u == t) return c;
    for (int& i = itr[u]; i < g[u].size(); ++i) {
      Edge& e = g[u][i];
      int v = e.to;
      if (level[u] < level[v] && e.cap > 0) {
        int f = dfs(v, t, min(c, e.cap));
        if (f > 0) {
          e.cap -= f;
          g[v][e.rev].cap += f;
          return f;
        }
      }
    }
    return 0;
  }
  int build(int s, int t) {
    int flow = 0;
    while (true) {
      bfs(s);
      if (level[t] < 0) break;
      itr = vector<int>(n, 0);
      int f;
      while ((f = dfs(s, t, init)) > 0) flow += f;
    }
    return flow;
  }
};

int main() {
  int n, m; cin >> n >> m;
  Dinic f(n);
  while (m--) {
    int u, v, c; cin >> u >> v >> c;
    f.addEdge(u, v, c);
  }
  cout << f.build(0, n - 1) << endl;
  return 0;
}



Measured memory_bytes: 3196
def chmin(dp, idx, a, b):
    if a > b:
        dp[idx] = b
        return True
    else:
        return False
def dp(N, h):
    INF = 10 ** 9
    dp = [INF] * N
    dp[0] = 0
    for i in range(N):
        if i < N-1:
            chmin(dp, i+1, dp[i+1], dp[i] + abs(h[i+1]-h[i]))
        if i < N-2:
            chmin(dp, i+2, dp[i+2], dp[i] + abs(h[i+2]-h[i]))
    return dp
N = int(input())
h = list(map(int, input().split(' ')))
dp = dp(N, h)
print(dp[N-1])

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

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;

#define fi first
#define se second
#define repl(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define rep(i,n) repl(i,0,n)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt __builtin_popcountll

#define INF 1e16
#define mod 1000000007

int cnt=0;
vector<ll> p;
bool vis[100010];
vector<int> bs;

void dfs(int v){
	vis[v]=true;
  bs.push_back(v);

	if(vis[p[v]])return;
	dfs(p[v]);
}

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

  ll n;
  cin>>n;
  vector<ll> a(n),b(n);
  {
    rep(i,n)cin>>a[i];
    rep(i,n)cin>>b[i];
    vector<P> ps;
    rep(i,n)ps.push_back(P(b[i],a[i]));
    sort(all(ps));
    rep(i,n)a[i]=ps[i].se;
    rep(i,n)b[i]=ps[i].fi;
  }
  {
  	vector<ll> c=a,d=b;
  	sort(all(c));
  	sort(all(d));
  	bool ok=true;
  	rep(i,n)if(c[i]>d[i])ok=false;
  	if(!ok){
  		cout<<"No"<<endl;
  		return 0;
  	}
  }

  vector<P> vs;
  rep(i,n){
  	vs.push_back(P(a[i],i));
  }
  sort(all(vs));
  uni(vs);
  rep(i,n){
  	a[i]=lower_bound(all(vs),P(a[i],i))-vs.begin();
  }

  p.resize(n);
  rep(i,n){
    p[a[i]]=i;
  }
	rep(i,n){
		if(vis[i])continue;
		dfs(i);
		cnt++;
	}
	if(cnt==1){
    bool ok=false;
    rep(i,n-1){
      ll v=p[i+1];
      if(b[i]>=vs[a[v]].fi)ok=true;
    }
    if(ok)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
  }else{
    cout<<"Yes"<<endl;
  }

  return 0;
}


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

int main(){
  string S;
  cin>>S;
  set<char> moji;
  
  for(int i=0;i<S.size();i++){
    moji.insert(S.at(i));
  }
  if(moji.size()==S.size()){
    cout<<"yes"<<endl;
  }
  if(moji.size()!=S.size()){
    cout<<"no"<<endl;
  }
}

Measured memory_bytes: 256
unittest
{
	assert( [ "3", "8 12 40" ].parse.expand.solve == 2 );
	assert( [ "4", "5 6 8 10" ].parse.expand.solve == 0 );
	assert( [ "6", "382253568 723152896 37802240 379425024 404894720 471526144" ].parse.expand.solve == 8 );
}



import std.algorithm;
import std.conv;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

void main()
{
	stdin.byLineCopy.parse.expand.solve.writeln;
}

auto parse( Range )( Range input )
if( isInputRange!Range && is( ElementType!Range == string ) )
{
	auto n = input.front.strip.to!( long );
	input.popFront;
	auto as = input.front.split.to!( long[] );
	return tuple( as );
}

auto solve( long[] as )
{
	auto r = 0L;
	
	while( as.count!( ( a ) => a % 2 == 1 ) == 0 )
	{
		as.each!( ( ref a ) => a /= 2 );
		r++;
	}
	
	return r;
}


Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <cstdio>

using namespace std;

int main(void){
    double a,b,c;
    cin>>a>>b>>c;
    c=2*M_PI*(c/360);
    double si=sin(c),co=cos(c);
    double s=a*b*si;
    printf("%.8lf\n",s/2);
    printf("%.8lf\n",a+b+sqrt(a*a+b*b-2*a*b*co));
    printf("%.8lf\n",s/a);
    

    return 0;
}


Measured memory_bytes: 3516
package main

import "fmt"

func main() {
    var n int
    var n_odds int
    var answer float32
    fmt.Scan(&n)

    if n % 2 == 0 {
        n_odds = n / 2
    }else{
        n_odds = n / 2 + 1
    };

    answer = float32(n_odds) / float32(n)

    fmt.Println(answer)

}

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

bool overlap( int a, int b, int c, int d){

  if ( d <= a ) return false; //

  if ( b <= c ) return false; //

  return true;

}


int main(){

  int a,b,n,s,f;

  cin>>a>>b>>n;

  for (int i = 0; i < n; i++ ){

    cin >>s>>f;

    if ( overlap ( a,b,s,f)){


      cout << 1 <<endl;

      return 0;
    }
  }

    cout<<0<<endl;

     return 0;
    }




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

using namespace std;

int main() {

  string s, t;
  cin >> s >> t;

  int ss = s.size();
  int tt = t.size();

  int ans = 1000;
  for (int i = 0; i < ss - tt + 1; ++i) {
    int c = tt;
    for (int j = 0; j < tt; ++j) {
      if (s[i + j] == t[j]) {
        --c;
      }
    }
    ans = min(ans, c);
  }

  cout<<ans;

  return 0;
}


Measured memory_bytes: 3592
#include <iostream>
#include <string>
#include <algorithm>
#include <iterator>
#include <functional>
#include <vector>
#include <math.h>
#include <typeinfo>
#include <numeric>
#include <iostream>
#include <string>
#include <sstream>
#include <iomanip>
using namespace std;

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

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

	sort(a.rbegin(), a.rend());

	int alice = 0;
	int bob = 0;
	for (int i = 0; i < N; i++)
	{
		if (i % 2 == 0)
		{
			alice += a[i];
		}
		else
		{
			bob += a[i];
		}
	}

	cout << alice - bob << endl;

	return 0;
 
}

Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.util.InputMismatchException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskB solver = new TaskB();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskB {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int h = in.nextInt();
            int w = in.nextInt();

            String[] s = in.nextStringArray(h);

            boolean[] y = new boolean[h];
            boolean[] x = new boolean[w];
            for (int i = 0; i < h; i++) {
                for (int j = 0; j < w; j++) {
                    if (s[i].charAt(j) == '#') {
                        y[i] = true;
                        x[j] = true;
                    }
                }
            }

            for (int i = 0; i < h; i++) {
                for (int j = 0; j < w; j++) {
                    if (y[i] && x[j]) out.print(s[i].charAt(j));
                }
                if (y[i]) out.println();
            }
        }

    }

    static class InputReader {
        private BufferedReader br;
        private StringTokenizer st;

        public InputReader(InputStream inputStream) {
            br = new BufferedReader(new InputStreamReader(inputStream));
            st = new StringTokenizer("");
        }

        public String nextString() {
            while (!st.hasMoreTokens()) {
                try {
                    st = new StringTokenizer(br.readLine(), " ");
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
            }
            return st.nextToken();
        }

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

        public String[] nextStringArray(int n) {
            String[] res = new String[n];
            for (int i = 0; i < n; i++) {
                res[i] = nextString();
            }
            return res;
        }

    }
}



Measured memory_bytes: 21716
#include <cstdio>

int main()
{
    int A, B;
    scanf("%d %d", &A, &B);
    if(A == B)
        printf("%d\n", 2*A);
    else if(A > B)
        printf("%d\n", 2*A-1);
    else
        printf("%d\n", 2*B-1);
    return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <stdio.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)


int main()
{
    int x,y,z;
    scanf("%d",&x);
    scanf("%d",&y);
    
    if(x%y==0){
    	printf("-1");
    }
    else{
    	
    
    rep(i,y){
    	if((x*i)%y==0){
    		;
    	}else{
    		z=x*i;
    		break;
    	}
    }
    printf("%d",z);
    }
    
}

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

int main(void) {
    std::vector<int> mount(10, 0);
    for (int i = 0; i < 10; i++) {
        std::cin >> mount[i];
    }
    std::sort(mount.begin(), mount.end(), std::greater<int>());
    for (int i = 0; i < 3; i++) {
        std::cout << mount[i] << std::endl;
    }
    return 0;
}

Measured memory_bytes: 3124
n,m=map(int,input().split())
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())
uf=UnionFind(n)
for i in range(m):
  x,y,z=map(int,input().split())
  uf.union(x-1,y-1)
print(uf.group_count())

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


int main() {
	
	char a, b;
	cin >> a >> b;
	if ( (a=='H'&&b=='H')||(a=='D'&&b=='D') ) cout << 'H' << endl;
	else cout << 'D' << endl;
	
	
	return 0;
}

Measured memory_bytes: 256
// inputに入力データ全体が入る
function Main(input) {
    var list = new List();
    input[0].split("").forEach(v=>{
        list.addLast(v);
    });

    var s = 0;  
    var Q = input[1]-0;
    for(var i=2;i<Q+2;i++){
        var n = input[i].split(" ");
        if(n[0]=="1"){
            s = 1-s;
        }else{
            if(n[1] == "1"){
                if(s==0){
                    list.addFirst(n[2]);
                }else{
                    list.addLast(n[2]);
                }
            }else{
                if(s==1){
                    list.addFirst(n[2]);
                }else{
                    list.addLast(n[2]);
                }
            }
        }
    }
    console.log(list.toString(s));
}

function Node(v){
    this.val = v;
    this.next=null;
    this.prev=null;
}

function List(){
    this.length = 0;
    this.last=this.first=new Node("");
}
List.prototype.toString = function(s){
    var ans = "";
    if(s==0){
        var now = this.first;
        ans += now.val;
        while(now.next){
            now = now.next;
            ans += now.val;
        }
    }else{
        var now = this.last;
        ans += now.val;
        while(now.prev){
            now = now.prev;
            ans += now.val;
        }
    }
    return ans;
}
List.prototype.addLast = function(v){
    var newNode = new Node(v);
    this.last.next = newNode;
    newNode.prev = this.last;
    this.last = newNode;
    this.length++;
}
List.prototype.addFirst = function(v){
    var newNode = new Node(v);
    this.first.prev = newNode;
    newNode.next = this.first;
    this.first = newNode;
    this.length++;
}



Main(require("fs").readFileSync("/dev/stdin", "utf8").trim().split("\n"));

Measured memory_bytes: 69556
#include <bits/stdc++.h>
#define FOR(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define FORUL(i,l,u) for(int (i)=(int)(l);(i)<(int)(u);++(i))
#define FORULE(i,l,u) for(int (i)=(int)(l);(i)<=(int)(u);++(i))
#define FOREACH(it, X) for(__typeof((X).begin()) it = (X).begin(); it != (X).end(); it++)
#if defined(_MSC_VER) || __cplusplus > 199711L
#define AUTOVAR(newvar,v) auto newvar = (v)
#else
#define AUTOVAR(newvar,v) __typeof(newvar) r = (v)
#endif
#define PB(x) push_back(x)
#define MP(x,y) make_pair((x),(y))
#define MEMSET(m,v) memset(m,v,sizeof(m))

typedef long long				 ll;
typedef unsigned long long		ull;

#define DEBUG 1

#if DEBUG
#define DOUT cout<<"["<<__LINE__<<"]:"
#else
#define DOUT 0 && cout
#endif

using namespace std;


int main(int argc, char *argv[])
{
	ios::sync_with_stdio(false);

	int a;
	string s;
	cin >> a;
	cin >> s;
	if (a>=3200) {
		cout << s << endl;
	}
	else {
		cout << "red" << endl;
	}

	return 0;
}




Measured memory_bytes: 256
process.stdin.on('data', function(chunk) {
  var inputs = chunk.toString().trim().split('\n');
  for (var i = 0; i < inputs.length; i++) {
  	if (inputs[i]==='0 0'){
  		break;
  	}
  	var input = inputs[i].split(' ')
  	.map(Number).sort(function(a,b){
  		return a-b;
  	})
  	.join(' ');
  	console.log(input);
  }
  // ????????????????????????
});
process.stdin.resume();
process.stdin.setEncoding('utf8');

Measured memory_bytes: 19368
#include <bits/stdc++.h>
#define y first
#define x second
using namespace std;
typedef	pair<int,int> P;
int main(){

  for(int n;cin>>n,n;){
    int x[2]={},y[2]={};
    P mp[200];
    mp[0]=P(0,0);
    for(int i=1,a,b;i<n&&cin>>a>>b;i++){
      if(!b) mp[i]=P(mp[a].y,mp[a].x-1);
      else if(b==1) mp[i]=P(mp[a].y-1,mp[a].x);
      else if(b==2) mp[i]=P(mp[a].y,mp[a].x+1);
      else mp[i]=P(mp[a].y+1,mp[a].x);
    }
    for(int i=0;i<n;i++){
      x[0]=min(x[0],mp[i].x);
      x[1]=max(x[1],mp[i].x);
      y[0]=min(y[0],mp[i].y);
      y[1]=max(y[1],mp[i].y);
    }
    cout<<x[1]-x[0]+1<<" "<<y[1]-y[0]+1<<endl;
  }
  return 0;

}

Measured memory_bytes: 2996
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef map<int,int> mii;
typedef vector<int> vi;
typedef vector<vector<int>> vii;
typedef vector<long long> vl;
typedef vector<vector<ll>> vll;
typedef vector<bool> vb;
typedef set<int> si; 
typedef queue<int> qi;
typedef stack<int> sti;
typedef priority_queue<int> pqi;
#define fori(i,a,b) for(int i = (a); i < (b); ++i)
#define rep(i,b,a) for(int i = (b); i >= (a); --i)
#define all(a) (a).begin(), (a).end()
//#define __builtin_popcountll bitCountLL
//#define __builtin_popcount bitCount
//__builtin_ctz 末尾0的个数, __builtin_clz 前导0的个数
//__builtin_ffs 最后一个1的位置
mt19937 mt_rand(chrono::high_resolution_clock::now().time_since_epoch().count());
//std::uniform_int_distribution<long long> rg(1,1e18);
#define maxn 100005
#define Mod 1000000007
const int INF = 2e9;
const ll ML = 4e18;
    
void solve() {
    int m, n;
    cin >> m >> n;
    int x1, y1, x2, y2;
    cin >> x1 >> y1 >> x2 >> y2;
    x1--, y1--, x2--, y2--;
    vector<string> grid(m);
    fori(i,0,m) cin >> grid[i];
    
    priority_queue<vi,vii,greater<vi>> pq;
    pq.push(vi{0,x2,y2});
    vii vis(m,vi(n,0));
    int dx[] = {-1,0,1, 0}, dy[] = {0,1,0,-1};
    while(!pq.empty()) {
        vi tp = pq.top();
        pq.pop();
        if(vis[tp[1]][tp[2]]) continue;
        vis[tp[1]][tp[2]] = 1;
        if(tp[1] == x1 && tp[2] == y1) {
            cout << tp[0] << endl;
            return;
        }
        fori(i,0,4) {
            int nx = tp[1] + dx[i], ny = tp[2] + dy[i];
            if(nx < 0 || nx >= m || ny < 0 || ny >= n || vis[nx][ny] || grid[nx][ny] == '#')
                continue;
            pq.push(vi{tp[0], nx, ny});
        }
        fori(i, -2, 3) {
            fori(j, -2 , 3) {
                //if(abs(i) != 2 && abs(j) != 2) continue;
                if(!i && !j) continue;
                int nx = tp[1] + i, ny = tp[2] + j;
                if(nx < 0 || nx >= m || ny < 0 || ny >= n || vis[nx][ny] || grid[nx][ny] == '#')
                    continue;
                pq.push(vi{tp[0] + 1, nx, ny});
            }
        }

    }
    cout << -1 << endl;
}

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
	//cout.precision(30); cout << fixed;
	//freopen("D:\\data_in.txt", "r", stdin);
   
    solve();
   
    /*
    clock_t start,finish;
    start = clock();
    
    finish = clock();
    cout << "\n" << (double)(finish - start) / (double)(CLOCKS_PER_SEC) * 1000 << "ms" << endl;
    */
    return 0;
}

/***************************************************************
 question:
 idea:
 tag:
 record:
 ***************************************************************/


Measured memory_bytes: 13320
import java.io.{BufferedReader, InputStream, InputStreamReader}
import java.util.StringTokenizer

import scala.collection.mutable
import scala.util.Sorting
import math.{abs, max, min}
import scala.collection.mutable.{ArrayBuffer, ListBuffer}

object Main {
  val MOD = 1000000007
  def solve(): Unit = {
    val sc = new InputReader(System.in)
    val A, B = sc.nextInt()

    val ans = A <= 8 && B <= 8
    println(if (ans) "Yay!" else ":(")
  }


  def main(args: Array[String]): Unit = {
    solve()
  }


  class InputReader(val stream: InputStream) {
    private val reader = new BufferedReader(new InputStreamReader(stream), 32768)
    private var tokenizer: StringTokenizer = null

    def next: String = {
      while (tokenizer == null || !tokenizer.hasMoreTokens)
        tokenizer = new StringTokenizer(reader.readLine)
      tokenizer.nextToken
    }

    def nextInt(): Int = next.toInt
    def nextLong(): Long = next.toLong
    def nextChar(): Char = next.charAt(0)
  }

}


Measured memory_bytes: 25408
#include<iostream>
#include<vector>
using namespace std;
using ll = long long int;
const int MOD = 1E+09 + 7;

int main(){
    int n;
    cin >> n;
    vector<ll> A(n);
    for(int i = 0; i < n; i++)cin >> A[i];

    vector<ll> S(n);
    S[0] = A[0];
    for(int i = 1; i < n; i++)S[i] = S[i-1] + A[i];

    ll ans = 0;
    for(int i = 1; i < n; i++){
        ans += (A[i] * (S[i-1] % MOD)) % MOD;
        ans %= MOD;
    }
    cout << ans << endl;
}

Measured memory_bytes: 6048
#include<bits/stdc++.h>
using namespace std;
const int N =2e5,OO=0x3f3f3f3f,mod=1e9 +7;
int n,x;
int mn=INT_MAX;
void solve(){
    int cnt=0;
    while(x%2==0){
        cnt++;
        x/=2;
    }
    mn=min(mn,cnt);
}
int main()
{
    cin>>n;
    for(int i=1;i<=n;i++){
        cin>>x;
        solve();
    }
    cout<<mn<<endl;
}


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

namespace AtCoder2 {
	class Program {
		static void Main(string[] args) {

			//出力の都度更新をやめる
			var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
			Console.SetOut(sw);


			Ans();

			//更新する
			Console.Out.Flush();
			
		}
public static void Ans() {

			var inputArray = retreiveLongArray();
			var inputCount = 1;

			// 不正な入力は処理しない
			if (inputArray.Length != inputCount) {
				Console.WriteLine("invalid input");
				return;
			}
			long K = inputArray[0];

			long count = 1;
			long mod = 0;
			while (true) {

				mod = (mod * 10 + 7) % K;

				if (mod==0) {
					break;
				}

				if (count>K+10) {
					Console.WriteLine(-1);
					return;
				}
				count++;

			}

			//答えの出力
			var ans = count;
			Console.WriteLine(ans);

		}

		/// <summary>
		/// スペースで区切られた文字列配列の入力を受け取る
		/// </summary>
		/// <returns></returns>
		private static string[] retreiveStringArray() {
			var inputArray = Console.ReadLine().Split(' ');
			return inputArray;
		}

		/// <summary>
		/// スペースで区切られた整数配列の入力を受け取る
		/// </summary>
		/// <returns></returns>
		private static long[] retreiveLongArray() {
			var inputArray = Console.ReadLine().Split(' ');
			var longArray = inputArray.Select(s => long.Parse(s));
			return longArray.ToArray();
		}


		/// <summary>
		/// 2組みずつの入力データ(数値)からTuppleListを作成する
		/// </summary>
		/// <param name="N"></param>
		/// <returns></returns>
		private static List<Tuple<long, long>> createLongTuppleList(long N) {
			var inpList = new List<Tuple<long, long>>();

			for (int i = 0; i < N; i++) {
				var inp = retreiveLongArray();
				var item1 = inp[0];
				var item2 = inp[1];
				inpList.Add(new Tuple<long, long>(item1, item2));
			}
			return inpList;
		}
	}
}


Measured memory_bytes: 28208
#include <stdio.h>
#include <stdlib.h>
#include <math.h>

typedef char                SINT8;
typedef unsigned char       UINT8;
typedef short               SINT16;
typedef unsigned short      UINT16;
typedef int                 SINT32;
typedef unsigned int        UINT32;
typedef long long           SINT64;
typedef unsigned long long  UINT64;

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


SINT32 main() {
    SINT32 ans = 0;
    SINT32 max = 6;
    
    SINT32 *data = malloc(sizeof(SINT32)*max);
    for (SINT32 i = 0; i < max; i++) {
        scanf("%d", &data[i]);
    }

    if ((data[4]-data[0]) > data[5]) {
        printf(":(");
    } else {
        printf("Yay!");
    }




    
    free(data);
	return 0;
}

Measured memory_bytes: 128
# coding: utf-8


def solve(*args: str) -> str:
    n, m = map(int, args[0].split())
    A = list(map(int, args[1].split()))
    total = sum(A)
    ret = [a for a in A if total/(4*m) <= a]

    return 'Yes' if m <= len(ret) else 'No'


if __name__ == "__main__":
    print(solve(*(open(0).read().splitlines())))


Measured memory_bytes: 2940
#include <bits/stdc++.h>
#define LOCAL
using namespace std;
template <typename A, typename B>
ostream& operator <<(ostream& out, const pair<A, B>& a) {
out << "(" << a.first << "," << a.second << ")";
return out;
}
template <typename T, size_t N>
ostream& operator <<(ostream& out, const array<T, N>& a) {
out << "["; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
return out;
}
template <typename T>
ostream& operator <<(ostream& out, const vector<T>& a) {
out << "["; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
return out;
}
template <typename T, class Cmp>
ostream& operator <<(ostream& out, const set<T, Cmp>& a) {
out << "{"; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "}";
return out;
}
template <typename U, typename T, class Cmp>
ostream& operator <<(ostream& out, const map<U, T, Cmp>& a) {
out << "{"; bool first = true;
for (auto& p : a) { out << (first ? "" : ", "); out << p.first << ":" << p.second; first = 0;} out << "}";
return out;
}
#ifdef LOCAL
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
#else
#define trace(...) 42
#endif
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
const char* comma = strchr(names + 1, ',');
cerr.write(names, comma - names) << ": " << arg1 << " |";
__f(comma + 1, args...);
}
#define rep(i,n) for(int i=0; i<(n); i++)
using ll = long long;
#define int long long
using P = pair<int,int>;
//#########################################
int n,m;
int a[11][11];
vector<int> p;
int calc(vector<int> v){
	int ret = 0;
	rep(i,m){
		int tmp = 0;
		rep(j,10)tmp += v[a[i][j]];
		ret += tmp%2 == p[i]%2;
	}
	return ret == m;
}
int dfs(int d,vector<int> &v){
	if(d == n)return calc(v);
	int ret = 0;
	v.push_back(1);
	ret += dfs(d+1,v);
	v.pop_back();
	v.push_back(0);
	ret += dfs(d+1,v);
	v.pop_back();
	return ret;
}
signed main(){
	cin >> n >> m;
	rep(i,m){
		int k;cin >> k;
		rep(j,k)cin >> a[i][j];
	}
	p.resize(m);
	rep(i,m)cin >> p[i];
	//n:switches,m:lamps
	vector<int> v;
	cout << dfs(0,v) << endl;


	return 0;
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
#define MAX 10000007
#define PI acos(-1)
#define eps 1e-8
#define eq(x,y) (fabs((x)-(y)) < eps)
#define debug(x) cout<<x<<endl;
#define endl "\n"
#define MEM(a,x) memset(a,x,sizeof(a))

using namespace std;
typedef long long ll ;
const int inf= 1e9+7;
const int nmax = 1e5+10;

//priority_queue<int,vector<int>,greater<int>>pq; //ascending

/*
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ordered_set tree<long long,null_type,less<long long>, rb_tree_tag,tree_order_statistics_node_update>
using namespace __gnu_pbds;
*/
/*
bool sortbysec(const pair<int,int>&a, const pair<int,int>&b)
{
    return (a.second<b.second);
}
*/
vector<bool>prime(nmax,true);
void sieve()
{
    prime[0]=prime[1]=false;
    for(int i=2;i*i<=nmax;i++)
    {
        if(prime[i])
        {
            for(int j=i*i;j<=nmax;j+=i)
                prime[j]=false;
        }
    }
}
int main()
{
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    ios::sync_with_stdio(false);
    cin.tie(0);
    //cout.tie(NULL);
    sieve();
    int ara[nmax+2]={0};
    for(int i=1;i<=nmax;i+=2)
    {
        if(prime[i] && prime[(i+1)/2])
            ara[i]=1;
    }

    for(int i=1;i<=nmax;i++)ara[i]+=ara[i-1];

    int q;
    cin>>q;

    while(q--)
    {
        int l,r;
        cin>>l>>r;

        int cnt=ara[r]-ara[l-1];

        cout<<cnt<<endl;
    }

    return 0;
}


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

using namespace std;

using ll = long long;


int main() {
#ifdef BZ
    freopen("input.txt", "r", stdin);
#endif
    ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
    string s;
    cin >> s;
    int ans = s.size() + 1;
    for (char c = 'a'; c <= 'z'; c++) {
        string t = s;
        for (int it = 0; it <= s.size(); it++) {
            bool ok = true;
            for (int i = 1; i < t.size(); i++) {
                if (t[i] != t[i - 1]) {
                    ok = false;
                    break;
                }
            }
            if (ok) {
                ans = min(ans, it);
                break;
            }
            string tt;
            for (int i = 0; i + 1 < t.size(); i++) {
                if (t[i] == c || t[i + 1] == c) {
                    tt += c;
                } else {
                    tt += t[i];
                }
            }
            t = tt;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
import sys
l = sys.stdin.readline().strip()
N = int(l)
l = sys.stdin.readline().strip() 
a = list(map(int, l.split()))
count = 0
# j - i = Ai + Aj -> Ai +i = j - Aj
# Li = Ai + i
# Ri = j - Aj
L = []
R = []
for i, one in enumerate(a):
    L.append(one + i+1)
    if (i+1 - one) > 0:
        R.append(i+1-one)
L = sorted(L)
R_count = {}
for one in R:
    if one in R_count:
        R_count[one] += 1
    else:
        R_count[one] = 1
count = 0
for one in L:
    if one in R_count:
        count += R_count[one]

print(count)

Measured memory_bytes: 125896
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
using namespace std;


int main(){
	int a;
	cin>>a;
	
	
	for (int i = 1; i<=9; i++)
	{
		int current = i;
		
		for (int j = i; j<=9; j++)
		{
			if ((current * j) == a)
			{
			cout << "Yes\n";
			return 0;
			}
		}
		
	}
	
	cout<<"No\n"; return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
int map[3][3];
int a[3];
int b[3];

bool check(){
    
    for(int i=0;i<3;i++){
        for(int j=0;j<3;j++){
            if(map[i][j] != a[i]+b[j]){
                return false;
            }
        }
    }
    return true;
}

int main(int argc, const char * argv[]) {
    
    int sm = 101;
    int x=0,y=0;
    for(int i=0;i<3;i++){
        for(int j=0;j<3;j++){
            scanf("%d",&map[i][j]);
            if(sm > map[i][j]){
                sm = map[i][j];
                x=i,y=j;
            }
        }
    }
    int sz = (sm>100)? 100 : sm;
    for(int i=0;i<=sz;i++){
        
        a[x] = i;
        b[y] = sm-i;
        for(int k=-2;k<=2;k++){
            if(k==0) continue;
            if( 0 <= x+k && x+k<=2){
                if(map[x+k][y]-a[x] < 0) continue;
                a[x+k] = map[x+k][y]-b[y];
               
            }
            if( 0 <= y+k && y+k <=2){
                if(map[x][y+k]-b[y] < 0) continue;
                b[y+k] = map[x][y+k]-a[x];
            }
        }
        
        if(check()){
            printf("Yes\n");
            return 0;
        }
    }

    printf("No\n");
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
int main(){
  char s[2000000],t[2000000];
  int i=0,j,k=0;
  scanf("%s",s);
  scanf("%s",t);
  while(s[i]){
    i++;}
  for(j=0;j<i;j++){
    if(s[j]==t[j]){
      k++;
    }
  }
  printf("%d",i-k);
  return 0;}

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

// dp[問題数][配点]
int dp[105][10005];

int main() {
  int n; cin >> n;
  int a[n];
  REP(i,n) cin >> a[i];

  int ans = 0;
  dp[0][0]=1;
  REP(i,n) {
    REP(j,10005) {
      if (dp[i][j]) {
        dp[i+1][j] = 1;
        dp[i+1][j+a[i]] = 1;
      }

      if (i<n-1) continue;
      if (j%10==0) dp[i+1][j] = 0;
      if ((j+a[i])%10==0) dp[i+1][j+a[i]] = 0;
    }
  }
  REP(i,10005) if (dp[n][i]) ans=i;
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3072
(let* ((n (read))
    (a (make-array n))
    (b (make-array (+ n 1)))
    (c (make-array n))
    (ans 0))
    (loop for i below n do
        (setf (aref a i) (- (read) 1))
    )
    (loop for i below n do
        (setf (aref b i) (read))
    )
    (loop for i below (- n 1) do
        (setf (aref c i) (read))
    )

    (loop for i below n do
        (progn
            (incf ans (aref b (aref a i)))
            (if (and (> i 0) (= (aref a i) (+ (aref a (- i 1)) 1)))
                (incf ans (aref c (aref a (- i 1))))
            )
        )
    )
    (format t "~D~%" ans)
)

Measured memory_bytes: 24580
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define task ""

using namespace std;

const int maxn = 1e6 + 69;
const ll mod = 1e9 + 7;

ll a[maxn], l[maxn];

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    if(fopen(task".in", "r")){
        freopen(task".in", "r", stdin);
        freopen(task".out", "w", stdout);
    }
    int n;
    int ans = 0;
    cin >> n;
    for(int a = 1; a < n; a ++){
        ans += (n/a);
        if(n % a == 0) ans --;
    }
    cout << ans;


}
/*
10 3
11 4
12 5
*/


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

d = []
for t in range(1, n):
    s1 = sum(w[:t])
    s2 = sum(w[t:])
    if s1 > s2:
        dif = s1 - s2
    else:
        dif = s2 - s1
    d.append(dif)

print(min(d))

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

void change_character(int N, int K) {
  char S[N+1];
  scanf("%s",S);
  S[K-1] = tolower(S[K-1]);
  printf("%s",S);
}

int main(void) {
  int N, K;
  scanf("%d%d",&N,&K);
  change_character(N,K);
  return 0;
}

Measured memory_bytes: 128