akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define fi first
#define se second
#define forn(i, n) for (int i = 0; i < (int)n; ++i)
#define for1(i, n) for (int i = 1; i <= (int)n; ++i)
#define fore(i, l, r) for (int i = (int)l; i <= (int)r; ++i)
#define ford(i, n) for (int i = (int)(n)-1; i >= 0; --i)
#define fored(i, l, r) for (int i = (int)r; i >= (int)l; --i)
#define pb push_back
#define el '\n'
#define d(x) cout << #x << " " << x << el
#define ri(n) scanf("%d", &n)
#define vec vector
using namespace std;



typedef long long ll;
typedef pair<int, int> ii;
typedef pair<char, int> pci;
typedef tuple<int, int, int> tiii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;


const int MAXN = 1e5 + 200;
const double PI = acos(-1);
const double EPS = 1e-10;
int dr[] = {1, -1, 0, 0, 1, -1, -1, 1}; // trick to explore an implicit 2D grid
int dc[] = {0, 0, 1, -1, 1, 1, -1, -1};



int N, M;
int mem[MAXN];  
vector<int> graph[MAXN];

int dp_dfs(int node) {
  
  for(int v: graph[node]) {
    int path;
    // int path= (mem[v]!=-1) ? 1+mem[v] : 1+dp_dfs(v);
    if(mem[v]!=-1)
      path=1+mem[v];
    else
      path=1+dp_dfs(v);
    mem[node] = max(mem[node], path);
  }
  return mem[node] = max(mem[node],0);
}


int main() {
  cin >> N >> M;
  forn(i, M) {
    int a,b;
    cin >> a >> b;
    graph[a-1].push_back(b-1);
  }
  

  fill(mem, mem+N, -1);
  forn(i,N)
    if(mem[i]==-1) 
      dp_dfs(i);
    
  int maxi = -1;
  forn(i, N)
    maxi = max(maxi, mem[i]);
  cout << maxi << endl;
}


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

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

    int l, r;
    cin >> l >> r;
    if (r - l >= 2020) {
        cout << 0 << endl;
        return 0;
    }
    int ans = 1e9;
    for (int i = l; i <= r; i++) {
        for (int j = i + 1; j <= r; j++) {
            ans = min(ans, (int) (1ll * i * j % 2019));
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i,a) for(int i = 0; i < (a); i++)
#define ALL(a) (a).begin(),(a).end()
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1e9;
const long long LINF = 1e18;
const long long MOD = 1e9 + 7;

#define MAX 30

signed main(){
    int n;
    ll k;
    cin >> n >> k;
    ll a[n],b[n];
    REP(i,n){
        cin >> a[i] >> b[i];
    }
    vector<ll> cand;
    for(int bit = MAX - 1; bit >= 0; bit--){
        if(k & 1 << bit){
            ll t = 0;
            for(int i = MAX - 1; i > bit; i--){
                if(k & 1LL << i) t |= 1LL << i;
            }
            for(int i = bit - 1; i >= 0; i--){
                t |= 1LL << i;
            }
            cand.emplace_back(t);
        }
    }
    cand.emplace_back(k);
    ll ans = 0;
    for(auto c : cand){
        ll sum = 0;
        for(int i = 0; i < n; i++){
            for(int bit = 0; bit < MAX; bit++){
                if(a[i] & 1LL << bit && !(c & 1LL << bit)) goto no;
            }
            sum += b[i];
            no:;
        }
        ans = max(ans, sum);
    }
    cout << ans << endl;
    return 0;
}

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

namespace ziyuutyou
{
    class Program
    {
        static void Main(string[] args)
        {
            var hatake = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);

            Console.WriteLine((hatake[0] * hatake[1]) - (hatake[0] + hatake[1] - 1));
            
        }
    }
}


Measured memory_bytes: 11092
#include<bits/stdc++.h>
 
using namespace std;
 
int main(){
	int d; cin >> d;
	if(d == 25) cout << "Christmas" << endl;
	else if(d == 24) cout << "Christmas Eve" << endl;
	else if(d == 23) cout << "Christmas Eve Eve" << endl;
	else if(d == 22) cout << "Christmas Eve Eve Eve" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <iostream>
#include <algorithm>
#include <functional>
#include <string>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int gcd(int x, int y) { return (x % y)? gcd(y, x % y): y; }
int lcm(int x, int y) { return x / gcd(x, y) * y; }
using ll = long long;
typedef long long lint;

int main() {
  string s;
  cin >> s;
  bool boo = true;
  for(int i=0;i<s.size();i+=2){
    if(s[i] == 'L') {
      boo = false;
      break;
  }
  }
  for(int i=1;i<s.size();i+=2){
    if(s[i] == 'R') {
      boo = false;
      break;
  }
  }
  if(boo) cout << "Yes" << endl;
  else cout << "No" << endl;
  }

Measured memory_bytes: 256
using System;
using System.Linq;

namespace A
{
    class Program
    {
        static void Main(string[] args)
        {
            // Console.WriteLine("Hello World!");
            var a = Console.ReadLine().Split().Select(int.Parse).OrderByDescending(x => -x).ToArray();

            int sum = 0;
            
            Console.WriteLine(0 + a[1]-a[0] + a[2] - a[1]);



        }
    }
}


Measured memory_bytes: 13396
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{  ll l,r,d;
cin>>l>>r>>d;
    if (l % d == 0)
        cout<<(r / d) - (l / d) + 1<<endl;
        else
    cout<<(r / d) - (l / d)<<endl;;

    return 0;
}


Measured memory_bytes: 3628
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;
using ll = long long;

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

    for (auto &c : s) {
        c = 'x';
    }

    cout << s << endl;

    return 0;
}

Measured memory_bytes: 384
let n, m = Scanf.scanf " %d %d" @@ fun a b -> a, b
let a_s = Array.init n @@ fun _ -> Scanf.scanf " %s" @@ fun s -> s
let bs = Array.init m @@ fun _ -> Scanf.scanf " %s" @@ fun s -> s
let _ =
  for i = 0 to n - m do
    for j = 0 to n - m do
      let is_ok = ref true in
      for k = 0 to m - 1 do
        for l = 0 to m - 1 do if a_s.(i + k).[j + l] <> bs.(k).[l] then is_ok := false done done;
      if !is_ok then (print_endline "Yes"; exit 0) done done;
 print_endline "No"

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

int main()
{
    int X;
    cin >> X;
    bool flag=false;
    if(X==2||X==3 || X==5 ||X==7){
        cout << X << endl;
    }else if(X==4){
        cout << 5 << endl;
    }else if(X==6){
        cout << 7 << endl;
    }
    else{
        if(X%2==0){
            X+=1;
        }
        while(true){
            for(int i=3;i<=sqrt(X);i+=2){
                if(X%i==0){
                    flag=true;
                    break;
                }
            }
            if(!flag){
                cout << X << endl;
                break;
            }
            X+=2;flag=false;
        }
    }
}

Measured memory_bytes: 256
#include <stdio.h>

int main (void){
    int a, b, c;
    int count = 0;
    scanf("%d %d %d", &a, &b, &c);

    for(int i = a; i <= b; i++){
        if(c % i == 0) count++;
    }

    printf("%d\n", count);
    return 0;

}


Measured memory_bytes: 2104
import java.util.*;
public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int H = sc.nextInt();
    int W = sc.nextInt();

    char[][] A = new char[H][W];
    for (int i = 0; i < H; i++) {
      String line = sc.next();
      for (int j = 0; j < line.length(); j++) {
        A[i][j] = line.charAt(j);
      }
    }
    
    int ans = resolve(A);
    
    System.out.println(ans);
    //System.out.println(Arrays.deepToString(A));
  }
  
  // up, down, left, right
  private static final int[] dx = { 0, 0, -1, 1 };
  private static final int[] dy = { -1, 1, 0, 0 };

  private static int resolve(char[][] a) {
    
    Queue<Node> queue = new LinkedList<Node>();

    // initial scan
    for (int i = 0; i < a.length; i++) {
      for (int j = 0; j < a[i].length; j++) {
        if (a[i][j] == '#') {
          queue.add(new Node(j, i, 0));
        }
      }
    }
    
    int max = 0;
    while (!queue.isEmpty()) {
      Node node = queue.remove();
      for (int i = 0; i < 4; i++) {
        int x = node.x + dx[i];
        int y = node.y + dy[i];
        int distance = node.distance + 1;
        if (y < 0 || a.length <= y || x < 0 || a[y].length <= x) {
          continue;
        }
        if (a[y][x] == '.') {
          a[y][x] = '#';
          queue.add(new Node(x, y, distance));
          max = Math.max(max, distance);
        }

      }
    }

    return max;
  }
  
  static class Node {
    final int x;
    final int y;
    final int distance;
    Node(int x, int y, int distance) {
      this.x = x;
      this.y = y;
      this.distance = distance;
    }
  }
}


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

#define pii pair<int,int>
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define pf push_front
#define pb2 pop_back
#define pf2 pop_front
#define line printf("\n")
#define pq priority_queue
#define rep(k,i,j) for(int k = (int)i;k<(int)j;k++)
#define repd(k,i,j) for(int k = (int)i;k>=(int)j;k--)
#define ll long long
#define ALL(a) a.begin(),a.end()
#define vi vector<int>

using namespace std;

double EPS = 1e-9;
int INF = 1e9+7;;
long long INFLL = 1e17;
double pi = acos(-1);
int dirx[8] = {-1,0,0,1,-1,-1,1,1};
int diry[8] = {0,1,-1,0,-1,1,-1,1};

clock_t first_attempt = clock();
inline void cek_time(){
	clock_t cur = clock()- first_attempt;
	cerr<<"TIME : "<<(double) cur/CLOCKS_PER_SEC<<endl;
}
inline void OPEN (string s) {
  freopen ((s + ".in").c_str (), "r", stdin);
  freopen ((s + ".out").c_str (), "w", stdout);
}

//end of template

const int maxn = 2005;
string arr[maxn];

int n,m;

vector<pii> bil[maxn];

int conv[maxn];

int ret = 0;
void insert(vector<pii> &histogram,int bil){
	if(histogram.size() && histogram.back().fi==bil)histogram[histogram.size()-1].se++;
	else histogram.pb(mp(bil,1));
}

void cut(vector<pii> &his,int H){
	int cnt = 0;
	while(his.size()){
		pii a = his.back();
		
		if(a.fi<H)break;
		his.pb2();
		
		cnt += a.se;
		ret = max(ret,a.fi*cnt);
	}
	
	if(cnt)his.pb(mp(H,cnt));
}
int main(){
	scanf("%d%d",&n,&m);
	
	rep(k,0,n)cin>>arr[k];
	rep(k,0,n)rep(i,0,m)arr[k][i] = (arr[k][i]=='.')?0:1;
	
	rep(i,0,m){
		
		int last_cut = 0;
		int last_bebas = 0;
		
		int cur = 1;
		rep(k,0,n){
			if(arr[k][i]^conv[k]){
				if(cur)last_cut = k;
				cur = 0;
				conv[k] ^= 1;
			}
			else{
				if(!cur)last_bebas = k;
				cur = 1;
			}
			cut(bil[k],k - max(last_bebas,last_cut) + 1);
			
			insert(bil[k],k+1);
		}
		
		//rep(k,0,n){rep(i,0,m)printf("%d",arr[k][i]^conv[k]);line;}
		rep(k,0,n){
			//rep(i,0,bil[k].size())printf("(%d %d) ",bil[k][i].fi,bil[k][i].se);line;
		}
		//line;
	}
	
	rep(k,0,n)cut(bil[k],0);
	
	cout<<ret<<endl;
	
	return 0;
}


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

using namespace std;

#define MXN 55

vector<int> edges[MXN];
int dfs_num[MXN], dfs_low[MXN], num, cnt;
bool visited[MXN];

void dfs(int cur, int par, int depth) {
    int nxt;
    dfs_num[cur] = dfs_low[cur] = depth;
    visited[cur] = 1;
    for (int i = 0; i < edges[cur].size(); ++i) {
        nxt = edges[cur][i];
        if (nxt == par) continue;
        if (!visited[nxt]) {
            dfs(nxt, cur, depth+1);
            if (dfs_low[nxt] >= depth+1) {
                // cout << cur << " " << nxt << "\n";
                ++cnt;
            }
            dfs_low[cur] = min(dfs_low[cur], dfs_low[nxt]);
        } else {
            dfs_low[cur] = min(dfs_low[cur], dfs_num[nxt]);
        }
    }
}

int main() { 
    int n, m, u, v;
    while (cin >> n >> m) {
        for (int i = 0; i < m; ++i) {
            cin >> u >> v;
            edges[u].push_back(v);
            edges[v].push_back(u);
        }
        cnt = 0;
        memset(dfs_num, 0, sizeof(dfs_num));
        memset(dfs_low, 0, sizeof(dfs_low));
        memset(visited, 0, sizeof(visited));
        dfs(1, 0, 0);
        cout << cnt << "\n";
        for (int i = 1; i <= n; ++i) edges[i].clear();
    }

    return 0;
}


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

#define EPS (1e-10)
#define rep(i, a, b) for (int i = a; i < (int)(b); ++i)
#define rrep(i, a, b) for (int i = b - 1; i >= (int)(a); --i)
#define all(a) a.begin(), a.end()

using namespace std;
using ll = long long;
using vi = vector<int>;
using vb = vector<bool>;
using vll = vector<ll>;
using vd = vector<double>;
using vvi = vector<vi>;
using vvb = vector<vb>;

constexpr int MOD = 1000000007;

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

    int n, k;
    cin >> n >> k;

    int cnt = 0;
    vvi G(n, vi(n, 1));

    if (k > 0) {
        rep(i, 1, n) {
            rep(j, 1, n - i) {
                // j : j + i
                G[j][j + i] = 2;
                ++cnt;
                if (cnt == k) { break; }
            }
            if (cnt == k) { break; }
        }
    }

    if (cnt != k) {
        cout << -1 << endl;
        return 0;
    }

    int ans = 0;
    rep(i, 0, n) {
        rep(j, i + 1, n) {
            if (G[i][j] == 1) { ++ans; }
        }
    }

    cout << ans << endl;
    rep(i, 0, n) {
        rep(j, i + 1, n) {
            if (G[i][j] == 1) { cout << i + 1 << " " << j + 1 << endl; }
        }
    }

    return 0;
}

Measured memory_bytes: 384
//omajinai
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define int ll
//omajinai

signed main(){

    // omajinai
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    // omajinai

    int n,k;
    cin >> n >> k;
    vector<int> d(10);
    for(int i = 0;i < k;i ++){
        int a;
        cin >> a;
        d.at(a) ++;
    }

    int hantei;
    for(n;;n ++){
        hantei = 1;
        int a = n;
        while(a > 0){
            int b = a % 10;
            if(d.at(b) == 1){
                hantei = 0;
                break;
            }
            a /= 10;
        }

        if(hantei == 1){
            break;
        }
    }

    cout << n << endl;


}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(void){
	int N,M;
	int K[10001];
	int A[10001][31];
	int ans[31] = {};
	int cnt = 0;
	int i,j;
	scanf("%d %d",&N,&M);
	for(i=0; i<N; i++){//入力
		scanf("%d",&K[i]);
		for(j=0; j<K[i]; j++){
			scanf("%d",&A[i][j]);
		}
	}
	
	for(i=0; i<N; i++){//好きな食べ物のところに1を足す
		for(j=0; j<K[i]; j++){
			ans[A[i][j]]++;
		}
	}
	
	for(i=0; i<=M; i++){//Nとans[i]の値が一致してるiがあればカウント1増やす
		if(N == ans[i])cnt++;
	}
	printf("%d",cnt);
	return 0;
}

Measured memory_bytes: 256
XXXX = input()
ab = int(XXXX[:2])
cd = int(XXXX[2:])

j = 1 <= ab <= 12
k = 1 <= cd <= 12
if not j and k:
    print("YYMM")
elif j and not k:
    print("MMYY")
elif j and k:
    print("AMBIGUOUS")
else:
    print("NA")

Measured memory_bytes: 3060
#include <cstdio>
#include <string>
#include <cmath>
#include <string>
#include <algorithm>
#include <iostream>
#include <map>
#include <vector>
#include <iomanip>
#include <tuple>
#include <queue>
#include <numeric>
using namespace std;
typedef long long ll;
#define rep(i, a, n) for (int i=a;i<n;++i)
#define repeq(i, a, n) for(int i=a;i<=n;++i)
#define repi(m, itr) for (auto itr = m.begin();itr != m.end();++itr)
#define per(i, a, n) for (int i=n-1; i>=a;--i)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()

// 
ll N;
ll x[110], y[110], h[110];
ll man[110][110][110];

int main(){
    cin >> N;
    rep(i, 0, N){
        cin >> x[i] >> y[i] >> h[i];
    }
    if(N==1){
    cout << x[0] << " "<< y[0] << " "<< h[0] << endl;
    return 0;
    }
    rep(i, 0, N){
        rep(j, 0, 101){
            rep(k, 0, 101){
                man[i][j][k] = h[i] + abs(x[i]-j)+abs(y[i]-k);
                if(h[i] == 0) man[i][j][k] = -1;
            }
        }
    }

    ll ansh = -1;
    ll ansx = -1;
    ll ansy = -1;
    rep(i, 0, N){
        if(h[i] == 0) continue;
        rep(j, 0, 101){
            rep(k, 0, 101){
                bool flg = true;
                bool look = false;
                rep(l, 0, N){
                    if(i==l) continue;
                    if(h[l] == 0) continue;
                    if(man[i][j][k] != man[l][j][k]){flg = false;}
                    look = true;
                }
                if(flg && man[i][j][k]>ansh && look){
                    ansh = man[i][j][k];
                    ansx = j;
                    ansy = k;
                }
            }
        }
    }

    if(ansh == -1){
        rep(i, 0, N){
            if(ansh<h[i]){
                ansh = h[i];
                ansx = x[i];
                ansy = y[i];
            }
        }
    }

    cout << ansx << " "<< ansy << " "<< ansh << endl;
    return 0;
}




Measured memory_bytes: 10368
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
int dec(string s)
{
	int ans=0;
	int co=1;
	for(int i = 0; i < s.size(); ++i)
	{
		if(s[i]=='m')
		{
			ans+=co*1000; co=1;
		}
		else if(s[i]=='c')
		{
			ans+=co*100;
			co=1;
		}
		else if(s[i]=='x')
		{
			ans+=co*10;
			co=1;
		}
		else if(s[i]=='i')
		{
			ans+=co;
			co=1;
		}
		else co=s[i]-'0';
	}
	return ans;
}

string enc(int n)
{
	char s[1001];
	s[1]='i'; s[10]='x'; s[100]='c'; s[1000]='m';
	int pos=1;
	string ans="";
	while(n)
	{
		int tmp=n%10;
		n/=10;
		if(tmp==0)
		{	
			pos*=10;
			continue;
		}
		else
		{
			if(tmp==1) ans+=s[pos];
			else 
			{
				ans+=s[pos];
				ans+=tmp+'0';
			}
		}
		pos*=10;
	}
	reverse(ans.begin(),ans.end());
	return ans;
}

int main()
{
	int n;
	cin>>n;
	while(n--) 
	{
		string s1,s2;
		cin>>s1>>s2;
		cout<<enc(dec(s1)+dec(s2))<<endl;
	}
  return 0;
}

Measured memory_bytes: 1208
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#include <cmath>
#include <bitset>
#include <iomanip>
#include <stack>
#include <list>
#include <map>
#include <unordered_map>
#include <chrono>
#include <numeric>
using namespace std;
using ll = long long;
const long long INF = (long long)1e18+1;
#define DIV 1000000007

ll modpow(ll a, ll n, ll mod) {
    ll res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

ll modinv(ll a, ll mod) {
    return modpow(a, mod - 2, mod);
}

ll comb(ll n, ll r) {
    ll res, deno, mole;
    res = deno = mole = 1;
    for (ll i = 0; i < r; i++) {
        mole *= (n - i);
        mole %= DIV;
        deno *= (r - i);
        deno %= DIV;
    }
    res = modinv(deno, DIV);
    res = (res * mole) % DIV;
    return res;
}

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
#ifdef TEST
    chrono::system_clock::time_point start, end;
    start = chrono::system_clock::now();
#endif
    long idx=0;
    long N, K;
    cin >> N >> K;
    ll total = 0;
    for(size_t i=K;i<=N+1; i++)
    {
        ll min_num = i * (i-1) /2;
        ll max_num = min_num + i * (N - (i-1));
        total += max_num - min_num + 1;
        total %= DIV;
    }
    cout << total << endl;
#ifdef TEST
    end = chrono::system_clock::now();
    cerr << static_cast<double>(chrono::duration_cast<chrono::microseconds>(end - start).count() / 1000.0) << "[ms]" << endl;
#endif
    return 0;
}

Measured memory_bytes: 3612
//#pragma GCC optimize ("O3")
//#pragma GCC target ("sse4")
#include <bits/stdc++.h>

using namespace std;

#define pb push_back
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
#define f first
#define s second
typedef long long ll;
typedef unsigned long long ull;

void IO(){
    ios::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
    #ifndef ONLINE_JUDGE
        freopen("test.txt","r",stdin);
    #endif
}

const int N=1e6+3,M=1e3+5,mod=1e9+7,dx[]={1,-1,0,0},
                                    dy[]={0,0,1,-1};
const double eps=1e-9;


int tc,n,a[N];

char s[N];

int main(){
    //IO();   
    int a,b;
    scanf("%d",&n);
    scanf("%d%d",&a,&b);
    bool ok = false;
    for(int i = a ; i <= b ; i++)
        if (i%n == 0)
            ok = true;
    if (ok)
        printf("OK\n");
    else
        printf("NG\n");
}


Measured memory_bytes: 3772
#include<bits/stdc++.h>
using namespace std;
int main() {

	char a;
	char b;
	cin >> a >> b;

	if (a == 'H'&&b == 'H') {
		cout << 'H' << endl;
	}
	else if (a == 'D'&&b == 'D') {
		cout << 'H' << endl;
	}
	else
	{
		cout << 'D' << endl;
	}

}

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

int V, E, G[105][105];
int used[105], ans;

void dfs(int x, int y){
  
  if( ans ) return;
  
  used[x] = 1;
  
  for(int i=0;i<105;i++){
    
    if( G[x][i] ){
      
      if( i == y ){
	ans = 1;
	return;
      }
      
      if( used[i] == 0 ) dfs( i, y );
      
    }
    
  }
  
}

signed main(){
  
  cin>>V>>E;
  
  for(int i=0;i<E;i++){
    int s, t;
    cin>>s>>t;
    G[s][t] = 1;
  }
  
  for(int i=0;i<V;i++){
    
    for(int j=0;j<V;j++) used[j] = 0;
    
    dfs( i, i );
    
  }
  
  cout<<ans<<endl;
  
  return 0;
}



Measured memory_bytes: 3188
import sys
input = sys.stdin.buffer.readline

#sys.setrecursionlimit(10**9)
#from functools import lru_cache

def RD(): return input().rstrip().decode()
def II(): return int(input())
def FI(): return int(input())
def MI(): return map(int,input().split())
def MF(): return map(float,input().split())
def LI(): return list(map(int,input().split()))
def LF(): return list(map(float,input().split()))
def TI(): return tuple(map(int,input().split()))
# rstrip().decode()



def main():
	n=II()
	A=[]
	for i in range(1,n+1):
		a,b=input().split()
		a=a.rstrip().decode()
		b=int(b)
		A.append([a,b,i])

	A.sort(key=lambda x:x[1],reverse=True)
	A.sort(key=lambda x:x[0])

	for _,_,i in A:
		print(i)






if __name__ == "__main__":
	main()


Measured memory_bytes: 62572
#include<iostream>
#include<vector>
using namespace std;
int main()
{
	int n,m;
	int array;
	while(cin>>n>>m)
	{
		
		vector <int> list[n];
		int i=0;
		
		while(cin>>array)//read column
		{
			list[i].push_back(array);
			if((list[i].size()-1)==list[i].at(0))
			{
				i++;
			}
		}
		int calculation[2][m];
		for(unsigned int i=0;i<m;i++)
		{
			calculation[0][i]=i+1;
			calculation[1][i]=0;
		}
		for(unsigned int i=0;i<n;i++)
		{
			for(unsigned int j=1;j<=list[i].at(0);j++)
			{
				calculation[1][(list[i].at(j))-1]++;

			}
		}
		int sum=0;
		for(unsigned int i=0;i<m;i++)
		{
			
			if(calculation[1][i] == n)
			{
				sum++;
			}
		}
		cout<<sum;
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
#define REP(i, a, b) for(int i = (a); i <= (b); i++)
#define PER(i, a, b) for(int i = (a); i >= (b); i--)
#define rep(i, a, b) for(int i = (a); i < (b); i++)
#define all(S) (S).begin(), (S).end()
#define pb push_back
#define mk make_pair
#define S second
#define F first
typedef long long ll;
typedef long double lf;
typedef pair<int, int> ii;

int main(int argc, char ** argv) {
	char s[20];
	stack<char> p, t;
	scanf(" %s", s);
	rep(i, 0, strlen(s)) {
	    if(s[i] == 'B' && !p.empty()) p.pop();
	    else if(s[i] != 'B') p.push(s[i]);
	}
	while(!p.empty()) t.push(p.top()), p.pop();
	while(!t.empty()) printf("%c", t.top()), t.pop();
	printf("\n");
	return 0;
}


Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
	ll a,b,c,d;
	cin>>a>>b>>c>>d;
	ll mi=(c*d*1LL)/__gcd(c,d);
	//cout<<mi;
	ll sub=(b/mi);
//	cout<<sub;
	//cout<<sub;
	ll x=(b/c)+(b/d)-(sub);
	ll sub2=(a-1)/mi;
	ll p=((a-1)/c)+((a-1)/d)-sub2;
//	cout<<x<<" "<<p;
	ll ans=(b-((a-1)))-(x-p);
//	ll y=(b/d)-((a-1)/d);
	//cout<<x<<" "<<y;
//	ll ans=(b-a)-(x+y-sub);
	cout<<ans;
	
	
	
}

Measured memory_bytes: 256
n,m = map(int, input().split())
mod = 10**9 + 7
a = list(map(int, input().split()))
dp = [[[0]*256 for _ in range(n+1)]for i in range(n+1)]
dp[0][0][0] = 1
for i in range(n):
  x = a[i]
  dp[i+1][0] = dp[i][0][:]
  for j in range(n):
    for k in range(256):
      dp[i+1][j+1][k] = (dp[i][j+1][k] + dp[i][j][k^x])%mod
f = 1
ans = 0
for j in range(1,n+1):
  f = f*j%mod
  ans += dp[n][j][m]*f
  ans %= mod
print(ans)


Measured memory_bytes: 63964
n = gets.chomp.to_i
a = gets.chomp.split.map(&:to_i)
s = 0
n.times do |i|
  if i.even?
    s += a[i]
  else
    s -= a[i]
  end
end
print "#{s}"
(n-1).times do |i|
  s = 2 * a[i] - s
  print " #{s}"
end


Measured memory_bytes: 13316
#include<bits/stdc++.h>
#define Vsort(a) sort(a.bigin(), a.end())
#define rep(i,n) for(int i = 0; i < (n); i++)

using namespace std;
using ll = long long;

int main(){
  int n, ac = 0, wa = 0, tle = 0, re = 0;
  cin >> n;
  vector<string> s(n);
  rep(i,n){
    cin >> s[i];
    if(s[i] == "AC"){
      ac++;
    }else if(s[i] == "WA"){
      wa++;
    }else if(s[i] == "TLE"){
      tle++;
    }else{
      re++;
    }
  }
  cout << "AC x " << ac << endl;
  cout << "WA x " << wa << endl;
  cout << "TLE x " << tle << endl;
  cout << "RE x " << re << endl;
  return 0;
}


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

int N;
int main(){
	cin>>N;
	int seat[N][2];
	int people;
	people=0;
	int group;
	for(int i=0; i<N; i++){
		cin>>seat[i][0]>>seat[i][1];
	}
	for(int i=0; i<N; i++){
		group=(seat[i][1]-seat[i][0])+1;
		people=people+group;
	}
	cout<<people;
}


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

#define rep(i, a, b) for (ll i = (a); i < (b); i++)
typedef uint64_t ull;
typedef int64_t ll;
typedef std::pair<ll, ll> PLL;

struct edge {
    ll from, to, val;
};

signed main() {
    ll L;
    cin>>L;

    vector<edge> edges;

    ll d = 0;
    while ((1ll << (d+1)) <= L){
        d++;
    }

    rep(i,1,d+1){
        edges.push_back({i,i+1,0});
        edges.push_back({i,i+1,1LL<<(i-1)});
    }

    ll val = 1ll << d; //32
    for (ll i = d-1; i>=0; i--) {
        if ((L & (1ll<<i)) == 0)
            continue;
        // printf("val=%d\n",val);
        edges.push_back({i+1,d+1,val});
        val += 1ll << i;
    }

    printf("%d %d\n", d+1, edges.size());
    for(auto e : edges){
        printf("%d %d %d\n", e.from, e.to, e.val);
    }

    return 0;
}


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

int main() {

	string str;

	cin >> str;

	int length = str.size();
	int ans = 0;
	int bef = 0;
	int aft = 0;

	for (int i = 0; i < length / 2; i++) {
		bef = i;
		aft = length - 1 - i;
		if (str[bef] != str[aft]) {
			ans += 1;
		}
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include <cstdio>

int n;

int main() {
    scanf("%d", &n);
    for (int i = 0, x; i < n; ++i) {
        scanf("%d", &x);
        if (!(x & 1) && x % 3 && x % 5) return puts("DENIED"), 0;
    }
    return puts("APPROVED"), 0;
}


Measured memory_bytes: 128
use std::io::{stdin, Read, StdinLock};
use std::str::FromStr;
use std::iter::FromIterator;

fn main() {
    let cin = stdin();
    let mut scan = Scanner::new(cin.lock());
    let s = scan.chars();
    let mut is_ok = true;
    for i in 0..s.len() {
        if i % 2 == 0 {
            if !(s[i] == 'R' || s[i] == 'U' || s[i] == 'D') {
                is_ok = false;
            }
        } else {
            if !(s[i] == 'L' || s[i] == 'U' || s[i] == 'D') {
                is_ok = false;
            }
        }
    }
    println!("{}", if is_ok {"Yes"} else {"No"});
}

// region template
#[allow(dead_code)]
fn iu(i: i64) -> usize { i as usize }

#[allow(dead_code)]
fn ui(i: usize) -> i64 { i as i64 }

#[allow(dead_code, deprecated)]
fn join<T: std::fmt::Display>(slice: &[T], sep: &str) -> String {
    let strings = slice.iter().map(|t| format!("{}", t)).collect::<Vec<_>>();
    strings.connect(sep)
}

#[allow(dead_code)]
fn arr<'a, S, T>(n: usize, mut f: S) -> Vec<T> where S: FnMut(usize) -> T + 'a {
    (0..n).map(|i| f(i)).collect::<Vec<T>>()
}

#[allow(dead_code)]
fn alt<S, T>(v: Vec<S>) -> T where T: FromIterator<S> {
    v.into_iter().collect::<T>()
}

#[allow(dead_code)]
fn dup<S, T>(v: &[S]) -> T where T: FromIterator<S>, S: Clone {
    v.iter().cloned().collect::<T>()
}

struct Scanner<'a> {
    cin: StdinLock<'a>,
}

#[allow(dead_code)]
impl<'a> Scanner<'a> {
    fn new(cin: StdinLock<'a>) -> Scanner<'a> {
        Scanner { cin: cin }
    }

    fn read1<T: FromStr>(&mut self) -> Option<T> {
        let token = self.cin.by_ref().bytes().map(|c| c.unwrap() as char)
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect::<String>();
        token.parse::<T>().ok()
    }

    fn read<T: FromStr>(&mut self) -> T {
        self.read1().unwrap()
    }

    fn readn<T: FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read::<T>()).collect()
    }

    fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}
// endregion

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

using namespace std;

#define MAX 100000
#define INF 2140000000
#define MOD 1000000007

int main() {
	int n, k;
	cin >> n >> k;
	vector<int> p(n);

	for (int i = 0; i < n; ++i) {
		cin >> p[i];
	}

	long double sum = 0;

	for (int i = 0; i < k; ++i) {
		sum += (p[i] + 1);
	}

	long double ans = sum;

	for (int i = k; i < n; ++i) {
		sum -= p[i - k] + 1;
		sum += p[i] + 1;

		ans = max(ans, sum);
	}

	cout << setprecision(9) << ans / 2 << endl;

	return 0;
}

Measured memory_bytes: 1024
#include <iostream>
using namespace std;
int main(int argc, const char * argv[]) {
    int n,x,Max=0,Min=0;
    long sum=0; //x=入力する値
    cin >> n;
    for (int i=0; i<n; i++) {
        cin >> x;
        sum+=x;
        if (i==0) {
            Max = x;
            Min = x;
        }else if(Max < x){
            Max = x;
        }else if(Min > x){
            Min = x;
        }
    }
    cout << Min << " "<< Max << " "<<sum <<endl;
    return 0;
}


Measured memory_bytes: 3112
#include<stdio.h>
int main(){
  int n,c[100],j,i;
  while(1){
    scanf("%d",&n);
    if(n==-1)break;
    //c=0;
    for(i=0;n!=0;i++){
      c[i]=n%4;
      n/=4;
    }
    if(i==0)printf("0");
    for(j=0;j<i;j++){
      printf("%d",c[i-j-1]);
    }
    printf("\n");
  }
  return 0;
}

Measured memory_bytes: 604
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

SA = sum(A)
SB = sum(B)

cnt_a, cnt_b = 0, 0
for i in range(N):
  if A[i] <= B[i]:
    cnt_a += (B[i] - A[i] + 1)//2
  else:
    cnt_b += A[i] - B[i]

if SB - SA >= max(cnt_a, cnt_b):
  print("Yes")
else:
  print("No")

Measured memory_bytes: 4596
#include <bits/stdc++.h>
using namespace std;
#define int long long

signed main(){
        int i, n, q, x;
        cin >> n >> q;

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

        for (i = 0; i < q; i++){
                cin >> x;
                int res = 0; //合計値
                int right = 0;
                int sum = 0;
                for (int left = 0; left < n; left++){//leftはなるべく固定する

                        while (right < n && sum + a[right] <= x){
                                sum += a[right];
                                right++;//rightのみを動かす
                        }

                        res += (right - left);//条件を満たす区間の個数を足し上げる


                if (left == right) right++;//重なっていたときrightずらす
                else sum -= a[left];//次のループに入るのでleftの分削る
                }

                cout << res << endl;
        }
        return 0;
}



Measured memory_bytes: 3628
#include<stdio.h>
#include<string.h>
int a[200005];
int main() {
    int n,k=0;
    scanf("%d",&n);
    int min=n;
    for(int i=0; i<n; i++) {
        scanf("%d",&a[i]);
        if(a[i]<=min){
            min=a[i];
            k++;
        }
    }
    printf("%d",k);
}


Measured memory_bytes: 896
#include<iostream>
#include<vector>
#include<cmath>
#include<map>
#include<queue>
#include<stack>
#include<algorithm>
#include<functional>

typedef unsigned long long LL;

using namespace std;


bool taosu(vector<int> mamono,int kaisu,int A,int B) {
	if ((LL)((LL)kaisu*(LL)B) > 1000000000) {
		return true;
	}
	for (int i = 0; i < mamono.size(); i++) {
		mamono[i] -= B * kaisu;
	}
	LL sabun = A - B;
	
	for (int i = 0; i < mamono.size(); i++) {
		if (mamono[i] > 0) {
			kaisu -= ceil((double)mamono[i] / sabun);
		}
	}
	if (kaisu >= 0) {
		return true;
	}
	else {
		return false;
	}
}

int main() {
	LL N, A, B;
	cin >> N >> A >> B;
	vector<int>h;
	for (int i = 0; i < N; i++) {
		int tmp;
		cin >> tmp;
		h.push_back(tmp);
	}
	LL upper = 1000000005;
	LL lower = 0;
	LL current = (upper+lower)/2;
	LL sabun = A - B;
	bool clear = false;

	while(true) {
		current = (upper + lower) / 2;
		clear = taosu(h, current, A, B);
		if (clear) {
			if (taosu(h, current - 1, A, B) == false) {
				break;
			}
			else {
				upper = current;
			}
		}
		else {
			lower = current + 1;
		}
	}
	cout << current << endl;
}

Measured memory_bytes: 1144
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
//const ll MOD=(ll)1e9+7;
const ll MOD=(ll)998244353;
const ll INF=(ll)1e18+10;
const double PI=acos(-1);

template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
int dy[]={-1,1,0,0};
int dx[]={0,0,-1,1};

map< ll, int > prime_factor(ll n) {
    map< ll, int > ret;
    for(ll i = 2; i * i <= n; i++) {
        while(n % i == 0) {
            ret[i]++;
            n /= i;
        }
    }
    if(n != 1) ret[n] = 1;
    return ret;
}

void solve(int ca){
    int N; cin>>N;
    int ans=0;
    for (int i = 1; i <= N; i+=2) {
        auto tmp = prime_factor(i);
        int cnt=1;
        for(auto j:tmp){
            cnt*=(j.second+1);
        }
        if(cnt==8) ans++;
    }
    cout<<ans<<endl;
}

//#define MULTI
int main() {
    //ios::sync_with_stdio(false);
    //cin.tie(nullptr);
#ifdef MULTI
    int N; cin>>N;
    for (int i = 0; i < N; ++i) {
        solve(i+1);
    }
#else
    solve(1);
#endif
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(){
    int a, b;

    scanf("%d %d", &a, &b);

    if(a > b){
        printf("a > b\n");
    }
    else if(a < b){
        printf("a < b\n");
    }
    else{
        printf("a == b\n");
    }

    return 0;
}


Measured memory_bytes: 2112
s = gets.chomp

ans = 10**9
s.split('').each do |ss|
  cnt = 0
  l = s.size
  w = s

  while w.scan(/#{ss}/).count != l
    tmp = ''
    (0..l-2).each do |i|
      tmp += w[i]==ss || w[i+1]==ss ? ss : w[i]
    end
    w = tmp
    l -= 1
    cnt += 1
  end
  ans = cnt if cnt < ans
end

puts ans

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

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

    sort(a.begin(), a.end());
    bool ok = true;
    rep(i, n-1) {
        if (a[i] == a[i+1]) {
            ok = false;
            break;
        }
    }

    if (ok) cout << "YES" << endl;
    else cout << "NO" << endl;
    return 0;
}

Measured memory_bytes: 1792
#include <iostream>
#include <string>
#include <algorithm>

using namespace std;

#define int long long

signed main()
{
    int A;
    cin >> A;
    string S;
    cin >> S;
    reverse(S.begin(),S.end());
    int D = (int)(S[0] - '0');
    D += 10 * (int)(S[1] - '0');
    D += 100 * (int)(S[3] - '0');

    cout << (A * D) / 100 << endl;
}

Measured memory_bytes: 3184
#include <iostream>
#include <string>
#include<iomanip>
#include <algorithm>
#include <map>
#include <vector>
#include<queue>
#include<math.h>
#include<cmath>
#include<set>
#include <map>
#include<string.h>
#include<sstream>
#include<stack>
#define ll long long
#define ios ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using namespace std;
const int N = 1e5 + 5, inf = 1e9 + 7;
const double ep = 0.0000000001;
const double pi = 3.14159265359;
ll fact[N], inv[N];
ll fp(ll x, ll y)
{
	if (!y)
		return 1;
	ll res = fp(x, y / 2);
	res = (res * res) % inf;
	if (y & 1)
		return (res * x) % inf;
	return res;
}
void calc()
{
	fact[0] = inv[0] = 1;
	for (ll i = 1; i < N; i++)
	{
		fact[i] = (fact[i - 1] * i) % inf;
		inv[i] = fp(fact[i], inf - 2) % inf;
	}
}
ll ncr(ll n, ll r)
{
	return (((fact[n] * inv[r]) % inf) * inv[n - r]) % inf;
}

ll n, arr[N], sum1 = 0, k, sum2 = 0, p, ans;
int main() {
	calc();
	cin >> n >> k;
	for (int i = 0; i < n; ++i) {
		cin >> arr[i];
	}
	sort(arr, arr + n);
	for (int i = k-1; i < n; ++i) {
		p = ((arr[i] % inf) * (ncr(i, k - 1) % inf)) % inf;
		sum1 = (sum1 % inf + p % inf) % inf;
		
	}
	reverse(arr, arr + n);
	for (int i = k-1; i < n; ++i) {
		p = ((arr[i] % inf) * (ncr(i, k - 1) % inf)) % inf;
		sum2 = (sum2 % inf + p % inf) % inf;

	}
	ans = (inf + (sum1 % inf) - (sum2 % inf)) % inf;
	cout << ans;
	return 0;

}


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

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  vector<int> t(3, 0);
  REP(i, 3) {
    int a, b;
    cin >> a >> b;
    t[a - 1]++;
    t[b - 1]++;
  }
  if(max({t[0], t[1], t[2], t[3]}) <= 2)
    cout << "YES" << endl;
  else
    cout << "NO" << endl;

  return 0;
}

Measured memory_bytes: 256
import java.util.*;
public class Main {
        public static void main(String[] args){
                Scanner sc = new Scanner(System.in);
                int count = sc.nextInt();
                int dinner[] = new int[count];
                int dinner_fb[] = new int[count];
                int dinner_fb_p[] = new int[count - 1];
                for (int i = 0; i < count; i++) {
                        dinner[i] = sc.nextInt();
                }
                for (int i = 0; i < count; i++) {
                        dinner_fb[i] = sc.nextInt();
                }
                for (int i = 0; i < count - 1; i++) {
                        dinner_fb_p[i] = sc.nextInt();
                }

                int result = 0;
                int before_dinner = 0;
                for (int i = 0; i < dinner.length; i++) {
                        int dinner_count = dinner[i]-1;
                        if(before_dinner == dinner[i] - 1) {
                                if (before_dinner != 0) {
                                        result += dinner_fb_p[dinner_count - 1];
                                }

                        }
                        result += dinner_fb[dinner_count];
                        before_dinner = dinner[i];
                }
                System.out.println(result);
        }
}

Measured memory_bytes: 21844
import java.util.Scanner;

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

		Scanner sc = new Scanner(System.in);
		int h = sc.nextInt();
		int a = sc.nextInt();

		int ans = 0;

		for(int i=0;i<20000;i++) {
			if(i*a >= h) {
				ans = i;
				break;
			}
		}

		System.out.println(ans);

	}
}


Measured memory_bytes: 22868
#include<bits/stdc++.h>
using namespace std;
struct knap
{
	long long w,v;
};

int main()
{
	long long n,W;
	cin>>n>>W;
	knap arr[n];
	for(int i=0;i<n;i++)
	cin>>arr[i].w>>arr[i].v;
	long long dp[W+1][n+1];
	
	for(int i=0;i<n+1;i++)
	dp[0][n]=0;
	for(int i=0;i<W+1;i++)
	dp[i][0]=0;
	
	for(int i=1;i<W+1;i++)
	{
		for(int j=1;j<=n;j++)
		{
			if(arr[j-1].w<=i)
			dp[i][j]=max(dp[i][j-1], arr[j-1].v+dp[i-arr[j-1].w][j-1]);
			else
			dp[i][j]=dp[i][j-1];
		}
	}
	cout<<dp[W][n];
   return 0;
	
	
	
}
	

Measured memory_bytes: 82400
#include<stdio.h>
int main()
{
	char s1[7], s2[100], s3[7];
	char ch;
	s2[0]='\0';
	scanf("%s",&s1);
	scanf("%c",&ch);
	scanf("%s",&s2);
	printf("A");
	printf("%c",toupper(s2[0]));
	printf("C\n");
	return 0;
}

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

#define db(x) cerr << #x ": " << (x) << '\n';

#define int long long

using namespace std;

typedef long long ll;

typedef long double ld;

const int oo = 1e18;

int A, B;

int32_t main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    cin >> A >> B;

    vector<int> vect;

    for(int i = 1 ; i < 1000000 ; i++)
    {
        if(i*8/100 == A)vect.push_back(i);
    }

    for(auto x : vect)
    {
        if(x/10 == B)
        {
            cout << x << '\n';
            return 0;
        }
    }

    cout << -1 << '\n';

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <tuple>
#include <utility>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <iomanip>
#include <map>
#define rep(i, n) for (int i = 0; i < n; i++)
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
const int INF = 1e9 + 7;
int dx[8] = {1, 0, -1, 0, 1, 1, -1, -1};
int dy[8] = {0, 1, 0, -1, 1, -1, 1, -1};

int main(){
    
int n;
cin>>n;
vector<int>a(n);
vector<int>b(n);
vector<int>c(n);
rep(i,n)cin>>a[i];
rep(i,n)cin>>b[i];
rep(i,n)cin>>c[i];
sort(a.begin(),a.end());
sort(c.begin(),c.end());

ll ans=0;

rep(i,n){
    ans+=(ll)(lower_bound(a.begin(),a.end(),b[i])-a.begin())*(ll)(c.end()-upper_bound(c.begin(),c.end(),b[i]));
}

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


Measured memory_bytes: 1408
x, n = map(int, input().split())
p = sorted(list(map(int, input().split())))

i_max = 101
i_min = 0

for i in range(x, 101):
    if i not in p:
        i_max = i
        break

for i in range(x, 0, -1):
    if i not in p:
        i_min = i
        break

if x - i_min <= i_max - x:
    print(i_min)
else:
    print(i_max)

Measured memory_bytes: 61956
#include<iostream>
#include <algorithm>
#include <string>

using namespace std ;

int main()
{
  vector< int > hand ;
  char arg ;
  int N ,player, field;
  while(1)
  {
    hand.clear() ;
    player = 0 ;
    field = 0 ;
    cin >> N ;
    hand.assign(N,0) ;
    if(N == 0)
    {
      break ;
    }
    for(int i = 0; i < 100; ++i)
    {
      cin >> arg ;
      if(arg == 'S')
      {
        field += (hand.at( player ) + 1 );
        hand.at( player ) = 0 ;
      }
      if(arg == 'M')
      {
        ++hand.at( player ) ;
      }
      if(arg == 'L')
      {
        hand.at(player) += (field + 1) ;
        field = 0 ;
      }
      ++player ;
      if(player == N )
      {
        player = 0 ;
      }
    }
    sort(hand.begin(),hand.end()) ;
    for(int i = 0; i < N ; ++i)
    {
      cout << hand.at( i ) << " " ;
    }
    cout << field << endl ;
  }

  return 0 ;
}

Measured memory_bytes: 3152
#include<bits/stdc++.h>
using namespace std;
map<int,int> m;
vector<int> v;
int main()
{
    int n,ans;
    cin>>n;
    for(int i=1;i<=n;++i)
    {
        int x;
        cin>>x;
        if(m[x]==0) v.push_back(x);
        ++m[x];
    }
    for(int i=0;i<v.size();++i)
    {
        if(m[v[i]]>=v[i]) ans+=m[v[i]]-v[i];
        else ans+=m[v[i]];
    }
    cout<<ans<<endl;
    return 0;
}


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

unordered_map<long, long> mp;

int main()
{
    std::string S;

    cin >> S;

    if((char)S[S.length() - 1] == 's'){
        cout << S << "es" << endl;
    }else{
        cout << S << "s" << endl;
    }

    return 0;
}


Measured memory_bytes: 3600
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
constexpr long long MOD = 1000000007;
constexpr long long INF = 1LL << 60;
const long double PI = acosl(-1.0);
constexpr long double EPS = 1e-11;
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
int main(){
ll x;
cin >> x;
if (400 <= x and 600 > x) cout << 8 << endl;
else if (600 <= x and 800 > x) cout << 7 << endl;
else if (800 <= x and 1000> x) cout << 6 << endl;
else if (1000 <= x and 1200 > x) cout << 5 << endl;
else if (1200 <= x and 1400 > x) cout << 4 << endl;
else if (1400 <= x and 1600 > x) cout << 3 << endl;
else if (1600 <= x and 1800 > x) cout << 2 << endl;
else
    cout << 1 << endl;




}

Measured memory_bytes: 3624
// #pragma GCC optimize ("O3")
// #pragma GCC target ("sse4")

#include <bits/stdc++.h>
using namespace std;
const int INF = 1 << 29;
const int NINF = -1*INF;
const long long LLINF = 1ll << 60;
const long long LLNINF = -1*LLINF;

template <class Ch, class Tr, class Container>
basic_ostream <Ch, Tr> & operator << (basic_ostream <Ch, Tr> & os, Container const& x) {
    os << "{ ";
    for(auto& y : x) os << y << " ";
    return os << "}";
}

template <class X, class Y>
ostream & operator << (ostream & os, pair <X, Y> const& p) {
	return os << "[ " << p.first << ", " << p.second << "]" ;
}

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
 
typedef pair<int, int> pi;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pd;

typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<double> vd;
typedef vector<ld> vld;
typedef vector<pi> vpi;
typedef vector<pll> vpll;
typedef vector<vector<int>> vvi;
typedef vector<vll> vvll;
typedef vector<vd> vvd;
typedef vector<vld> vvld;
 
#define mp make_pair
#define pb push_back
#define pf push_front
#define all(x) x.begin(), x.end()
#define revAll(x) x.rbegin(), x.rend()
#define gcd(a, b) __gcd(a, b)
#define popcount(x) __builtin_popcount(x)
#define isize(x) (int)(x.size())
#define rep(i,n) for(int i = 0; i < n; i++)
#define umap unordered_map
#define uset unordered_set
#define pq priority_queue

const ll MOD = 1e9 + 7;

ll pow_mod(ll base, ll exp, ll q) {
	exp = exp % (q-1);
	base %= q;
	ll ans = 1;
	while (exp) {
		if (exp & 1) ans = (ans * base) % q;	
		base = (base * base) % q;
		exp /= 2;
	}
	return ans;
}

void madd(ll& a, ll b){
	a += b;
	if (a >= MOD) a -= MOD;
}

void msub(ll& a, ll b){
	a -= b;
	if (a < 0) a += MOD;
}

int main(){
	ios_base::sync_with_stdio(false);cin.tie(0);
	int n; cin >> n;
	ll x = pow_mod(10, n, MOD);
	msub(x, (2*pow_mod(9, n, MOD))%MOD);
	madd(x, pow_mod(8, n, MOD));
	cout << x % MOD;
}

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

using namespace std;

class Solver{};

signed main() {
	int range = 10000;
	int n;
	cin >> n;

	int res = 0;
	for (int i = 1; i <= range; i++) {
		vector<int> digs;
		int tmp = i;
		while (tmp > 0) {
			digs.emplace_back(tmp % 10);
			tmp /= 10;
		}

		bool valid = true;
		int size = digs.size();
		for (int j = 0; j < size / 2; j++) {
			if (digs[j] == digs[size - j - 1])continue;

			valid = false;
			break;
		}
		if (valid) {
			if (abs(i - n) < abs(res-n))res = i;
		}
	}

	cout << res << endl;
}


Measured memory_bytes: 3164
#include<bits/stdc++.h>
#define int long long
using namespace std;
int l,n,x[300001],s[300001],ans=0;
main()
{
	cin>>l>>n;
	for(int i=1;i<=n;i++)cin>>x[i];
	x[n+1]=l;
	for(int i=1;i<=n;i++)s[i]=s[i-1]+x[i];
	for(int i=1,j=n-1;i<=n;i++,j--)ans=max(ans,max(
		j*l+2*(s[i+j/2]-s[i-1])-x[i+(j+1)/2]-2*(s[n]-s[i+(j+1)/2]),
		i*l+2*s[(i-1)/2]+x[(i+1)/2]-2*(s[i]-s[i-(i+1)/2])
	));
	cout<<ans<<'\n';
}


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

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

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

typedef long long ll;

long long karakaru(long long num)
{
    long long count = 0;
    if (num != 1)
    {
        count += karakaru(num / 2);
    }
    else
    {
        return 1;
    }
    return count * 2 + 1;
}

void solve(long long H)
{
    cout << karakaru(H) << endl;
}

int main()
{
    long long H;
    scanf("%lld", &H);
    solve(H);
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define LLI long long int
#define ULTRA 2134567890
#define de(x) if(x!=0 && MODE==x)
#define MODE 1
using namespace std;

int main()
{
    int i,j;
    int X;

    scanf("%d", &X);
    int a = X / 100 * 100;
    int b = X / 100 * 105;
    if( a <= X && X <= b)
        printf("1\n");
    else
        printf("0\n");


    return 0;
}


Measured memory_bytes: 256