akhauriyash/Code-Regression huggingface dataset:
#include <map>
#include <set>
#include <ctime>
#include <cmath>
#include <queue>
#include <stack>
#include <ctime>
#include <string>
#include <vector>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <iostream>
#include <algorithm>
//#include <random>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
#define PB push_back
#define MP make_pair
#define INF 1073741824
#define inf 1152921504606846976
#define pi 3.14159265358979323846
//#pragma comment(linker,"/STACK:10240000,10240000")
//mt19937 rand_(time(0));
const int N=3e5+7,M=2e6;
const long long mod=1e9+7;
inline int read(){int ret=0;char ch=getchar();bool f=1;for(;!isdigit(ch);ch=getchar()) f^=!(ch^'-');for(;isdigit(ch);ch=getchar()) ret=(ret<<1)+(ret<<3)+ch-48;return f?ret:-ret;}
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll ksm(ll a,ll b,ll mod){int ans=1;while(b){if(b&1) ans=(ans*a)%mod;a=(a*a)%mod;b>>=1;}return ans;}
ll inv2(ll a,ll mod){return ksm(a,mod-2,mod);}//ÄæÔª
//int head[N],NEXT[M],ver[M],tot;void link(int u,int v){ver[++tot]=v;NEXT[tot]=head[u];head[u]=tot;}
const db EPS=1e-10;
inline int sign(db a){return a<-EPS?-1:a>EPS;}
inline int cmp(db a,db b){return sign(a-b);}
db dp[310][310][310];
db nn;
db dfs(int a,int b,int c){
    db A=a,B=b,C=c;
    db D=a+b+c;
    if(cmp(dp[a][b][c],0)>=0) return dp[a][b][c];
    db res=1.0*nn/D;
//    cout<<res<<' '<<a<<' '<<b<<' '<<c<<endl;
    if(a) res=res+1.0*dfs(a-1,b,c)*A/D;
//    cout<<res<<' '<<a<<' '<<b<<' '<<c<<endl;
    if(b) res=res+1.0*dfs(a+1,b-1,c)*B/D;
//    cout<<res<<' '<<a<<' '<<b<<' '<<c<<endl;
    if(c) res=res+1.0*dfs(a,b+1,c-1)*C/D;
//    cout<<res<<' '<<a<<' '<<b<<' '<<c<<endl;
    //dp[a][b][c]=nn/D+dfs(a-1,b,c)*nn/A+dfs(a+1,b-1,c)*nn/B+dfs(a,b+1,c-1)*nn/C;
    dp[a][b][c]=res;
    return res;
}
int main(){
    //freopen("1.txt","r",stdin);
    //ios::sync_with_stdio(false);
    int n,inp;
    int a=0,b=0,c=0;
    scanf("%d",&n);
    for(int i=1;i<=n;i++){
        scanf("%d",&inp);
        if(inp==1) a++;
        else if(inp==2) b++;
        else c++;
    }
    for(int i=0;i<310;i++)
    for(int j=0;j<310;j++)
    for(int k=0;k<310;k++)
        dp[i][j][k]=-1;
    dp[0][0][0]=0;
    nn=n;
    printf("%.15f\n",dfs(a,b,c));
//    for(int i=0;i<=3;i++){
//        for(int j=0;j<=3;j++){
//            for(int k=0;k<=3;k++){
//                cout<<dp[i][j][k]<<' ';
//            }
//            cout<<endl;
//        }
//        cout<<endl;
//    }
    //cout << "time: " << (long long)clock() * 1000 / CLOCKS_PER_SEC << " ms" << endl;
    return 0;
}




Measured memory_bytes: 233088
package main

import (
	"fmt"
)

/*
func nextPoint(x, i int) []int {
	//	return []int{x, x + i, x - i}
	return []int{x, x + i}
}
*/
func sigma(N int) int {
	if N == 1 {
		return 1
	}
	return N + sigma(N-1)
}

func main() {
	var X int
	fmt.Scan(&X)

	i := 0
	for {
		i += 1
		if i*(i-1)/2 >= X {
			break
		}
	}
	fmt.Println(i - 1)

}

Measured memory_bytes: 512
eval"D,G,*A="+`dd`.split*?,
p (0..1023).map{|b|n=e=0;s=G;D.times{|i|q,c=A[i*2,2];e+=100;b[i]>0?(n+=q;s-=q*e+c):Q=q*E=e};s>0?s>Q ? G: n--s/E: n}.min

Measured memory_bytes: 2184
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1e18

int main() {
    int N;
    string S;
    cin >> N >> S;
    string S0 = S.substr(0, N), S1 = S.substr(N, N);
    reverse(S1.begin(), S1.end());

    auto coloring = [](string s, map<pair<string, string>, ll>& mp) {
        for (int bit = 0; bit < (1 << s.size()); ++bit) {
            string r = "", b = "";
            for (int i = 0; i < s.size(); i++)
                if (bit & (1 << i)) {
                    r.push_back(s[i]);
                } else
                    b.push_back(s[i]);
            mp[{r, b}]++;
        }
    };

    map<pair<string, string>, ll> mp0, mp1;
    coloring(S0, mp0);
    coloring(S1, mp1);
    ll ans = 0;
    for (const auto& p : mp0) ans += p.second * mp1[p.first];
    cout << ans << endl;
    return 0;
}

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

using ll = long long;
using pii  = pair<int, int>;
using pll = pair<ll, ll>;
#define ull unsigned long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define vc vector<char>
#define vs vector<string>
#define vpii vector<pii>
#define vpll vector<pll>

#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; i++)
#define rep1(i, n) for (int i = 1, i##_len = (n); i <= i##_len; i++)
#define repr(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rep1r(i, n) for (int i = ((int)(n)); i >= 1; i--)

#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define RSORT(x) sort(rall(x));
#define pb push_back
#define mp make_pair

#define INF (1e9)
#define PI (acos(-1))
#define EPS (1e-7)

ull gcd(ull a, ull b) { return b ? gcd(b, a % b) : a; }
ull lcm(ull a, ull b) { return a / gcd(a, b) * b; }

vector<vi> g;
vi x, val;
void dfs(int v, int p=-1, int c=0) {
    val[v] = c + x[v];
    for (int t : g[v]) {
        if (t == p) continue;
        dfs(t, v, val[v]);
    }
}

int main(){
    int n, q;
    cin >> n >> q;
    g.resize(n);
    val.resize(n);
    x.resize(n);
    rep(i, n-1) {
        int a, b;
        cin >> a >> b;
        --a; --b;
        g[a].pb(b);
        g[b].pb(a);
    }
    rep(i, q) {
        int p, xi;
        cin >> p >> xi;
        --p;
        x[p] += xi;
    }
    dfs(0);
    rep(i, n) printf("%d%c", val[i], (i<n-1?' ':'\n'));
    return 0;
}


Measured memory_bytes: 25068
using System;
using System.Collections.Generic;
using System.Text;

namespace AtCoder
{
  class Program
  {
    static void Main(string[] args)
    {
      long mod = 1000000007;
      string s = Console.ReadLine();

     if( s.EndsWith("s"))
        Console.WriteLine(s + "es");
     else
        Console.WriteLine(s + "s");
      //int N = int.Parse(Console.ReadLine());

      //long[] ns = new long[2001];
      //for(int i = 3; i <= N; i++)
      //{
      //  long x = 1;
      //  for(int j = 3; j <= i - 3; j++)
      //  {
      //    x += ns[j];
      //    x %= mod;
      //  }
      //  ns[i] = x;
      //}

      Console.ReadLine();
    }
    
  }
}

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

//using namespace--------------------------------------------------------------------------------------------------------------
using namespace std;

//define-----------------------------------------------------------------------------------------------------------------------
#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define FOR(i, s, n) for(int i = s; i < (int)n; i++)
#define per(i, n) for(int i = n; i >= 0; i--)
#define ROF(i, s, n) for(int i = s; i >= (int)n; i--)
#define FORIT(i, A) for (auto i : A)
#define PRINT(x) cout << (x) << "\n"
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define EACH(i, n) for (__typeof((n).begin()) i = (n).begin(); i != (n).end(); ++i)
#define SZ(a) int((a).size())
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define INF 1 << 25
#define CLR(a) memset((a), 0 ,sizeof(a))
#define dump(x) cerr << #x << " = " << (x) << "\n";
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << "\n";
#define sq(n) (n) * (n)

//typedef----------------------------------------------------------------------------------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef priority_queue<int> maxpq;
typedef priority_queue< int, vector<int>, greater<int> > minpq;
//const------------------------------------------------------------------------------------------------------------------------
const double EPS = 1e-10;
const double PI = acos( -1.0 );

//global-----------------------------------------------------------------------------------------------------------------------
int n, m, k;
VI a, b, c;
#define mod 1000000007
//function-------------------------------------------------------------------------------------------------------------------- 
void solve() {
	rep( i, n ) {
		if ( i < n ) {
			b.push_back( a[ i ] );
			b.push_back( a[ i + n ] );
		}
	}
	a = b;
	b = VI();
}

void solve2() {
	rep( i, 2 * n ) {
		if ( i < k ) {
			b.push_back( a[ i ] );
		}
		else {
			c.push_back( a[ i ] );
		}
	}
	rep( i, k ) {
		c.push_back( b[ i ] );
	}
	swap(a, c);
	b = c = VI();
}

int main() {
	scanf( "%d", &n );
	rep( i, 2 * n ) {
		a.push_back( i + 1 );
	}
	scanf( "%d", &m );
	rep( i, m ) {
		scanf( "%d", &k );
		if ( !k ) {
			solve();
		}
		else {
			solve2();
		}
	}
	rep( i, 2 * n ) {
		printf( "%d\n", a[ i ] );
	}
	return 0;
}

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

#define REP(i, x) for (int i = 0; i < (int)(x); i++)
#define ALL(x) (x).begin(), (x).end()

typedef long long ll;
using namespace std;

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

  int A, B, C;
  cin >> A >> B >> C;
  cout << min(C, B / A) << endl;

  return 0;
}


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

using namespace std;

int main(){
  int in;
  cin >> in;
  int a, b, c, d;
  a = (in / 1000) % 10;
  b = (in / 100) % 10;
  c = (in / 10) % 10;
  d = (in / 1) % 10;

  if((a == b && b == c) || (b == c && c == d)) cout << "Yes";
  else cout << "No";
  cout << endl;

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,a,n) for(int i=a;i<=n;i++)
#define per(i,a,n) for(int i=n;i>=a;i--)
#define pb push_back
#define mp make_pair
#define FI first
#define SE second
#define maxn 100000
#define mod 1000000007
#define inf 0x3f3f3f3f
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef double db;

int main()
{
    int N; scanf("%d",&N);
    ll s=1000,n=0,v=200;
    rep(i,1,N)
    {
        int x; scanf("%d",&x);
        if(v<x)
        {
            n+=s/x;
            s%=x;
            v=x;
        }
        else if(v>x)
        {
            s+=n*v;
            n=s/x;
            v=x;
            s%=x;
        }
    }
    printf("%lld\n",s+n*v);
    return 0;
}

Measured memory_bytes: 3796
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int s = sc.nextInt();
		int[] x = new int[n];
		for (int i = 0; i < n; i++) {
			x[i] = sc.nextInt() - s;
		}
		sc.close();

		int ans = 0;
		for (int i = 0; i < n; i++) {
			ans = gcd(ans, x[i]);
		}
		System.out.println(Math.abs(ans));
	}

	static int gcd(int a, int b) {
		return b == 0 ? a : gcd(b, a % b);
	}
}


Measured memory_bytes: 48064
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for( int i = 0; i < n; i++ )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000


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

    int N;
    cin >> N;
    int A[N];
    int count[N] ={};
    rep(i ,N) {
        cin >> A[i];
        count[A[i]]++;
    }
    for (int i = N-1; i > 0; i -= 2) {
        //dump(count[i]);
        if (count[i] != 2) {
            cout << "0" << endl;
            return 0;
        }
    }
    if (N % 2 == 1 && count[0] != 1) {
        cout << "0" << endl;
        return 0;    
    }

    ll ans = 1;
    rep(i ,N/2) ans = ans * 2 % mod;

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#include <string>
#include <algorithm>
#include <string.h>
#include <ctype.h>
#include <math.h>
#include <float.h>
#include <iomanip>
#include <iostream>
using namespace std;


int main(){

    int X[32]={1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51},K;

    cin >> K;

    cout << X[K-1];


    
    return 0;
}

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

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

    int dp[s.size()+1][t.size()+1];
    for (int i=0;i<s.size()+1;i++){
        for (int j=0;j<t.size()+1;j++){
            dp[i][j]=0;
        }
    }

    for (int i=1;i<s.size()+1;i++){
        for (int j=1;j<t.size()+1;j++){
            if (s[i-1]==t[j-1]) {
                dp[i][j]=dp[i-1][j-1]+1;
            }
            else {
                dp[i][j]=max(dp[i-1][j], dp[i][j-1]);
            }
        }
    }

    string r="";
    int i=s.size(),j=t.size();
    while (i>0 && j>0){
        if (dp[i][j]==dp[i-1][j]){
            i--;
        }
        else if (dp[i][j]==dp[i][j-1]){
            j--;
        }
        else if (dp[i][j]==dp[i-1][j-1]+1){
            r=s[i-1]+r;
            i--;
            j--;
        }
    }
    cout << r;
}


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


int main() {
  string s; cin>>s;
  if(s[0]==s[1] &&s[2]==s[3] && s[0]!=s[2]) cout<<"Yes"<<endl;
  else if(s[0]==s[2] && s[1]==s[3] &&s[0]!=s[1]) cout<<"Yes"<<endl;
  else if(s[0]==s[3] && s[1]==s[2] &&s[0]!=s[1]) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(void)
{
    int H, W, i, k;
	char a, b;
    while(scanf("%d%d", &H,&W), H!=0||W!=0){
        for(i=0;i<H;i++){
			switch(i%2){
				case 0: a='#'; b='.'; break;
				case 1: a='.'; b='#'; break;
			}
            for(k=0;k<W;k++){
				switch(k%2){
					case 0: printf("%c", a); break;
					case 1: printf("%c", b); break;
				}
			}
            puts("");
        }
        puts("");
    }
    return 0;
}

Measured memory_bytes: 588
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.io.StringReader;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.StringTokenizer;

public class Main  implements Runnable {
	public static void main(String[] args) {
		new Thread(null, new Main(), "", 32 * 1024 * 1024).start(); //
	}
	public void run() {
		FastScanner sc = new FastScanner(System.in);
		PrintWriter out = new PrintWriter(System.out);
		int n = Integer.parseInt(sc.next());

		double[] x = new double[n];
		double[] y = new double[n];
		double[] xs = new double[n];
		double[] ys = new double[n];
		double[][] ang = new double[n][2];
		//double[] ang = new double[n];
		for (int i = 0; i < n; i++) {
			x[i] = Double.parseDouble(sc.next());
			y[i] = Double.parseDouble(sc.next());
			double[] tmp = gets(x[i], y[i]);
			xs[i] = tmp[0];
			ys[i] = tmp[1];
			ang[i][0] = get_ang(x[i], y[i]);
			ang[i][1] = i;
		}
		Arrays.parallelSort(ang, (aa, ab) -> Double.compare(aa[0], ab[0]));
		double max_ans = 0;
		for (int i = 0; i < n; i++) {

			for (int j = 1; j <= n; j++) {
				ArrayList<Integer> ar = new ArrayList<Integer>();
				double tmp_ans = 1;
				for (int j2 = 0; j2 < j; j2++) {
					ar.add((int)ang[(i+j2)%n][1]);
				}
				tmp_ans = 0;
				double tmp_x=0;
				double tmp_y=0;
				for (int j1 = 0; j1 < ar.size(); j1++) {
					tmp_x += x[ar.get(j1)];
					tmp_y += y[ar.get(j1)];
				}
				tmp_ans = Math.sqrt(len2(tmp_x, tmp_y));
				max_ans = Math.max(tmp_ans, max_ans);
			}

		}
		out.println(BigDecimal.valueOf(max_ans).toPlainString());
		out.flush();
	}

	double len2 (double x, double y)
	{
		return (x*x+y*y);
	}
	double[] gets(double x, double y)
	{
		double[] ans = new double[2];
		double tmp = len2(x,y);
		tmp = Math.sqrt(tmp);
		ans[0] = x/tmp;
		ans[1] = y/tmp;
		return ans;
	}
	double get_ang(double x, double y)
	{
		double ans = Math.acos(x/Math.sqrt(x*x+y*y));
		if(y<0)
		{
			ans = 2*Math.PI - ans;
		}
		return ans;
	}
    static class FastScanner {
        private BufferedReader reader = null;
        private StringTokenizer tokenizer = null;
        public FastScanner(String in) {
        	StringReader sr = new StringReader(in);
            reader = new BufferedReader(new BufferedReader(sr));
            tokenizer = null;
        }
        public FastScanner(InputStream in) {
            reader = new BufferedReader(new InputStreamReader(in));
            tokenizer = null;
        }
        public String next() {
            if (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }
    }
}

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

using namespace std;

int main(){
	int n; cin >> n;
	double a[55];

	for (int i = 1; i <= n; i++){
    	cin >> a[i];
    }
	
 	if (n == 1) {
		cout << a[1];
		return 0;
    }
  
	sort(a + 1, a + n + 1);

  	double x = (a[1] + a[2]) / 2;
	for (int j = 3; j <= n; j++){
		x = (x + a[j]) / 2; 
    }
	cout << x;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <cstdio>
#include <climits>
#include <set>
#include <map>
using namespace std;

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

typedef long long ll;

int main()
{
    ll a, b, k;
    cin >> a >> b >> k;

    if(a + b <= k)
    {
        cout << 0 << " " << 0 << endl;
    }
    else if(a >= k)
    {
        cout << a - k << " " << b << endl;
    }
    else if(a + b >= k)
    {
        cout << 0 << " " << b - (k - a) << endl;
    }
    
    
    return 0;
}

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

int main() {
  ll n,m,k;
  cin >> n >> m >> k;
  vi a(n), b(m);
  rep(i,n) cin >> a[i];
  rep(i,m) cin >> b[i];
  ll total=0;
  rep(i,m) total += b[i]; 
  int j = m;
  int ans = 0;
  rep(i,n+1){

    while(total > k && j > 0){
      j--;
      total -= b[j];
    }
    if(total > k) break;
    ans = max(ans, i+j);
    total += a[i];
    //cout << ans << i << j << endl;
  }
  cout << ans << endl;
}


Measured memory_bytes: 4816
n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
a = a.copy()
b = b.copy()
sum_c = 0
for i in range(n):
    if (a[i] - b[i]) < 0:
        sum_c += int(((b[i] - a[i]) / 2 ) + 0.5)
sum_a = 0
sum_b = 0
for i in range(n):
    sum_a += a.pop(0)
    sum_b += b.pop(0)
if sum_c <= (sum_b - sum_a):
    print ('Yes')
else:
    print ('No')

Measured memory_bytes: 4596
#include <bits/stdc++.h>
using namespace std;
#define REP(i,N) for(i=0;i<N;i++)
#define INF 1e9
typedef long long ll;

int main(void){
  int N,K; cin >> N >> K;
  if(N%K==0) cout << 0 << endl;
  else cout << 1 << endl;
  return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <climits>
#include <cmath>
#include <iostream>
#include <numeric>
#include <unordered_map>
#include <vector>

const int mod = 1e9 + 7;

int main()
{
    long long s;
    std::cin >> s;

    if (s == 1e18) {
        std::cout << "0 0 0 1000000000 1000000000 0";
        return 0;
    }

    long long y = s / (long long)1e9 + (long long)1;
    long long x = (long long)1e9 - (s % (long long)1e9);

    std::cout << 0 << " " << 0 << " " << 1000000000 << " " << 1 << " " << x << " " << y;
}


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

using namespace std;

class Solution {
  public:
    int Solve(int N, int K) {
        if (N % K == 0)
            return 0;
        else
            return 1;
    }
};

int main() {
    int n, k;
    cin >> n >> k;
    Solution s;
    cout << s.Solve(n, k) << endl;

    return 0;
}


Measured memory_bytes: 256
#!/usr/bin/env python
from __future__ import division, print_function
from sys import stdin, exit


code_table = {chr(65+i): '{:05b}'.format(i) for i in range(26)}
code_table.update({' ': '11010', '.': '11011', ',': '11100', '-': '11101',
                   "'": '11110', '?': '11111'})

decrypt = {
    '101': ' ', '000000': "'", '000011': ',', '10010001': '-',
    '010001': '.', '000001': '?', '100101': 'A', '10011010': 'B',
    '0101': 'C', '0001': 'D', '110': 'E', '01001': 'F',
    '10011011': 'G', '010000': 'H', '0111': 'I', '10011000': 'J',
    '0110': 'K', '00100': 'L', '10011001': 'M', '10011110': 'N',
    '00101': 'O', '111': 'P', '10011111': 'Q', '1000': 'R',
    '00110': 'S', '00111': 'T', '10011100': 'U', '10011101': 'V',
    '000010': 'W', '10010010': 'X', '10010011': 'Y', '10010000': 'Z'}


def main():
    for line in stdin:
        buf = ''
        for c in ''.join(code_table[c] for c in line.rstrip('\r\n')):
            buf += c
            plain = decrypt.get(buf)
            if plain:
                print(plain, end='')
                buf = ''
        print()
    exit()


if __name__ == '__main__':
    main()

Measured memory_bytes: 4304
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
int main(){
    ios::sync_with_stdio(false);
    int h,w;
    cin >> h >> w;
    vector<vector<char>> s(h,vector<char>(w,0));
    rep(i, h) {
        string str;
        cin >> str;
        rep(j,w) {
            if(str[j] == '.') s[i][j] += '0';
            else {
                s[i][j] = '#';
                for(int x = -1; x <= 1; x++) for(int y = -1; y <= 1; y++) {
                    if (x == 0 && y == 0) continue;
                    if(i+y < 0 || i+y >= h || j+x < 0 || j+x >= w) continue;
                    if(s[i+y][j+x] == '#') continue;
                    s[i+y][j+x]++;
                }
            }
        }
    }
    rep(i,h) {
        rep(j,w) cout << s[i][j];
        cout << endl;
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define f first
#define s second
#define pb push_back
#define M (L+R)/2
#define N 500009
#define inf 99999999999
#define ll long long
#define mod 1000000007
#define sz size();
using namespace std;

struct node{
	ll ans;
	node *left,*right;
	node(): ans(0),left(NULL),right(NULL){}
};

node *root(NULL);

void upd(node *&parent,ll L,ll R,ll ind,ll x){
	if(!parent){
		parent=new node();
	}
	if(L+1==R){
		parent->ans=x;
		return;
	}
	if(ind<M){
		upd(parent->left,L,M,ind,x);
	} else {
		upd(parent->right,M,R,ind,x);
	}
	parent->ans=max((parent->left?parent->left->ans:0),(parent->right?parent->right->ans:0));
}

ll get(node *&parent,ll L,ll R,ll l,ll r){
//	cout<<L<<" "<<R<<" "<<l<<" "<<r<<endl;
	if(parent){
		if(l>=R || r<=L)return 0;
		if(l<=L && R<=r)return parent->ans;
		return max(get(parent->left,L,M,l,r),get(parent->right,M,R,l,r));
	}
	return 0;
}

ll n,k,a[N],dp[N],ans=1;

int main(){

	ios::sync_with_stdio(0);
	
	cin>>n>>k;
	for(int i=1;i<=n;i++){
		cin>>a[i];
	}
	
	for(int i=1;i<=n;i++){
		dp[i]=get(root,-inf,inf,a[i]-k,a[i]+k+1)+1;
	//	cout<<dp[i]<<" --- "<<endl;
		upd(root,-inf,inf,a[i],dp[i]);
		if(ans<dp[i])ans=dp[i];
	}
	
	cout<<ans<<endl;	

	return 0;
}


Measured memory_bytes: 23108
/*  -*- coding: utf-8 -*-
 *
 * a.cc: A - Sheep and Wolves
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

/* typedef */

/* global variables */

/* subroutines */

/* main */

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

  if (s > w) puts("safe");
  else puts("unsafe");
  return 0;
}


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

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

  int num_group = 1;
  while(N > K + (K - 1)*(num_group - 1)) {
    num_group++;
  }

  printf("%d", num_group);
  return 0;
}

Measured memory_bytes: 256
N, S = int(input()), input()


def rot_encode(n):
    from string import ascii_lowercase as lc, ascii_uppercase as uc
    lookup = str.maketrans(lc + uc, lc[n:] + lc[:n] + uc[n:] + uc[:n])
    return lambda s: s.translate(lookup)


print(rot_encode(N)(S))


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

using namespace std;
#define ll long long
#define ull unsigned long long
#define i128 __int128
#define mp make_pair
#define ld long double
typedef pair<int, int> pii;
typedef priority_queue<int, vector<int>, greater<int> > small_heap;
typedef priority_queue<int> big_heap;
const int N = 1e6 + 100;
int T;

int main() {
    int n, x, t;
    cin >> n >> x >> t;
    cout << (n + x - 1) / x * t << endl;
    return 0;
}

Measured memory_bytes: 3620
s = input()
s_lis = list(s)
l = len(s)
a = ['0' if i%2 == 0 else '1' for i in range(l)]
b = ['1' if i%2 == 0 else '0' for i in range(l)]
a_count = 0
b_count = 0
for si,ai,bi in zip(s_lis,a,b):
    if si != ai:
        a_count += 1
    if si != bi:
        b_count += 1
print(min(a_count,b_count))

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

int main(){
	int a, b;	
	cin >> a >> b;
	if(a < b){
      for(int i; i < b; i++){
        cout << a;
      }
    }else if(a > b){
      for(int i; i < a; i++){
        cout << b;
      }
    }else if(a = b){
      for(int i; i < b; i++){
        cout << a;
      }
    }
}

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

int i_gcd(int a, int b) {
    if (b == 0) {
        return a;
    }
    return i_gcd(b, a % b);
}

int main(void) {
    using namespace std;

    int K;
    cin >> K;

    long int res = 0;

    for (int a = 0; a < K; a++) {
        for (int b = 0; b < K; b++) {
            for (int c = 0; c < K; c++) {
                int a_b = i_gcd((a+1), (b+1));
                int a_b_c = i_gcd(a_b, (c+1));
                res += a_b_c;
            }
        }
    }

    printf("%ld\n", res);
    return 0;
}

Measured memory_bytes: 3780
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(void) {	
	int n, a, b;
	cin >> n;
	vector<pair<int, int> > p(n);
	for (int i = 0; i < n; ++i) {
		cin >> a >> b;
		p[i] = { b,a };
	}
	sort(p.begin(), p.end());
	int t = 0;
	bool ok = true;
	for (int i = 0; i < n; ++i) {
		t += p[i].second;
		if (t > p[i].first) ok = false;
	}
	cout << (ok ? "Yes" : "No") << endl;
	return 0;
}

Measured memory_bytes: 1792
n,*a=map(int,open(0).read().split())
a.sort()
b=[0]*(10**6+1)
for i in a:
    b[i]+=1
    if b[i]==1:
        for j in range(2*i,10**6+1,i):
            b[j]+=100
print(b.count(1))

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

typedef long long ll;


ll MAX = (ll)(1LL<<31) - 1LL;
struct Segment
{
	vector<ll> node;
	int n;

	Segment(const vector<ll>& v)
	{
		int sz = v.size();
		n = 1;
		while(n < sz) n *= 2;

		node.resize(n * 2 - 1,MAX);
		for(int i = 0;i < sz;i++)
		{
			node[i + n - 1] = v[i];
		}

		for(int i = n - 2;i >= 0;i--)
		{
			node[i] = min(node[2 * i + 1],node[2 * i + 2]);
		}
	}

	void update(int in,ll x)
	{
		in += n - 1;
		node[in] = x;

		while(in > 0)
		{
			in = (in - 1) / 2;
			node[in] = min(node[in * 2 + 1] , node[in * 2 + 2]);
		}
	}

	ll getmin(int a,int b,int k = 0,int l = 0,int r = -1)
	{
		if(r == -1) r = n;


		if(r <= a || b <= l) return MAX;


		if(a <= l && r <= b) return node[k];
		ll nl,nr;

		nl = getmin(a,b,2 * k + 1,l,(l + r)/2);
		nr = getmin(a,b,2 * k + 2,(l + r)/2,r);

		return min(nl,nr);
	}
};

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

	vector<ll> v(n,MAX);
	Segment seg(v);

	for(int i = 0;i < q;i++)
	{
		int c,a,b;

		cin >> c >> a >> b;
		
		if(c == 0)
		{
			seg.update(a,b);
		}
		else
		{
			cout << seg.getmin(a,b + 1) << endl;
		}
	}
	return 0;
}



Measured memory_bytes: 5744
N, x = map(int, input().split())
L = list(map(int,input().split()))
L_sorted = sorted(L, reverse=False)

remain = x
ans = 0
for j in range(N):
    if remain>= L_sorted[j] and j != N-1:
        remain = remain - L_sorted[j]
        ans += 1
    
    if j == N-1 and L_sorted[j] == remain:
        ans += 1
print(ans)

Measured memory_bytes: 3064
n = int(input())
import math
ans = 0
if n == 1:
    ans =0
if n == 2:
    ans = 2
if n >= 3:
    ans = (10**n%(10**9+7)-9**n%(10**9+7)-9**n%(10**9+7)+8**n%(10**9+7))%(10**9+7)
print(ans)

Measured memory_bytes: 87940
#include<bits/stdc++.h>
#define lld         long long int
#define llf         long double
#define pb          push_back
#define mp          make_pair
#define IN          insert
#define loopN(n)    for(lld i=0;i<n;i++)
#define loop(p,n)   for(lld i=p;i<=n;i++)
#define rloop(p,n)  for(lld i=n;i>=p;i--)
#define loop2(p,n)  for(lld j=p;j<=n;j++)
#define all(v)      v.begin(),v.end()
#define F1          first
#define F2          second
#define INF         2e18
#define FILE        freopen("input.txt","r",stdin);freopen("output.txt","w",stdout)
#define PI          2*acos(0.0);
#define ISO         ios::sync_with_stdio(false);cin.tie(0)
#define mod         100000007
#define mem(a,b)    memset(a,b,sizeof(a))
using namespace std;

lld n;
lld dp[3*2500+5][4];


lld fun(lld k,lld z)
{
    if(k==0)
    {
        return 1;
    }
    if(k<0)
    {
        return 0;
    }
    if(z==0)
    {
        return 0;
    }
    if(dp[k][z]!=-1)
    {
        return dp[k][z];
    }

    lld ans=0;
    loop(0,n)
    {
        ans+=fun(k-i,z-1);
    }
    return dp[k][z]=ans;
}

int main()
{
    ISO;
    lld k;
    cin>>n>>k;
    mem(dp,-1);
    cout<<fun(k,3)<<endl;
    return 0;
}


Measured memory_bytes: 3840
#include <bits/stdc++.h>
#define INF 1000000100
using namespace std;

int ans = INF;
int n,k,x;
int menor,dif;
vector<int> v;

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

	cin>>n>>k;
	for(int i=0;i<n;++i)
	{
		cin>>x;
		v.push_back(x);
	}

	sort(v.begin(),v.end());

	for(int i=0;i<v.size()-k+1;++i)
	{
		dif = v[i+k-1] - v[i];
		ans = min(ans,dif);
	}
	cout<<ans<<"\n";
}

Measured memory_bytes: 892
import math

value = input().split()
X = int(value[0])
K = int(value[1])
D = int(value[2])

if X != 0:
  if X < 0:
    X = -X
  if K * D <= X:
    print(X - K * D)
  else:
    R = math.ceil(X / D)
    K -= R
    X -= D * R
    if K % 2 == 0:
      print(-X)
    else:
      print(X + D)  
else:
  if K % 2 == 0:
    print("0")
  else:
    print(D)

Measured memory_bytes: 9096
//https://atcoder.jp/contests/abc134/tasks/abc134_d
#include<bits/stdc++.h>
using namespace std;
const int N=1e5+100;
vector<int>v[N];
#define ll long long 
int main()
{
	int n,m;
	cin>>n>>m;
	for(int i=1,x,y;i<=n;i++)
	{
		cin>>x>>y;
		v[x].push_back(y);
	}
	ll sum=0;
	priority_queue<int>q;
	for(int j=1;j<=m;j++)  
	{
		for(int i=0;i<v[j].size();i++) 
		 q.push(v[j][i]);
		if(q.empty())continue;
		sum+=q.top();
		q.pop();
	}
	cout<<sum<<endl;
	return 0;
} 

Measured memory_bytes: 5632
#include <stdio.h>

int main(){
  int total=700;
  char a,b,c;
  
  scanf("%c %c %c",&a,&b,&c);
  
  if(a=='o'){total=total+100;}
  if(b=='o'){total=total+100;}
  if(c=='o'){total=total+100;}
  
  printf("%d",total);
  
  return(0);
}


Measured memory_bytes: 128
using System;
using System.Collections.Generic;

class Class3
{
    static void Main(string[] args)
    {
        long N = long.Parse(Console.ReadLine());

        string[] input = Console.ReadLine().Split(' ');

        Dictionary<int, int> dict = new Dictionary<int, int>();


        long sum = 0;

        for (int i = 0; i < input.Length; i++)
        {
            int ai = int.Parse(input[i]);
            sum += ai;

            if (dict.ContainsKey(ai))
            {
                dict[ai] += 1;
            } else
            {
                dict.Add(ai, 1);
            }
        }


        long Q = long.Parse(Console.ReadLine());


        for (int i = 0; i < Q; i++)
        {
            string[] input2 = Console.ReadLine().Split(' ');

            int B = int.Parse(input2[0]);
            int C = int.Parse(input2[1]);

            if (dict.ContainsKey(B))
            {
                sum += (C - B) * dict[B];
                int tmp = dict[B];
                dict.Remove(B);
                if (dict.ContainsKey(C))
                {
                    dict[C] += tmp;
                } else
                {
                    dict.Add(C, tmp);
                }
            } else
            {
                //何もしない
            }

            Console.WriteLine(sum);

        }


    }
}

Measured memory_bytes: 54284
#include <bits/stdc++.h>
#define INF 1e18
#define int long long
#define Rep(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) Rep(i, 0, n)
#define all(a) (a).begin(), (a).end()
using namespace std;
typedef pair<int, int> P;
typedef pair<int, P> PP;
const int mod = 1000000007;

bool isbig(char s) { return 'A' <= s && s <= 'Z'; }

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

    string s;
    cin >> s;
    bool f = s[0] == 'A' && !isbig(s[1]) && !isbig(s[s.size() - 1]);
    s = s.substr(2, s.size() - 3);
    sort(all(s));
    f &= s[0] == 'C';
    Rep(i, 1, s.size() - 1) f &= !isbig(s[i]);
    cout << (f ? "AC" : "WA") << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define mp(a, b) make_pair(a, b)
typedef pair<int, int> pii;
const int INF = 1e9;
const int maxn = 800 + 10;
int h, w, k;
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
int dis[maxn][maxn];
char s[maxn][maxn];
int calc(int x, int y)
{
	if(x == 1 || x == h || y == 1 || y == w) return 0; 
	return min(min((x - 1 + k - 1) / k, (h - x + k - 1) / k), min((y + k - 1) / k, (w - y + k - 1) / k));
}	
int main()
{
	queue<pii> Q;
	scanf("%d%d%d", &h, &w, &k);
	for(int i = 1; i <= h; ++i)
		scanf("%s", s[i] + 1);
	for(int i = 1; i <= h; ++i)
		for(int j = 1; j <= w; ++j)
		{
			if(s[i][j] == 'S')
			{
				Q.push(mp(i, j));
				dis[i][j] = 0;
			}
			else
				dis[i][j] = INF;
		}
	while(!Q.empty())
	{
		auto x = Q.front(); Q.pop();
		for(int i = 0; i < 4; ++i)
		{
			int nx = x.first + dx[i], ny = x.second + dy[i];
			if(1 <= nx && nx <= h && 1 <= ny && ny <= w && s[nx][ny] == '.' && dis[nx][ny] == INF)
			{
				dis[nx][ny] = dis[x.first][x.second] + 1;
				Q.push(mp(nx, ny));
			}
		}
	}
	int ans = INF;
	for(int i = 1; i <= h; ++i)
		for(int j = 1; j <= w; ++j)
			if(dis[i][j] <= k)
				ans = min(ans, calc(i, j) + 1);
	printf("%d\n", ans);
	return 0;
}
				
				
				

Measured memory_bytes: 6944
import java.io.IOException;
import java.util.Scanner;

public class Main {

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

	char[] c = { 'A', 'B', 'C', 'D', 'E' };

	private void run() throws IOException {
		Scanner scanner = new Scanner(System.in);
		while (true) {
			int n = scanner.nextInt();
			if (n == 0)
				break;
			int m = scanner.nextInt();
			int index = 0;
			int max = n + m;
			for (int i = 1; i < 5; i++) {
				int a = scanner.nextInt();
				int b = scanner.nextInt();
				int c = a + b;
				if (max < c) {
					max = c;
					index = i;
				}
			}
			System.out.println(c[index] + " " + max);

		}
	}
}

Measured memory_bytes: 19456
#include<bits/stdc++.h>
#define speedio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
using namespace std;
// #include <ext/pb_ds/assoc_container.hpp>
// using namespace __gnu_pbds;

typedef long long       ll;
typedef long double     ld;

typedef vector<int>     vi;
typedef vector<bool>    vb;
typedef vector<ll>      vll;
typedef vector<vi>      vvi;
typedef vector<vll>     vvll;
typedef vector<string>  vs;

typedef pair<int, int>  pii;
typedef pair<ll, int>   pli;
typedef pair<ll, ll>    pll;
typedef vector< pii >   vpi;

// typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> oset;

#define pb           push_back
#define mod          1000000007
#define INF          1e17
#define mini         INT_MIN
#define maxo         INT_MAX
#define eb           emplace_back
#define ff           first
#define ss           second
#define re           return 
#define endl         "\n" 

#define all(c)       c.begin(),c.end()
#define be           begin()
#define en           end()
#define sz(x)        (ll)x.size()
#define mem(a,val)   memset(a,val,sizeof(a))
#define mk(x,y)      make_pair(x,y)
#define mid(s,e)     ((s)+((e)-(s))/2) 

#define fo(i,a,b)     for(int i = (int)(a); i <= (int)(b); i++)
#define rf(i,a,b)    for(int i = (int)(a); i >= (int)(b); i--)
#define read(a,n)    for(int i=0;i<n;i++)cin>>a[i];
#define show(a,n)    for(int i=0;i<n;i++)cout<<a[i]<<' ';cout<<endl;
#define p2(n)        (1LL << (n))
#define deb(x) cout <<#x << " = " << x << " | " << "LINE: "<<__LINE__<< endl;
template<typename... T> void rd(T&... args) { ((cin >> args), ...); }
template<typename... T> void pp(T... args) { ((cout << args << " "), ...); cout<<"\n"; }

void add(ll &x, ll y){ x += y; if(x>=mod) x %= mod; if(x<0) x = x%mod + mod; }

//============== *** START OF CODE ***



void solve()
{
    int r,c,k;rd(r,c,k);
    char g[r][c];
    fo(i,0,r-1){
        fo(j,0,c-1)cin>>g[i][j];
    }
    vvi rows,cols;

    for(ll i=0;i<p2(r);i++){
        vi row;
        fo(j,0,r-1){
            if(i & 1LL<<j)row.pb(j);
        }
        rows.pb(row);
    }
    for(ll i=0;i<p2(c);i++){
        vi col;
        fo(j,0,c-1){
            if(i & 1LL<<j)col.pb(j);
        }
        cols.pb(col);
    }

    ll ans = 0;
    for(auto x:rows){
        for(auto y:cols){
            char _g[r][c];
            fo(i,0,r-1){
                fo(j,0,c-1)_g[i][j]=g[i][j];
            }
            for(int xx:x){
                fo(i,0,c-1)_g[xx][i]='R';
            }
            for(int xx:y){
                fo(j,0,r-1)_g[j][xx]='R';
            }
            int cnt = 0;
            fo(i,0,r-1){
                fo(j,0,c-1){
                    if(_g[i][j]=='#')cnt++;
                }
            }
            if(cnt==k)ans++;
        }
    }


    pp(ans);
    
}


void prep(){}

//=============== *** END OF CODE ***

int main(){
    speedio; cout<<fixed<<setprecision(12);

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

    prep();
    int t = 1;
    // cin >> t;
    while(t--)
        solve();

    cout<<"\n";
    return 0;
}

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

using namespace std;
typedef long long ll;
const int maxn = 2e4;
ll a[maxn], b[maxn];
int n;
vector<int> ans;

bool isprime(int x) {
    for (int i = 2; i * i <= x; i++) {
        if (x % i == 0) return false;
    }
    return true;
}

bool check(int p) {
    if (a[0] % p) return false;
    for (int i = 0; i <= n; i++) {
        b[i] = a[i];
    }
    for (int i = n; i >= p - 1; i--) {
        b[i - (p - 1)] = (b[i - (p - 1)] + b[i]) % p;
        b[i] = 0;
    }
    for (int i = 0; i <= n; i++) {
        if (b[i] % p) return false;
    }
    return true;
}

int main() {
    scanf("%d", &n);
//    scanf("%lld", &a[0]);
    ll g = 0;
    for (int i = 0; i <= n; i++) {
        scanf("%lld", &a[i]);
        g = __gcd(g, abs(a[i]));
    }
    for (ll i = 2; i * i <= g; i++) {
        if (g % i == 0) ans.push_back(i);
        while (g % i == 0) {
            g /= i;
        }
    }
    if (g > 1) ans.push_back(g);
    reverse(a, a + 1 + n);
    for (int i = 2; i <= n; i++) {
        if (isprime(i) && check(i)) {
            ans.push_back(i);
        }
    }
    sort(ans.begin(), ans.end());
    ans.erase(unique(ans.begin(), ans.end()), ans.end());
    for (int v:ans) {
        printf("%d\n", v);
    }
    return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int n, ans =0;
    cin >> n;
    vector<int> a1(n), a2(n);
    for(int i=0;i<n;i++) cin >> a1.at(i);
    for(int i=0;i<n;i++) cin >> a2.at(i);
    
    for(int i=0;i<n;i++){
        int count=0;
        for(int j=0;j<=i;j++) count += a1.at(j);
        for(int k=i;k<n;k++) count += a2.at(k);
        ans = max(count, ans);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
n = int(input())
h = [int(x) for x in input().split()]

ans = 0
cur = 1
cnt = 0
while cur < n:
    if h[cur-1] >= h[cur]:
        cnt += 1
        cur += 1
    else:
        ans = max(ans, cnt)
        cnt = 0
        cur += 1
ans = max(ans, cnt)
print(ans)


Measured memory_bytes: 14252
from collections import defaultdict
n, k = map(int, input().split())
a = [[] for _ in range(k)]
cnt = defaultdict(int)

for i in range(k):
    d = int(input())
    a[i] = list(map(int, input().split()))

for i in range(k):
    for x in a[i]:
        cnt[x] += 1

print(n - len(cnt))

Measured memory_bytes: 9472
import sys
stdin = sys.stdin

sys.setrecursionlimit(10 ** 7)

def li(): return map(int, stdin.readline().split())
def li_(): return map(lambda x: int(x) - 1, stdin.readline().split())
def lf(): return map(float, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())


from collections import Counter


def factorize(n: int):
    d = Counter()
    m = 2

    while m * m <= n:
        while n % m == 0:
            n //= m
            d[m] += 1

        m += 1

    if n > 1:
        d[n] += 1

    return d


n = ni()
prime_counter = Counter()

for i in range(2, n+1):
    primes = factorize(i)
    prime_counter += primes

# カウント
gteq74 = 0
gteq24 = 0
gteq14 = 0
gteq4 = 0
gteq2 = 0
gteq2_and_lt4 = 0
for _, cnt in prime_counter.items():
    gteq74 += 1 if cnt >= 74 else 0
    gteq24 += 1 if cnt >= 24 else 0
    gteq14 += 1 if cnt >= 14 else 0
    gteq4 += 1 if cnt >= 4 else 0
    gteq2 += 1 if cnt >= 2 else 0
    gteq2_and_lt4 += 1 if 2 <= cnt < 4 else 0

ans = gteq74 + (gteq24*gteq2 - gteq24) + (gteq14*gteq4 - gteq14)
ans += gteq4 * (gteq4-1) * (gteq4-2) // 2 + gteq4 * (gteq4-1) * gteq2_and_lt4 // 2

print(ans)


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

#define rep(i,n) for(int i=0; i<n ; ++i)
#define REP(i,a,b) for(int i=a; i<b; ++i)
#define all(v) (v).begin() , (v).end()
using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;
using vvc = vector<vector<char>>;
using pii = pair<int , int>;
using pll = pair<long long , long long>;

//プロトタイプ宣言
void faster(void);
template <class T>
T gcd(T , T);
template <class T>
T get_digent(T);
template <class T>
T POW(T , T);


int main(){
  faster();
  ll n;
  cin >> n;
  vl p(n);
  rep(i,n) cin >> p[i];
  int cnt = 0;
  set<int> set;
  rep(i,n){
    set.insert(p[i]);
    auto itr = set.begin();
    int temp = *itr;
    if(p[i]==temp) cnt++;
  }
  cout << cnt;
}



























//同期解除
void faster(void){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
}

//ユークリッドの互除法
template <class T>
T gcd(T a, T b) {
  return (b ? gcd(b, a%b) : a);
} 

//桁数取得
template <class T>
T get_digent(auto x){
  string s;
  s = to_string(x);
  ll digent = s.size();
  return digent;
} 

//べき乗計算
template <class T>
T POW(T x, T y){
  if(y==0) return 1;
  if(y%2 == 1){
    ll temp = POW(x,y-1);
    return (temp*x);
  }
  else{
    ll temp = POW(x,y/2);
    return temp*temp;
  }
} 



Measured memory_bytes: 11264
import java.util.Scanner;

public class Main {
	static final int nmax = 8;
	static boolean graph[][] = new boolean[nmax][nmax];//辺があるか
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n,m;
		n = sc.nextInt();//頂点
		m = sc.nextInt();//辺

		for(int i = 0; i < m; i++) {
			int A,B;
			A = sc.nextInt();
			B = sc.nextInt();
			graph[A-1][B-1]=graph[B-1][A-1]=true;//a to b & b to aの辺がある
		}

		boolean visited[] = new boolean[nmax];//頂点を訪れたか
		for(int i = 0; i < n; i++) {//頂点の数回す
			visited[i]=false;//一度も訪れていないで初期化
		}

		visited[0] = true;//最初の頂点を訪問

		System.out.println(dfs(0,n,visited));
	}
	public static int dfs(int v, int n, boolean[] visited) {

		boolean all_visited=true;

		for(int i = 0; i < n; i++) {//全ての頂点を訪れていない場合false代入
			if(visited[i] == false) {
				all_visited=false;
			}
		}

		if(all_visited) {//自分が最後の頂点なら1増やす
			return 1;
		}

		int ret = 0;

		for(int i = 0; i < n; i++) {
			if(graph[v][i]==false) continue;//辺がないなら飛ばす
			if(visited[i]) continue;//既に訪れていたらとばす

			visited[i] = true;//訪れる
			ret+=dfs(i,n,visited);
			visited[i]=false;
		}

		return ret;
	}
}


Measured memory_bytes: 21716
#include <iostream>
#include <string>
using namespace std;
using ll = long long;

const ll mod = 1e9+7;

int N;
string S;

ll ans = 1;

int main() {
	cin >> N >> S;
	
	for(int c='a';c<='z';++c) {
		ll cnt = 1;
		for(int i=0;i<N;++i) {
			if(S[i] == c)++cnt;
		}
		ans *= cnt;
		ans %= mod;
	}
	
	cout << ans-1 << endl;
	
	return 0;
}

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

int main(){
    int flag=0;
    int n,a;
    int minus=0,MIN=1e9+1;
    cin >>n;
    int64_t ans=0;

    for (int i = 0; i < n; i++){
        cin >>a;
        if(a<0)minus++;
        ans +=abs(a);
        MIN = min(MIN,abs(a));
    }
    if(minus % 2==1){
        ans -= 2*MIN ;
    }
    //cout <<fixed<<setprecision(16)<< << endl;
    cout << ans << endl;

    //if(flag==1)cout << "Yes" <<endl;
    //else cout << "No" <<endl;
    
    return 0;
}


Measured memory_bytes: 256
import java.io.FileNotFoundException;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) throws FileNotFoundException {

//    	File file = new File("src/in.txt");

        //コード
//    	Scanner sc = new Scanner(file);
    	Scanner sc = new Scanner(System.in);
    	int N = sc.nextInt();
    	int ans = 0;
    	for(int i=1;i<=N;i++) {
    		int x = sc.nextInt();
    		if(i%2==1) {
    			if(x%2==1) {
    				ans++;
    			}
    		}
    	}
    	System.out.println(ans);

    }
}


Measured memory_bytes: 35992
#include <cstdio>
#include <iostream>
#define debug(...) fprintf(stderr, __VA_ARGS__)
using namespace std;
inline char nc()
{
	return getchar();
	static char buf[100000], *l = buf, *r = buf;
	return l==r&&(r=(l=buf)+fread(buf,1,100000,stdin),l==r)?EOF:*l++;
}
template<class T> void read(T &x)
{
	x = 0; int f = 1, ch = nc();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=nc();}
	while(ch>='0'&&ch<='9'){x=x*10-'0'+ch;ch=nc();}
	x *= f; 
}
const int maxn = 200000 + 5;
int n, a, b, c, d;
char s[maxn];
bool f[maxn];
bool sol0(int a, int b)
{
	for(int i = a; i < b; ++i)
	{
		if(s[i] == '#' && s[i + 1] == '#') return 0; 
	}
	return 1; 
}
bool sol1(int a, int b)
{
	for(int i = a; i <= b; ++i)
	{
		if(s[i] == '.' && s[i - 1] == '.' && s[i + 1] == '.') return 1;
	}
	return 0;
}
int main()
{
	read(n), read(a), read(b), read(c), read(d);
	scanf("%s", s + 1);
	if(!sol0(b, d)) puts("No");
	else
	{
		if(!sol0(a, c)) puts("No");
		else 
		{
			if(c > d) puts(sol1(b, d) ? "Yes" : "No");
			else puts("Yes");
		}
	}
	return 0;
} 

Measured memory_bytes: 384