akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <cmath>
#include <iomanip>
#include <queue>
#include <algorithm>
#define shosu(x) fixed<<setprecision(x)
using namespace std;
typedef pair<int,int> P;
const int inf=1<<30;
const double pi=acos(-1);

int H,W,ans=0;
vector<vector<char> > field;
vector<vector<int> > dp;

int main(){
	cin>>H>>W;
	field=vector<vector<char> >(H,vector<char>(W));
	dp=vector<vector<int> >(H+1,vector<int>(W+1,0));
	for(int i=0;i<H;i++){
		for(int j=0;j<W;j++){
			cin>>field[i][j];
		}
	}
	for(int i=1;i<=H;i++){
		for(int j=1;j<=W;j++){
			if(field[i-1][j-1]=='1') continue;
			dp[i][j]=min(min(dp[i-1][j]+1,dp[i][j-1]+1),dp[i-1][j-1]+1);
			if(ans<dp[i][j]) ans=dp[i][j];
		}
	}
	cout<<ans*ans<<endl;
}

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

int main(void) {
  string S; cin >> S;

  sort(S.begin(), S.end());
  
  int count = 1;
  for(int i = 1; i < S.length(); i++){
    if(S[i] != S[i - 1]) count++;
  }

  if(S[1] != S[2] && count == 2){
    cout << "Yes";
  }  
  else{
    cout << "No";
  }

  return 0;
}

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

int main(){
    int n;
    cin>>n;
    int a[n+1],b[n];
    for(int i=0;i<=n;i++)cin>>a[i];
    for(int i=0;i<n;i++)cin>>b[i];
    long long ans=0;
    for(int i=0;i<n;i++){
        if(a[i]+a[i+1]>=b[i]){
            ans+=b[i];
            if(b[i]>=a[i]){
                a[i+1]-=b[i]-a[i];
            }
        }else{
            ans+=a[i]+a[i+1];
            a[i+1]=0;
        }
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 4328
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt(),h,m,c;
        c=a%60;a/=60;
        m=a%60;h=a/60;
        System.out.printf("%d:%d:%d\n",h,m,c);
    }
}


Measured memory_bytes: 26368
var
	N,i,L,R,x,y,z,w:Longint;
	a,b:Array[0..100000]of Longint;
begin
	read(N);
	for i:=1 to N do begin
		read(x);
		if i mod 2=1 then inc(a[x])else inc(b[x]);
	end;
	x:=0;
	for i:=1 to 100000 do begin
		if a[x]<a[i]then begin
			y:=x;
			x:=i;
		end else if a[y]<a[i]then begin
			y:=i;
		end;
		if b[z]<b[i]then begin
			w:=z;
			z:=i;
		end else if b[w]<b[i]then begin
			w:=i;
		end;
	end;
	if x<>z then writeln(N-a[x]-b[z])else begin
		L:=N-a[y]-b[z];
		R:=N-a[x]-b[w];
		if L<R then writeln(L)else writeln(R);
	end;
end.


Measured memory_bytes: 896
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <functional>
#include <cstdlib>
#include <sstream>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <complex>
#include <vector>
#include <cstdio>
#include <math.h>
#include <cmath>
#include <time.h>
#define all(c) ((c).begin(),(c).end())
#define rall(c) (c).rbegin(),(c).rend()
#define sort(v,n) sort(v,v+n)
#define vsort(v) sort(v.begin(),v.end())
#define vvsort(v) sort(v.begin(),v.end(),greater<int>())
#define ll long long
#define pb(a) push_back(a)
#define fi first
#define se second
#define inf 999999999
using namespace std;
const ll MOD = 1e9 + 7;
const double PI = acos(-1.0);
//---------------------------------------------------------------------------------------------//
int a, d, n;

bool is_prime(int a) {
	if (a == 0 || a == 1)return 1;
	int i = 2;
	while (i*i <= a) {
		if (a%i == 0)return 1;
		i++;
	}
	return 0;
}


int main() {
	while (cin >> a >> d >> n) {
		if (a == 0)return 0;
		int cont = 0;
		ll sum = a;
		if (!is_prime(sum))cont++;
		while (cont <= n) {
			if (cont == n)break;
			else {
				sum += d;
				if (!is_prime(sum)) {
					cont++;
				}
			}
		}
		cout << sum << endl;
	}
}

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

using namespace std;

using ll = long long;

template<typename T> using V = std::vector<T>;
using Vi = V<int>;
using VVi = V<V<int>>;
using Vl = V<ll>;
using VVl = V<V<ll>>;
using Vs = V<string>;

template<typename T1, typename T2> using P = std::pair<T1, T2>;
using Pii = P<int, int>;
using Pll = P<ll, ll>;
using Pdd = P<double, double>;

template<typename T1, typename T2> using M = std::map<T1, T2>;
using Mii = M<int, int>;
using Msi = M<string, int>;

#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define REP2(i,s,e) for(int i=(int)(s);i<(int)(e);++i)
#define RREP(i,s,e) for(int i=(int)(s);i>=(int)(e);--i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin(),ie=(c).end();i!=ie;++i)
#define ALL(c) (c).begin(), (c).end()

const double PI = acos(-1);
const ll MOD = 1e9+7;

int n, m;
string s;

int main() {
    cin >> n >> m;
    VVi edges(n, Vi(n, -1));
    REP(i, m) {
        int s, t, d;
        cin >> s >> t >> d;
        edges[s][t] = d;
    }

    VVi dp(1 << n, Vi(n, 1e9));
    dp[0][0] = 0;
    REP(bit, 1 << n) {
        REP(from, n) {
            REP(to, n) {
                if (bit & (1 << to)) continue;
                if (edges[from][to] == -1) continue;
                dp[bit | (1 << to)][to] = min(
                    dp[bit | (1 << to)][to],
                    dp[bit][from] + edges[from][to]
                );
            }
        }
    }
    if (dp[(1 << n) - 1][0] == 1e9) {
        std::cout << -1 << '\n';
    } else {
        std::cout << dp[(1 << n) - 1][0] << '\n';
    }

    return 0;
}



Measured memory_bytes: 6228
#include<bits/stdc++.h>
using namespace std;
typedef long long int lli;
lli a, b, c, d, e, f, g, h, x[1009], y[1009]={},kq=1, mod=1e9+7;
bool nt[1009]={};
vector<lli> v;
void sang()
{
	nt[1]=1;
	for(int i=2;i<=32;i++)
	{
		if(nt[i]==0)
		{
			a=i+i;
			while(a<=1000)
			{
				nt[a]=1;
				a=a+i;
			}
		}
	}
	for(int i=2;i<=1000;i++)
	{
		if(nt[i]==0)
		{
			v.push_back(i);
		}
	}
}
int main()
{
	sang();
	cin>>a;
	for(int i=2;i<=a;i++)
	{
		b=i;
		c=0;
		while(b!=1)
		{
			while(b%v[c]==0)
			{
				y[v[c]]++;
				b=b/v[c];
			}
			c++;
		}
	}
	for(auto c: v)
	{
		if(c>a)
		{
			break;
		}
		kq=(kq*(y[c]+1))%mod;
	}
	cout<<kq;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <numeric>
#define rep(i, N) for (int i = 0; i < N; i++)
using namespace std;
int main()
{
    int X, A;
    cin >> X >> A;
    if (X < A)
    {
        cout << 0 << endl;
    }
    else
    {
        cout << 10 << endl;
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i=0; i<(n); ++i)
using namespace std;
using ll=long long;
int main(){
    int n,k;
    cin>>n>>k;
    vector<int>h(n);
    rep(i,n){
        cin>>h[i];
    }
    int ans=1e9;
    sort(h.rbegin(),h.rend());
    for(int i=0; i<n-k+1; ++i){
        ans=min(ans,(h[i]-h[i+k-1]));
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
#define fio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
using ll=long long;
using ld=long double;
#define inf INT_MAX  
const ll infll=1ll*inf*inf;
#define mode 998244353
#define mod 1000000007
const long double PI=3.141592653589793238462643383279502884197169399375105820974944;
#define pb push_back
#define mp make_pair
#define ub upper_bound 
#define lb lower_bound 
#define far(i,a,b) for (ll i = a; i <= b; i++)
#define rev(i,a,b) for (ll i = a; i >= b; i--)
#define all(v) v.begin(),v.end()
#define ff first
#define ss second
#define sz(a) int((a).size())
#define ftr(c,i) for(auto i = begin(c); i != end(c); i++)
#define rtr(c,i) for(auto i = rbegin(c); i != rend(c); i++)
#define pre(c,x) ((c).find(x) != (c).end())
#define cpre(c,x) (find(all(c),x) != (c).end())
#define mll map<ll,ll>
#define vs vector<string>
#define vi vector<int>
#define vl vector<ll>
#define pll pair<ll,ll>
#define pii pair<int,int>
#define vii vector<pii >
#define vll vector<pll >
#define vvl vector<vector<ll> >
#define vvi vector< vector<int > >
#define W(t) while(t --)
#define print(arr) for (auto it = arr.begin(); it != arr.end(); ++it) cout <<(ll)(it-arr.begin()) << ')' <<  *it << ' '; cout << endl;
#define printii(arr) for (auto it = arr.begin(); it != arr.end(); ++it) cout << it->ff<<' '<<it->ss << endl; cout << endl;
#define MID(i,j) ((i)+(j))/2
#define nl '\n' 
#define lcm(a,b) ((a)*(b))/gcd((a),(b))
ll max(ll a,ll b) {return (a>b? a:b);}
ll min(ll a,ll b) {return (a>b? b:a);}
ll gcd(ll a,ll b) {return (b==0)? a:gcd(b,a%b); }
ll gcd(ll a,ll b,ll & x,ll & y) {
    if (a == 0) {
        x = 0;
        y = 1;
        return b;
    }
    ll x1, y1;
    ll d = gcd(b % a, a, x1, y1);
    x = y1 - (b / a) * x1;
    y = x1;
    return d;
}
ll modinv(ll a,ll b){
	ll x,y;
	gcd(a, b, x, y);
	return (x%b + b)%b;
}
ll ceiling(ll a,ll b){ 
        if(a%b==0) return a/b;
        else return a/b+1;
}
ll powm(ll a,ll b,ll m){
	a%=m;
	ll res=1;
	while(b>0){
		if(b&1) res=(res*a)%m;
		b>>=1;
		a=a*a%m;
	}
	return res;
}
const int N=1e6+5;
ll n,m,q,t,k,x,y,z;
vi pos;
string s;
int main()
{
	fio;
	cin >> s;
	far(i,0,sz(s)-1){
		if(s[i]=='1') pos.pb(i);	
	}
	n=sz(pos)-1;
	far(i,0,n){
		z=(z+(powm(2,i,mod)*powm(3,sz(s)-1-pos[i],mod))%mod)%mod;	
	}
	z=(z+powm(2,n+1,mod))%mod;	
	cout << z << nl;
	
}


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

int main(){
  string S,T;
  cin >> S >> T;
  int A=S.size(),B=T.size(),mincount=1e9;
  for(int i=0;i<A-B+1;i++){
    int count=0;
    string U=S.substr(i,B);
    for(int j=0;j<B;j++){
      if(T.at(j)!=U.at(j)){
        count++;
      }
    }
    mincount=min(mincount,count);
  }
  cout << mincount << endl;
}
  

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

using namespace std ;

const int inf = 1e9 ;
const int MAX = 1e5 + 10 ;

int arr[MAX] , dist[MAX][3] ;
int n , m ;

vector< vector<int> >adj(MAX) ;

void dijkstra(int s)
{
	for(int i = 0 ; i <= n ; ++i)
		dist[i][0] = dist[i][1] = dist[i][2] = inf ;
	priority_queue< array<int , 3> , vector< array<int , 3> > , greater< array<int , 3> > >q ;
	dist[s][0] = 0 ;
	q.push({0 , s , 0}) ;
	while(!q.empty())
	{
		int cost = q.top()[0] ;
		int node = q.top()[1] ;
		int x = q.top()[2] ;
		q.pop() ;
		if(dist[node][x] < cost)
			continue ;
		for(auto &child : adj[node])
		{
			int ncost = cost ;
			if(x == 2)
				ncost++ ;
			if(ncost < dist[child][(x+1)%3])
			{
				dist[child][(x+1)%3] = ncost ;
				q.push({ncost , child , (x+1)%3}) ;
			}
		}
	}
	return ;
}

int main()
{
	ios_base::sync_with_stdio(0) ;
	cin.tie(0) ;
	cin>>n>>m ;
	for(int i = 0 ; i < m ; ++i)
	{
		int x , y ;
		cin>>x>>y ;
		adj[x].push_back(y) ;
	}
	int s , t ;
	cin>>s>>t ;
	dijkstra(s) ;
	int ans = dist[t][0] ;
	if(ans == inf)
		ans = -1 ;
	return cout<<ans<<"\n" , 0 ;
}		

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

public class Main {
    static int m;
    public static void main(String[] args) {
        MyScanner sc = new MyScanner();
        PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out));
        int k = sc.nextInt(); int q = sc.nextInt();
        long [] d = new long[k];
        for (int i = 0; i < k; i++) d[i] = sc.nextLong();
        for (int qq = 0; qq < q; qq++) {
            long n = sc.nextLong();
            long x = sc.nextLong();
            m = sc.nextInt();
            long [] pref = new long[k];
            pref[0] = mod(d[0]);
            for (int i = 1; i < k; i++) {
                pref[i] = pref[i - 1] + mod(d[i]);
            }
            long times = (n - 1) / k;
            long total = x + times * pref[k - 1];
            int rem = (int) (n - 1) % k - 1;
            if (rem >= 0) total += pref[rem];
            long bad = total / m - x / m;
            out.println(n - 1 - bad);
        }
        out.close();
    }

    static long mod(long input) {
        return (input % m == 0 ? m : input % m);
    }


    //-----------MyScanner class for faster input----------
    public static class MyScanner {
        BufferedReader br;
        StringTokenizer st;

        public MyScanner() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

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

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

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

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }


    }

}

Measured memory_bytes: 63852
#include <bits/stdc++.h>
typedef long long LL;
#define SORT(c) sort((c).begin(),(c).end())

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

using namespace std;
string s;
int i;
bool solve(void)
{
  if(i>=s.size()) return false;
  if(s[i]=='m'){
    ++i;
    if(!solve()) return false;
    if(i>=s.size()) return false;
    if(s[i]=='e'){
      ++i;
      if(!solve()) return false;
      if(i>=s.size()) return false;
      if(s[i]=='w'){
	++i;
	return true;
      }
    }
  }else return true;
}
int main(void)
{
  cin >> s;
  i=0;
  if(solve()&&i==s.size()) cout << "Cat" << endl;
  else cout << "Rabbit" << endl;
  return 0;
}

Measured memory_bytes: 3188
import java.util.Scanner;

public class Main {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		Scanner cin = new Scanner(System.in);
		double eps = 0.0000000000001;
		int N = cin.nextInt();
		while(N--!=0){
			double x1 = cin.nextDouble();
			double y1 = cin.nextDouble();
			double x2 = cin.nextDouble();
			double y2 = cin.nextDouble();
			double x3 = cin.nextDouble();
			double y3 = cin.nextDouble();
			double x4 = cin.nextDouble();
			double y4 = cin.nextDouble();
			if(x2-x1 + eps >= 0 && x2-x1-eps <= 0){
				if(x4-x3 + eps >= 0 && x4-x3-eps <= 0){
					System.out.println("YES");
					continue;
				}
			}
			double d1 = (y2-y1)/(x2-x1);
			double d2 = (y4-y3)/(x4-x3);
			if(d1+eps >= d2 && d1-eps <= d2){
				System.out.println("YES");
			}
			else{
				System.out.println("NO");
			}
		}
	}

}

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

using namespace std;

#define int long long
#define FOR(i, a, b) for(ll i = (a); i < (b); ++i)
#define FORR(i, a, b) for(ll i = (a); i > (b); --i)
#define REP(i, n) for(ll i = 0; i < (n); ++i)
#define REPR(i, n) for(ll i = n; i >= 0; i--)
#define FOREACH(x, a) for(auto &(x) : (a))
#define VECCIN(x)                                                              \
    for(auto &youso_ : (x)) cin >> youso_
#define bitcnt __builtin_popcount
#define SZ(x) ((ll)(x).size())
#define fi first
#define se second
#define All(a) (a).begin(), (a).end()
template <typename T = long long> inline T IN() {
    T x;
    cin >> x;
    return (x);
}
inline void CIN() {}
template <class Head, class... Tail>
inline void CIN(Head &&head, Tail &&... tail) {
    cin >> head;
    CIN(move(tail)...);
}
#define CINT(...)                                                              \
    int __VA_ARGS__;                                                           \
    CIN(__VA_ARGS__)
#define LCIN(...)                                                              \
    ll __VA_ARGS__;                                                            \
    CIN(__VA_ARGS__)
#define SCIN(...)                                                              \
    string __VA_ARGS__;                                                        \
    CIN(__VA_ARGS__)
#define Yes(a) cout << (a ? "Yes" : "No") << "\n"
#define YES(a) cout << (a ? "YES" : "NO") << "\n"
#define Printv(v)                                                              \
    {                                                                          \
        FOREACH(x, v) { cout << x << " "; }                                    \
        cout << "\n";                                                          \
    }
template <typename T = string> inline void eputs(T s) {
    cout << s << "\n";
    exit(0);
}
template <typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val) {
    std::fill((T *)array, (T *)(array + N), val);
}
template <typename T> using PQG = priority_queue<T, vector<T>, greater<T>>;
template <typename T> using PQ = priority_queue<T>;

typedef long long ll;
typedef unsigned long long ul;
typedef vector<ll> VL;
typedef pair<ll, ll> PL;

const int INF = 1e9;
const int MOD = 1e9 + 7;
// const int MOD = 998244353;
const ll LINF = 1e18 + 1;
const ll dx[] = {1, -1, 0, 0};
const ll dy[] = {0, 0, 1, -1};

ll n, m;
const ll Ma = 7368792;
bool isprime[Ma];

signed main() {
    while(1) {
        cin >> m >> n;
        if(n == 0 && m == 0) break;
        ll cnt = 0;
        fill(isprime, isprime + Ma, true);
        FOR(i, m, Ma + 1) {
            if(isprime[i]) {
                if(++cnt - 1 == n) {
                    cout << i << "\n";
                    break;
                }
                for(int j = 2 * i; j <= Ma; j += i) {
                    isprime[j] = false;
                }
            }
        }
    }
}



Measured memory_bytes: 10288
// 2011/02/03 Tazoe

#include <iostream>
using namespace std;

int main()
{
	char pat[8][8];

	for(int i=0; i<8; i++)
		for(int j=0; j<8; j++)
			cin >> pat[i][j];

	cout << 90 << endl;
	for(int j=0; j<8; j++){
		for(int i=7; i>=0; i--){
			cout << pat[i][j];
		}
		cout << endl;
	}

	cout << 180 << endl;
	for(int i=7; i>=0; i--){
		for(int j=7; j>=0; j--){
			cout << pat[i][j];
		}
		cout << endl;
	}

	cout << 270 << endl;
	for(int j=7; j>=0; j--){
		for(int i=0; i<8; i++){
			cout << pat[i][j];
		}
		cout << endl;
	}

	return 0;
}

Measured memory_bytes: 0
n = int(input())
a = list(map(int, input().split()))
a.sort()

ans = 0
for i, ai in enumerate(a):
    for f, af in enumerate(a[i + 1:], i + 1):
        if ai == af:
            continue
        for ag in a[f + 1:]:
            if ag == af:
                continue
            if ai + af > ag:
                ans += 1
print(ans)
    


Measured memory_bytes: 9160
/*#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <iostream>
#include <map>
#include <vector>
using namespace std;
typedef long long int ll;

int main(int argc, char const *argv[]) {
  ll N, M;
  cin >> N >> M;
  ll n[100000];
  n[0] = 1;
  for (ll i = 1; i <= 100000; i++) {
    n[i] = (n[i - 1] * i) % (ll)(7 + 1e+09);
  }
  if (abs(N - M) > 1) {
    cout << 0 << endl;
    return 0;
  } else if (N == M) {
    cout << ((2 * n[N] * n[M])) % (ll)(7 + 1e+09) << endl;
    return 0;
  } else {
    cout << (n[N] * n[M]) % (ll)(7 + 1e+09) << endl;
    return 0;
  }

  return 0;
}*/
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <iostream>
#include <map>
#include <vector>
using namespace std;
typedef long long int ll;

int main(int argc, char const *argv[]) {
  ll N, M;
  cin >> N >> M;
  ll n[100001];
  n[0] = 1;
  for (ll i = 1; i <= 100000; i++) {
    n[i] = n[i - 1] * i % (ll)(7 + 1e+09);
  }
  if (abs(N - M) > 1) {
    cout << 0 << endl;
    return 0;
  } else if (N == M) {
    cout << (2 * (n[N] * n[M])) % (ll)(7 + 1e+09) << endl;
    return 0;
  } else {
    cout << (n[N] * n[M]) % (ll)(7 + 1e+09) << endl;
    return 0;
  }

  return 0;
}


Measured memory_bytes: 1024
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
typedef long long ll;
const int N=5005;
const int mod=1e9+7;
int n,m;
char s[N];
ll d[N][N];
int main()
{
    scanf("%d",&n);
    scanf("%s",s);
    int m=strlen(s);
    if(m>n){
        printf("0\n");
        return 0;
    }
    d[0][0]=1;
    for(int i=1;i<=n;i++)
        for(int j=0;j<=i;j++){
            if(j!=n)
                d[i][j]+=2*d[i-1][j+1];
            if(j!=0)
                d[i][j]+=d[i-1][j-1];
            else
                d[i][j]+=d[i-1][j];
            d[i][j]%=mod;
        }
    printf("%lld\n",d[n][m]);
}


Measured memory_bytes: 193920
#include<iostream>
using namespace std;
int main()
{
 int k; cin >> k;
 int a,b; cin >> a >> b;
 if(((int)b/k-(int)a/k)>=1 || b%k==0 || a%k==0){
     cout << "OK";
 }
 else{
     cout << "NG";
 }
 return 0;
}

Measured memory_bytes: 3656
#include "bits/stdc++.h"
using namespace std;
typedef long long li;

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

    li d, t, s;
    cin >> d >> t >> s;
    cout << ((s * t >= d) ? "Yes" : "No") << endl;

    return 0;
}

Measured memory_bytes: 3640
n, m = map(int, input().split())
snum = 0
bnum = 100000
for i in range(m):
    l, r = map(int, input().split())
    if l >= snum:
        snum = l
    if r <= bnum:
        bnum = r
if snum > bnum:
    print(0) 
else:
    print(bnum - snum + 1)

Measured memory_bytes: 3060
import sys
input = sys.stdin.readline
sys.setrecursionlimit(3000)

mod=10**9+7

N=int(input())

from functools import lru_cache
@lru_cache(maxsize=None)
def calc(rest):
    if rest>=3:
        ANS=1
    else:
        return 0
    
    for i in range(3,rest):
        ANS=(ANS+calc(rest-i))%mod
    return ANS

print(calc(N))


Measured memory_bytes: 10100
#include <cstdio>

int main()
{
  int n, k;
  scanf("%d %d", &n, &k);
  
  int ans = 0;
  for (int i = 0; i < n; ++i)
  {
    int h;
    scanf("%d", &h);
    if (h >= k) ++ans;
  }
  printf("%d\n", ans);
  return 0;
}

Measured memory_bytes: 256
import collections

n,m,k = map(int,raw_input().split(' '))

friendships = [map(int, raw_input().split(' ')) for _ in range(m)]
disses = [map(int, raw_input().split(' ')) for _ in range(k)]

parent = [i for i in range(0, n+1)]
sizes = [1 for i in range(0, n+1)]

hd = collections.Counter()
adj = collections.defaultdict(set)

def f(parent, u):
	if parent[u] != u: 
		parent[u] = f(parent, parent[u])
	return parent[u]

for a,b in friendships:

	pa,pb = f(parent, a), f(parent, b)
	
	adj[a].add(b)
	adj[b].add(a)

	if pa != pb:
		if sizes[pa] >= sizes[pb]:
			parent[pb] = pa
			sizes[pa] += sizes[pb]
		else:
			parent[pa] = pb
			sizes[pb] += sizes[pa]

for c,d in disses:
	pc,pd = f(parent, c), f(parent, d)
	if d not in adj[c] and (pc == pd):
		hd[c] += 1
		hd[d] += 1

print ' '.join([str(sizes[f(parent,u)] - len(adj[u]) - hd[u] - 1)  for u in range(1, n+1)])

Measured memory_bytes: 104348
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long int x,i,j,b,c,d,m,s;
    cin>>x>>m;
    long long int a[x];
    s=0;
    for(i=0;i<x;i++){
        cin>>a[i];
        s=s+a[i];
    }
    c=0;
    float p=(1.00/(4.00*m))*s;
    for(i=0;i<x;i++)
    {
          if(a[i]>=p)
            c++;
    }
    if(c>=m)
        cout<<"Yes\n";
    else
        cout<<"No\n";
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(){
  string s;
  cin >> s;
  if(s=="SUN"){
    cout << 7 << endl;
  }else if(s=="MON"){
    cout << 6 << endl;
  }else if(s=="TUE"){
    cout << 5 << endl;
  }else if(s=="WED"){
    cout << 4 << endl;
  }else if(s=="THU"){
    cout << 3 << endl;
  }else if(s=="FRI"){
    cout << 2 << endl;
  }else{
    cout << 1 << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#!/usr/bin/env python3
import sys

def sample_index_not_zero_in_all_h(h):
    for i in range(len(h)):
        if h[i] != 0:
            return i

def solve(N: int, x: "List[int]", y: "List[int]", h: "List[int]"):
    h_isnot_zero = sample_index_not_zero_in_all_h(h)
    for cx in range(0, 101):
        for cy in range(0, 101):
            # 仮の頂点(Cx, Cy)の高さHを設定
            H_is_true = True
            H = h[h_isnot_zero] + abs(x[h_isnot_zero] - cx) + abs(y[h_isnot_zero] - cy)
            for i in range(N):
                if max(H - abs(x[i] - cx) - abs(y[i] - cy) , 0) != h[i]:
                    H_is_true = False
                    break
            if H_is_true == True:
                print(cx, cy, H)
                return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    x = [int()] * (N)  # type: "List[int]"
    y = [int()] * (N)  # type: "List[int]"
    h = [int()] * (N)  # type: "List[int]"
    for i in range(N):
        x[i] = int(next(tokens))
        y[i] = int(next(tokens))
        h[i] = int(next(tokens))
    solve(N, x, y, h)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <map>
#include <cstring>
#include <string>
#include <vector>
#include <cmath>
#include <random>
#include <set>
#include <deque>
#include <queue>
#include <bitset>
#include <stack>

#define mod 1000000007
#define INF2 9999999999
#define INF (1<<30)
#define rep(i,n) for(int (i)=0; (i)<(n); (i)++)

using namespace std;
using ll = __int64_t;

int dx[] = {1, 0, -1, 0};
int dy[] = {0, 1, 0, -1};
int DX[] = {1, 1, 0, -1, -1, -1, 0, 1};
int DY[] = {0, -1, -1, -1, 0, 1, 1, 1};

int N, A, B, C;
int l[10];

int dfs(int cur, int a, int b, int c){
  if(cur == N){
    if(min(a, min(b, c)) > 0){ //すべての竹に材料があり
      return abs(a-A) + abs(b-B) + abs(c-C) - 30; //伸縮コスト - 材料割当コスト
    }else{
      return INF;
    }
  }
  int ret0 = dfs(cur+1, a, b, c); //cur本目の竹を使わない
  int ret1 = dfs(cur+1, a+l[cur], b, c) + 10; //cur本目の竹をAの材料とする
  int ret2 = dfs(cur+1, a, b+l[cur], c) + 10; //cur本目の竹をBの材料とする
  int ret3 = dfs(cur+1, a, b, c+l[cur]) + 10; //cur本目の竹をCの材料とする
  return min(min(ret0, ret1), min(ret2, ret3));
}

void solve(){
  cin >> N >> A >> B >> C;
  rep(i, N){
    cin >> l[i];
  }
  cout << dfs(0, 0, 0, 0) << endl;
}

int main(){
  solve();
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define repb(i, a, b) for(int i = a; i >= b; i--)
#define all(a) a.begin(), a.end()
#define o(a) cout << a << endl
#define int long long
using namespace std;
typedef pair<int, int> P;

signed main(){
    int w, a, b;
    cin >> w >> a >> b;
    int ans = max((int)0, abs(a - b) - w);
    cout << ans << endl;
}

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

int main()
{
	int N,A;
	double T;
	cin >> N >> T >> A;
	int ans;
	double sa = 1e9;
	rep(i,N)
	{
		double h;
		cin >> h;
		//cout << abs(T - 0.006 * h - A) << endl;
		if (abs(T - 0.006 * h - A) < sa)
		{
			ans = i+1;
			sa = abs(T - 0.006 * h - A);
		}
	}

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

Measured memory_bytes: 256
#include <sstream>
#include <fstream>
#include <cassert>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <set>
#include <stack>
#include <map>
#include <string>
#include <queue>
#include <bitset>
using namespace std;

#define int long long
#define FOR(i, a, b) for (int i = (a), _##i = (b); i <= _##i; ++i)
#define FORD(i, a, b) for (int i = (a), _##i = (b); i >= _##i; --i)
#define REP(i, a) for (int i = 0, _##i = (a); i < _##i; ++i)
#define REPD(i,n) for(int i = (n)-1; i >= 0; --i)

#define DEBUG(X) { cerr << #X << " = " << (X) << endl; }
#define PR(A, n) { cerr << #A << " = "; FOR(_, 1, n) cerr << A[_] << ' '; cerr << endl; }
#define PR0(A, n) { cerr << #A << " = "; REP(_, n) cerr << A[_] << ' '; cerr << endl; }

#define sqr(x) ((x) * (x))
#define ll long long
#define double long double
typedef pair<int, int> II;
#define __builtin_popcount __builtin_popcountll
#define SZ(x) ((int)(x).size())
#define ALL(a) (a).begin(), (a).end()
#define MS(a,x) memset(a, x, sizeof(a))
#define next ackjalscjaowjico
#define prev ajcsoua0wucckjsl
#define y1 alkscj9u20cjeijc
#define left lajcljascjljl
#define right aucouasocjolkjl
#define y0 u9cqu3jioajc
#define fixed jasklcjalcjl

#define TWO(X) (1LL<<(X))
#define CONTAIN(S,X) ((S) & TWO(X))

double safe_sqrt(double x) { return sqrt(max((double)0.0, x)); }
int GI(int& x) { return scanf("%lld", &x); }

const int MN = 200111;
const int INF = 1000111000111000111LL;
pair<int,int> a[MN];
set< pair<int,int> > all;
set<int> fixed;

int get(int xmin, int xmax) {
    int X = xmax - xmin;
    int ymin = INF;
    int ymax = -INF;

    if (!all.empty()) {
        ymin = min(ymin, all.begin()->first);
        ymax = max(ymax, all.rbegin()->first);
    }

    if (!fixed.empty()) {
        ymin = min(ymin, *fixed.begin());
        ymax = max(ymax, *fixed.rbegin());
    }
    return X * (ymax - ymin);
}

int32_t main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout << setprecision(9) << boolalpha;
    int n;
    while (cin >> n) {
        FOR(i,1,n) {
            cin >> a[i].first >> a[i].second;
            if (a[i].first > a[i].second) swap(a[i].first, a[i].second);
        }
        sort(a+1, a+n+1);
        int xmin = a[1].first, xmax = a[n].first;
        all.clear();
        fixed.clear();

        FOR(i,1,n) all.insert(make_pair(a[i].second, a[i].first));

        int res = get(xmin, xmax);

        while (!all.empty()) {
            auto it = all.end(); --it;
            
            int x = it->first, y = it->second;
            all.erase(it);

            fixed.insert(y);
            xmin = min(xmin, x);
            xmax = max(xmax, x);

            res = min(res, get(xmin, xmax));
        }
        cout << res << endl;
    }
    return 0;
}


Measured memory_bytes: 16000
import java.util.*;

public class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int M = sc.nextInt();
        int X[] = new int[M];
        for(int i=0; i<M; i++) {
            X[i] = sc.nextInt();
        }
        Arrays.sort(X);
        int kaisa[] = new int[M-1];
        for(int i=0; i<M-1; i++) {
            kaisa[i] = X[i+1] - X[i];
        }
        Arrays.sort(kaisa);
        long sum = 0;
        for(int i=0; i<M-N; i++) {
            sum+=kaisa[i];
        }
        System.out.println(String.format("%d", sum));
    }
}


Measured memory_bytes: 50256
import itertools
 
N = int(input())
P = list(map(int, input().split()))
Q = list(map(int, input().split()))

lis = [x + 1 for x in range(N)] # 1からnまでのリスト 
permutations_lis = itertools.permutations(lis)# 全ての場合のリストを生成
# 以下出力
p = 0
q = 0
if P == Q:
  ans = 0
  print(ans)
  quit()
  
x = 0
for one_case in permutations_lis: 
  x += 1
  if P == list(one_case):
    p = x
  elif Q == list(one_case):
    q = x

print(abs(q-p))    
    
    
    


Measured memory_bytes: 3064
import java.util.Scanner;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class Main {

    public static void main(String[] args) {
        q_3();
    }

    private static void q_1() {
        try (Scanner scan = new Scanner(System.in)) {
            int a = scan.nextInt();
            int b = scan.nextInt();
            int c = scan.nextInt();

            System.out.println(b / a < c ? b / a : c);
        }
    }

    private static void q_2() {
        try(Scanner scan = new Scanner(System.in)) {
            int a = scan.nextInt();
            int b = scan.nextInt();
            int c = scan.nextInt();

            int min = Math.min(a, b);

            int cnt = 0;
            for (; min >= 1; min--) {
                if (a % min == 0 && b % min == 0) {
                    cnt ++;
                    if(cnt == c) {
                        break;
                    }
                }
            }

            System.out.println(min);
        }
    }

    private static void q_3() {
        try(Scanner scan = new Scanner(System.in)) {

                String s = scan.next();
                int zero = 0;
                int one = 0;
                for (int i = 0; i < s.length(); i++) {
                    if (s.charAt(i) == '0') {
                        zero++;
                    } else {
                        one++;
                    }
                }
                System.out.println(Math.min(zero, one) * 2);

        }
    }
}


Measured memory_bytes: 24284
#include <cstdio>
#include <vector>
#include <algorithm>

int main() {
  size_t N, K;
  scanf("%zu %zu", &N, &K);

  std::vector<int> h(N);
  for (auto& hi: h) scanf("%d", &hi);

  std::sort(h.begin(), h.end());
  int res = 1e9;
  for (size_t i = K-1; i < N; ++i)
    res = std::min(res, h[i]-h[i-(K-1)]);

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

Measured memory_bytes: 640
#include <bits/stdc++.h>
    using namespace std;
    using ll = long long;
    ll n, k, a[200005];
    vector<int> cnt[200002];
    ll jump[200005];
    ll cycle_cnt = 0;
    ll ans[200005];
    int ansl = 0;
    int chk[200005];
    int main()
    {
        ios_base::sync_with_stdio(false);
        cin.tie(nullptr);
     
        cin >> n >> k;
        for(int i=0;i<n;i++)
        {
            cin >> a[i];
            cnt[a[i]].push_back(i);
        }
        for(int i=1;i<=200000;i++)
        {
            for(int x=0;x<cnt[i].size();x++)
            {
                int nxt = (x == cnt[i].size() - 1 ? cnt[i].front() : cnt[i][x+1]);
                if(nxt == cnt[i][x])
                {
                    jump[cnt[i][x]] = n+1;
                }
                else jump[cnt[i][x]] = (nxt-cnt[i][x]+n) % n + 1;
                //cout << "jump " << cnt[i][x] << ' ' << jump[cnt[i][x]] << '\n';
            }
     
        }
     
        cycle_cnt += jump[0];
        while(cycle_cnt % n)
        {
            cycle_cnt += jump[cycle_cnt % n];
        }
        //cout << cycle_cnt << '\n';
        k %= (cycle_cnt / n);
        cycle_cnt = 0;
        while(1)
        {
            if(cycle_cnt + jump[cycle_cnt % n] <= n * k)
            {
                cycle_cnt += jump[cycle_cnt % n];
            }
            else break;
        }
        //cout << cycle_cnt << '\n';
        while(cycle_cnt < n*k)
        {
            if(chk[a[cycle_cnt % n]])
            {
                while(ansl)
                {
                    ansl--;
                    chk[ans[ansl]]--;
                    //cout << "chk " << ans[ansl] << '\n';
                    if(ans[ansl] == a[cycle_cnt%n]) break;
                }
            }
            else
            {
                //cout << "add " << a[cycle_cnt % n] << '\n';
                ans[ansl++] = a[cycle_cnt % n];
                chk[a[cycle_cnt % n]]++;
            }
            cycle_cnt++;
        }
        for(int i=0;i<ansl;i++)
            cout << ans[i] << (i+1 != ansl ? " " : "");
    }

Measured memory_bytes: 17920
#include<iostream>
#include<string>
#define LL long long
#define INF 0x3f3f3f3f
#define io ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
const int N=2e5+100;
using namespace std;	
int main()
{
	string str;
	while(cin>>str)
	{
		int len=str.length();
		int sum1=0;
		int sum2=0;
		
		int wins=0;
		int loses=0;
		for(int i=0;i<len;i++)
		{
			
			if(str[i]=='p')
			{
				if(sum2+1<=sum1)sum2++;
				else sum1++,loses++;
			}
			else 
			{
				if(sum2+1<=sum1)sum2++,wins++;
				else sum1++;
			}
			//cout<<sum1<<" "<<sum2<<" ,,"<<wins<<" "<<loses<<endl;
		}
		cout<<wins-loses<<endl;
	}
	return 0;
} 

Measured memory_bytes: 512
<?php
$input = STDIN;

list($r, $c) = explode(' ', trim(fgets($input)));

$s = array_fill(0, $c, 0);

for ($i = 0; $i < $r; $i++) {
    $line = trim(fgets($input));
    
    print $line;

    $line = explode(' ', $line);
    print ' ' . array_sum($line) . "\n";
    
    foreach ($line as $key => $value) {
        $s[$key] += $value;
    }
}

print implode(' ', $s) . ' ' . array_sum($s) . "\n";


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

class Progaram
{
    static void Main(String[] args)
    {
        var l = Console.ReadLine().Split(' ')
            .Select(x => Int32.Parse(x)).ToArray();
        var a = l[0]; var b = l[1];
        Console.WriteLine(((a > b * 2) ? a - (b * 2) : 0));
    }
}


Measured memory_bytes: 13268
#! /usr/local/bin/python3
# coding: utf-8

from math import floor
from sys import stdin

def allocate(n, k, w, P):
    n_truck = 1
    load = 0
    for wt in w:
        # print(n_truck, load, wt, P)
        if load + wt > P:
            n_truck += 1
            if n_truck > k:
                return False
            load = 0
        load += wt
    return True

def main():
    n, k = [int(x) for x in stdin.readline().split()]
    w = [int(x) for x in stdin]
    min_P = max(max(w), floor(sum(w) / k))
    max_P = sum(w)

    while min_P < max_P:
        mid_P = (min_P + max_P) // 2
        if allocate(n, k, w, mid_P):
            max_P = mid_P
        else:
            min_P = mid_P + 1
        # print(min_P, mid_P, max_P)
    
    print(min_P)

main()



Measured memory_bytes: 9580
main(n,a,b){for(scanf("%d",&n);n--;puts("")){
	scanf("%d%d",&a,&b);
	if(a<6&&b<6){
		if(a<b)for(;a<=b;a++){printf("%d",a);if(a!=b)putchar(' ');}
		else for(;a>=b;a--){printf("%d",a);if(a!=b)putchar(' ');}
	}else if(b<6){
		for(;a<10;a++){printf("%d",a);putchar(' ');}
		for(a=5;a>=b;a--){printf("%d",a);if(a!=b)putchar(' ');}
	}else if(a>5&&b<a){
		for(;a<10;a++){printf("%d",a);putchar(' ');}
		for(a=5;a>0;a--){printf("%d",a);if(a!=b)putchar(' ');}
		for(a=0;a<=b;a++){printf("%d",a);if(a!=b)putchar(' ');}
	}else{
		for(;a<=b;a++){printf("%d",a);if(a!=b)putchar(' ');}
	}
}exit(0);}

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

int main(){
  int n;cin>>n;
  vector<double> a(n);for(int i=0;i<n;i++){cin>>a.at(i);}
  double ans=0;
  for(int i=0;i<n;i++){
    ans+=1/a.at(i);
  }
  ans=1/ans;
  cout<<setprecision(10)<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define maxn 10005
int n,u,k;
int g[maxn][maxn];
int main()
{
    scanf("%d",&n);
    for(int i=1;i<=n;i++)
    {
        int v;
        scanf("%d%d",&u,&k);
        for(int j=1;j<=k;j++)
        {
            scanf("%d",&v);
            g[u][v]=1;
        }
    }

    for(int i=1;i<=n;i++)
    {
        for(int j=1;j<n;j++)
        {
            printf("%d ",g[i][j]);
        }
        printf("%d\n",g[i][n]);
    }

    return 0;
}

Measured memory_bytes: 3508
//#include <bits/stdc++.h>
#include <functional>
#include <algorithm>
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <utility>
#include <sstream>
#include <complex>
#include <cstdio>
#include <bitset>
#include <vector>
#include <cmath>
#include <queue>
#include <stack>
#include <ctime>
#include <list>
#include <set>
#include <map>
using namespace std;
#define ll long long
#define ull unsigned long long

const int MAXN = 100005;
const int INF = 0x3f3f3f3f;
const ll INFLL = 9223372036854775807;
const int MOD = 1e9 + 7;
const double PI=2.0*asin(1.0);

int N, arr[MAXN];

int main()
{
	//freopen("in.txt","r",stdin);
	//freopen("out.txt","w",stdout);

	while(cin>>N){
		int a, b, t;
		cin>>a;
		b=a;
		for(int i=1; i<N; i++){
			cin>>t;
			if(t<a) a=t;
			if(t>b) b=t;
		}
		cout<<b-a<<endl;
	}

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i=0; i<(n); i++)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
const int INF=1001001001;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main(){
    string S; cin >> S;
    int n=S.size();
    vector <int> ans(n);
    rep(i,2){
        int cnt=0;
        rep(i,n){ //solve R
            if (S[i]=='R') cnt++;
            else{
                ans[i]+=cnt/2;
                ans[i-1]+=(cnt+1)/2;
                cnt=0;
            }
        }
        
        reverse(ans.begin(),ans.end());
        reverse(S.begin(),S.end());
        rep(i,n){
            if (S[i]=='L') S[i]='R';
            else S[i]='L';
        }
    }
    rep(i,n){
        cout << ans[i] << " ";
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 1024
from sys import stdin
T1,T2 = [int(x) for x in stdin.readline().rstrip().split()]
A1,A2 = [int(x) for x in stdin.readline().rstrip().split()]
B1,B2 = [int(x) for x in stdin.readline().rstrip().split()]
f = (A1-B1)*T1
s = (A2-B2)*T2
 
if f + s == 0:
    print("infinity")

else:
    if (f > 0) and ((f + s) > 0):
        print(0)
    
    elif (f < 0) and ((f + s) < 0):
        print(0)
        
    elif f > 0 and f + s < 0:
        if  f % (-(f + s)) == 0:
            print((f//-(f+s))*2)
        else:
            print((f//-(f+s))*2+1)
    
    elif f < 0 and f + s > 0:
        if (-f) % (f+s) == 0:
            print((-f//(f+s))*2)
        else:
            print((-f//(f+s))*2+1)

Measured memory_bytes: 3064
#include <iostream>
#include <vector>

using namespace std;

bool tr(int a, int b, int c){
	if (a == b || b == c || c == a) return false;
	if (a + b > c && a + c > b && b + c > a) return true;
	return false;
}

int main(){
	int n, ans = 0, tmp;
	cin >> n;
	vector<int> v(n);
	for (int i = 0; i < n; i++)
		cin >> v[i];
	for (int i = 0; i < n - 2; i++)
		for (int j = i + 1; j < n - 1; j++)
			for (int k = j + 1; k < n; k++)
				if (tr(v[i], v[j], v[k]))
					ans += 1;
	cout << ans << '\n';
	return 0;
}


Measured memory_bytes: 3644
use proconio::input;
use std::collections::HashSet;

fn main() {
    input!{
        n: i32,
        k: i32,
    };

    let mut set = HashSet::new();
    for i in 1..=n {
        set.insert(i);
    }

    for _ in 0..k {
        input!{
            d: i32,
            a_array: [i32;d],
        }

        for a in a_array {
            set.remove(&a);
        }
    }

    println!("{}", set.len());
}


Measured memory_bytes: 2200
#include <stdio.h>
#pragma warning(disable:4996)


int main() {

	int a, b, k;
	scanf("%d", &k);
	scanf("%d %d", &a, &b);
	int temp = k;
	while (b>=temp) {
		if (a <= temp && b >= temp)
			break;
		temp += k;
	}
	if (a <= temp && b >= temp)
		printf("OK");
	else
		printf("NG");

	return 0;

}

Measured memory_bytes: 1736
x,y = map(int, input().split())

a = [1,3,5,7,8,10,12]
b = [4,6,9,11]
c = [2]

if a.count(x) > 0 and a.count(y) > 0:
  print('Yes')
elif b.count(x) > 0 and b.count(y) > 0:
  print('Yes')
elif c.count(x) > 0 and c.count(y) > 0:
  print('Yes')
else:
  print('No')


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

int main(){
  ll n;
  cin >> n;
  ll a[n];
  rep(i, n){cin >> a[i];}

  ll sum1 = 0, sum2 = 0;
  ll ans1 = 0, ans2 = 0;

  rep(i, n){
      sum1 += a[i];
      if(i % 2){
        if(sum1 >= 0){
           ans1 += sum1 + 1;
           sum1 = -1; 
        }
      } else {
        if(sum1 <= 0){
          ans1 += (-sum1) + 1;
          sum1 = 1;
        }
      }
  }
  rep(i, n){
      sum2 += a[i];
      if(i % 2){
        if(sum2 <= 0){
          ans2 += (-sum2) + 1;
          sum2 = 1;
        }
      } else {
        if(sum2 >= 0){
          ans2 += sum2 + 1;
          sum2 = -1;  
        }
      }
  }
  cout << min(ans1, ans2) << endl;
}


Measured memory_bytes: 1024
from bisect import bisect
s = input()
t = input()

alphabet = 'abcdefghijklmnopqrstuvwxyz'
char = {c: [] for c in alphabet}
for i, c in enumerate(s):
    char[c].append(i)

if len(char[t[0]]) == 0:
    print(-1)
    exit()

result = char[t[0]][0]

for c in t[1:]:
    if len(char[c]) == 0:
        print(-1)
        exit()
    idx = bisect(char[c], result % len(s))
    result = result - result % len(s)
    try:
        result += char[c][idx]
    except IndexError:
        result += len(s) + char[c][0]

print(result+1)


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

int n, flag = 1;

int main() {
    scanf("%d", &n);
    int lstx = 0, lsty = 0, lstt = 0, t, x, y;
    for (int i = 1; i <= n; i++) {
        scanf("%d%d%d", &t, &x, &y);
        int tmp = abs(x - lstx) + abs(y - lsty);
        if ((t < tmp || (t - lstt - tmp) % 2) && flag) {
            puts("No"); flag = 0;
        }
        lstx = x, lsty = y, lstt = t;
    }
    if (flag) puts("Yes");
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

void insertionSort(int A[], int N);
int A[100];
int main(void){

  int N, i, y;

  scanf("%d",&N);

  for(i = 0; i < N; i++){

    scanf("%d",&y);
    
    A[i] = y;
    
    if(i > 0) printf(" ");
    printf("%d",A[i]);
 
 }
  printf("\n");

  insertionSort(A, N);
  return 0;

}

void insertionSort(int A[], int N){

  int i, j, k, v;

  for(i = 1; i < N; i++){
    v = A[i];
    j = i - 1;

    while(j >= 0 && A[j] > v){
      A[j+1] = A[j];
      j--;
      A[j+1] = v;
    }

    for(k = 0; k < N; k++){
      if(k > 0) printf(" ");
      printf("%d",A[k]);
    }
    printf("\n");
  }
}



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

int		main(void)
{
	int a, b, c, x;

	cin >> a >> b >> c >> x;
	int cnt = 0;

	for (int i = 0; i <= a; i++)
	{
		for (int j = 0; j <= b; j++)
		{
			for (int k = 0; k <= c; k++)
			{
				if (500 * i + 100 * j + 50 * k == x)
					cnt++;
			}
		}
	}
	cout << cnt << endl;
}


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

#define ll              long long
#define pb              push_back
#define ppb             pop_back
#define endl            '\n'
#define mii             map<ll,ll>
#define pii             pair<ll,ll>
#define vi              vector<ll>
#define vs              vector<string>
#define all(a)          (a).begin(),(a).end()
#define F               first
#define S               second
#define sz(x)           ((ll)x.size())
#define hell            (1000000007)
#define inf             ((ll)5e18 + 5)
#define PI              ((double)3.14159265358979323844)
#define DECIMAL(n)      cout << fixed << setprecision(n);
#define rep(i,a,b)      for (ll i=a;i<b;i++)
#define repr(i,a,b)     for (ll i=a-1;i>=b;i--)
#define bitcount(a)     (ll)__builtin_popcount(a)
#define lbnd            lower_bound
#define ubnd            upper_bound
#define mp              make_pair
#define ios             ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define ordered_set     tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update>
#define trace(...)      __f(#__VA_ARGS__, __VA_ARGS__)

template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    std::cerr << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');std::cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}

using namespace std;
using namespace __gnu_pbds;

/*----------------------Graph Moves----------------*/
//const int fx[]={+1,-1,+0,+0};
//const int fy[]={+0,+0,+1,-1};
//const int fx[]={+0,+0,+1,-1,-1,+1,-1,+1};   // Kings Move
//const int fy[]={-1,+1,+0,+0,+1,+1,-1,-1};  // Kings Move
//const int fx[]={-2, -2, -1, -1,  1,  1,  2,  2};  // Knights Move
//const int fy[]={-1,  1, -2,  2, -2,  2, -1,  1}; // Knights Move
/*------------------------------------------------*/

//primes for hashing 937,991,1013,1409,1741
vi a[100005];
bool vis[100005];
ll par[100005];
// bool vis[100005];
// void dfs(ll node) {
// 	vis[node]=1;
// 	for(auto i:a[node]){
// 		if(!vis[i]){
// 			dfs(i);
// 		}
// 	}
// }
void bfs(ll source) {
	vis[source]=true;
	queue <ll> q;
	q.push(source);
	while(!q.empty()) {
		ll p=q.front();
		q.pop();
		for(ll i=0;i<a[p].size();i++) {
			if(vis[a[p][i]] == false) {
				vis[a[p][i]] = true;
				par[a[p][i]]=p;
				q.push(a[p][i]);
			}
		}
	}
}
void solve() {
    ll n,m;
    cin>>n>>m;
    rep(i,0,m){
    	ll x,y;
    	cin>>x>>y;
    	a[x].pb(y);
    	a[y].pb(x);
    }
    if (sz(a[1])==0){
    	cout<<"No"<<endl;
    	return;
    }
    cout<<"Yes"<<endl;
    bfs(1);
    rep(i,2,n+1){
    	cout<<par[i]<<endl;
    }
}

signed main() {
    ios
    ll test=1;
    //cin>>test;
    while (test--) solve();
    return 0;
}

Measured memory_bytes: 13140
package main

import (
	"fmt"
)

type step struct {
	t int
	x int
	y int
}

func main() {
	var n int
	var t, x, y int

	steps := []step{}

	fmt.Scan(&n)
	for i := 0; i < n; i++ {
		fmt.Scan(&t, &x, &y)
		steps = append(steps, step{t, x, y})
	}
	// fmt.Println(steps)

	test := func(steps []step) string {
		for _, s := range steps {
			if !(s.x+s.y <= s.t && (s.x+s.y)%2 == s.t%2) {
				return "No"
			}
		}
		return "Yes"
	}

	fmt.Println(test(steps))
}


Measured memory_bytes: 12928