akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define MOD 1000000007
#define INF 1e9
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()

// 約数の列挙O(√n)
vector<ll> divisor(int n){
    vector<ll> res;
    for(ll i=1LL;i*i<=n;i++){
        if(n%i==0){
            res.push_back(i);
            if(i!=n/i) res.push_back(n/i);
        }
    }
    sort(res.begin(), res.end());
    return res;
}

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

    int ans=0;
    for(int i=1;i<=n;i+=2){
        auto x=divisor(i);
        if(x.size()==8){
            ans++;
        }
    }

    cout<<ans<<endl;
}

Measured memory_bytes: 256
import sys
N, M = map(int, input().split())

sys.setrecursionlimit(10**9)

vertices = [[] for i in range(N+1)]
dp = [-1] * (N+1)

for _ in range(M):
    fro, to = map(int, input().split())
    vertices[fro].append(to)

def dfs(i):
    
    if dp[i] != -1:
        return dp[i]
    
    temp = 0
    for vertex in vertices[i]:
        temp = max(temp, dfs(vertex)+1)
        
    dp[i] = temp
    return temp

for i in range(1,N+1):
    dfs(i)
    
print(max(dp))

Measured memory_bytes: 154060
use std::io;

fn main() {
    let mut ln = String::new();
    if let Ok(_) = io::stdin().read_line(&mut ln) {
        let mut iter = ln.split_whitespace();
        let mut v: Vec<i32> = Vec::new();
        while let Some(s) = iter.next() {
            v.push(s.parse().unwrap());
        }
        let x = v[0] * v[1];
        if x < v[2] {
            println!("{}", x);
        } else {
            println!("{}", v[2]);
        }
    }
}

Measured memory_bytes: 4352
#include<cstdio>
#include<iostream>
using namespace std;
typedef long long ll;
const int N=3e3+10;
int n,a[N];ll dp[N][N][2];
int main(){
	scanf("%d",&n);
	for(register int i=1;i<=n;i++)scanf("%d",&a[i]);
	for(register int i=1;i<=n;i++)dp[i][i][0]=a[i];
	for(register int i=1;i<=n;i++)dp[i][i][1]=-a[i];
	for(register int i=n;i;i--)
		for(register int j=i+1;j<=n;j++)
			dp[i][j][0]=max(dp[i][j-1][1]+a[j],dp[i+1][j][1]+a[i]),
			dp[i][j][1]=min(dp[i][j-1][0]-a[j],dp[i+1][j][0]-a[i]);
	printf("%lld\n",dp[1][n][0]);
	return 0;
}

Measured memory_bytes: 141568
#include <stdio.h>
#include <stdlib.h>

#define MaxNUM 100

int main( void )
{
    char tmp;
    char i,j,k = 0;
    unsigned char Num = 0;
    
    unsigned short Array[MaxNUM];
    unsigned short v = 0;

    // ??\??? 1?????????????????°?????????
    // ????????????????????\????????§??£?¶???????
    while( (tmp = getchar()) != '\n' )
    {
        Num = (Num * 10) + (tmp - '0'); // ??????????????°???????????????????¶?????????????
    };
    
    // ??\??? 2??????????????????????????????????????????
    for(k=0; k<Num; k++ )
    {
        // ??????????????????
        Array[k]=0;
    
        do{
            tmp = getchar();
            printf("%c",tmp);
            
            if(tmp == '\n') //???????????????????????????
            {
                break;
            }
            
            if( tmp != ' ' )
            {
                Array[k] = Array[k] * 10 + (tmp - '0');
            }
        }while(tmp != ' ' && tmp != '\n'); // ???????????£???????¬???????????????????
    }

    // ?????????
    for( i=1; i<Num; i++ )
    {
        v = Array[i];
        j = i - 1;
    
        // ??????????????????????????§????????¨??????1??????????????¨??\????????????
        while( j >= 0 && Array[j] > v )
        {
            Array[j+1] = Array[j];
            Array[j] = v;
            j--;
        }
    
        // ???????????????????????????????????????????????????????????????
        for(k=0; k<Num; k++ )
        {
            printf("%d",Array[k]);
            if( k == Num-1 )
            {
               printf("\n");    // ???????????????
            }
            else
            {
               printf(" ");
            }
        }
    }
    
    return 0;
}

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


int solve() {
		
}

int main() {
	double x1,x2,y1,y2;
	cin >> x1 >> y1 >> x2 >> y2;
    //cout<<sqrt((x2-x1)*(x2-x1)+ (y2-y1)*(y2-y1))<< endl;;	
	printf("%.8lf\n",sqrt((x2-x1)*(x2-x1)+ (y2-y1)*(y2-y1)));
}



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

using namespace std;

#define MAX 1000000

int main()
{
    vector<int> p;
    bool prime[MAX];
    fill(prime, prime + MAX, 1);
    prime[0] = prime[1] = 0;
    for (int i = 2; i < MAX; i++) {
        if (prime[i]) {
            p.push_back(i);
            for (int j = 2*i; j < MAX; j += i) {
                prime[j] = 0;
            }
        }
    }

    int N;
    while (cin >> N, N) {
        int sum = 0;
        for (int i = 0; i < N; i++) {
            sum += p[i];
        }
        cout << sum << endl;
    }
    return 0;
}

Measured memory_bytes: 4228
#include <iostream>
using namespace std;
int arr[55];
int main() {
    int N;
    scanf("%d", &N);
    for (int i=0; i<N; i++) scanf("%d", &arr[i]);
    long long sum = 0;
    for (int i=0; i<N; i++){
        for (int j=i+1; j<N; j++){
            sum += arr[i]*arr[j];
        }
    }
    printf("%lld\n", sum);
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include<math.h>
typedef long long ll;
using namespace std;
int main(){
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	ll x,ans;
	cin>>x;
	ll r = x;
	x/=500;
	ans=x*1000;
	r%=500;
	r/=5;
	ans +=r*5;
	cout<<ans;

	
	
}

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

void calculate(){
    int A,B,ord;
    cin >> A >> B >> ord;
    for(int i = min(A,B);1 <= i;--i){
        if(A % i == 0 and B % i == 0) ord--;
        if(ord == 0){
            cout << i << '\n';
            return;
        }
    }
}

int main(int, char**) {
    calculate();
    return 0;
}


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

using namespace std;

int main()
{
	int k, s;
	cin >> k >> s;

	int a=max(0, s - 2 * k);
	int cou = 0;
	for (int i = a; i <= k; i++) {
		int b = max(0, s - i - k);
		int c = min(k, s - i);
		if (c < b)cou += 0;
		else cou += c - b + 1;
	}
	cout << cou << endl;

	return 0;
}

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

using ll = long long;
using P = pair<int, int>;

int main() {
    int n, m;
    cin >> n >> m;
    vector<P> p(m);
    for(int i=0; i<m; ++i) {
        cin >> p[i].first >> p[i].second;
    }

    for(int x=0; x<1000; ++x) {
        int keta = 1;
        int nx = x/10;
        vector<int> d(1, x%10);
        while(nx) {
            keta++;
            d.push_back(nx%10);
            nx /= 10;
        }
        if(keta != n) continue;
        bool ok = true;
        reverse(d.begin(), d.end());
        for(int i=0; i<m; ++i) {
            if(d[p[i].first-1] != p[i].second) ok = false;
        }
        if(ok) {
            cout << x << endl;
            return 0;
        }
    }

    cout << -1 << endl;
    return 0;
}

Measured memory_bytes: 256
parseint(x) = parse(Int, x)
parseintmap(x::Array{SubString{String},1}) = map(parseint, x)

function solve(r::Int, d::Int, x::Int)
    for _ in 1:10
        x = r*x-d
        println(x)
    end
end

function main()
    r, d, x= readline() |> split |> parseintmap
    solve(r, d, x)
end

main()

Measured memory_bytes: 165540
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		//		new Main().solveA();
		//		new Main().solveB();
		//		new Main().solveC();
		new Main().solveC2();
		// new Main().solveD();
	}

	private void solveA() {
		Scanner scanner = null;
		int numN = 0;

		try {
			scanner = new Scanner(System.in);
			numN = scanner.nextInt();

			if (numN % 2 == 0) {
				System.out.println(numN);
			} else {
				System.out.println(numN * 2);
			}

			System.out.println("");

		} finally {
			if (scanner != null) {
				scanner.close();
			}
		}
	}

	private void solveB() {
		Scanner scanner = null;
		int numN = 0;

		try {
			scanner = new Scanner(System.in);
			numN = scanner.nextInt();
			int[] wk = new int[numN];

			for (int i = 0; i < wk.length; i++) {
				wk[i] = scanner.nextInt();
			}
			Arrays.sort(wk);

			System.out.println(wk[wk.length - 1] - wk[0]);

			System.out.println("");

		} finally {
			if (scanner != null) {
				scanner.close();
			}
		}
	}

	private int getCry(int b, int currentI, int maxI, int[] wk) {
		if (currentI == maxI) {
			return 0;
		}

		return getCry(b, currentI + 1, maxI, wk) + Math.abs(wk[currentI] - (b + currentI + 1));
	}

	private void solveC2() {
		Scanner sc = null;
		int numN = 0;

		try {
			sc = new Scanner(System.in);
			numN = sc.nextInt();
			int[] wk = new int[numN];
			for (int i = 0; i < numN; i++) {
				wk[i] = sc.nextInt() - (i + 1);
			}
			Arrays.sort(wk);
			int med = numN % 2 == 0 ? numN / 2 - 1 : numN / 2;
			int b = wk[med];
			long ans = 0;
			for (int a : wk) {
				ans += Math.abs(a - b);
			}

			System.out.println(ans);
		} finally {
			if (sc != null) {
				sc.close();
			}
		}
	}

	/**
	 * ⅰ)abs(xi-a)の総和(aとの距離の総和)を最小にするのは中央値で、
	 * ⅱ)(xi-a)^2の総和を最小にするのは平均値
	 */
	private void solveC() {
		Scanner scanner = null;
		int numN = 0;

		try {
			scanner = new Scanner(System.in);
			numN = scanner.nextInt();

			int[] wk = new int[numN];
			for (int i = 0; i < numN; i++) {
				wk[i] = scanner.nextInt() - (i + 1);
			}
			Arrays.sort(wk);

			//			int b = 0;
			//			if (numN % 2 == 0) {
			//				b = wk[(numN / 2) - 1];
			//			} else {
			//				b = wk[numN / 2];
			//			}

			int med = numN % 2 == 0 ? numN / 2 - 1 : numN / 2;
			int b = wk[med];

			int res = 0;

			for (int a : wk) {
				res += Math.abs(a - b);
			}
			System.out.println(res);

		} finally {
			if (scanner != null) {
				scanner.close();
			}
		}
	}

	private void solveD() {
		Scanner scanner = null;
		int numN = 0;
		int numK = 0;
		int numS = 0;

		try {
			scanner = new Scanner(System.in);
			numN = scanner.nextInt();

			System.out.println("");

		} finally {
			if (scanner != null) {
				scanner.close();
			}
		}
	}
}

Measured memory_bytes: 77436
#include <cmath>
#include <iostream>
using namespace std;
int main(int argc, char** argv) {
    int n; cin >> n;
    int X[n], Y[n], h[n];
    for (int i = 0; i < n; i++) cin >> X[i] >> Y[i] >> h[i];
    for (int x = 0; x <= 100; x++)
        for (int y = 0; y <= 100; y++) {
            int ht = -1, hu = 1<<30;
            bool ok = true;
            for (int i = 0; i < n; i++) {
                if (h[i] > 0) {
                    int h0 = h[i] + abs(X[i] - x) + abs(Y[i] - y);
                    if (ht >= 0 && ht != h0 || hu < h0) { ok = false; break; }
                    else { ht = h0; }
                } else {
                    hu = min(hu, abs(X[i] - x) + abs(Y[i] - y));
                    if (ht >= 0 && hu < ht) { ok = false; break; }
                }
            }
            if (ok) {
                cout << x << ' ' << y << ' ' << ht << endl;
                return 0;
            }
        }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
const ll mod=1e9+7;
int dy[]={1,-1,0,0};
int dx[]={0,0,1,-1};

int main(){
    int N;
    cin>>N;
    int a,b,c;
    vector<pair<int,int>> tonari[100001];
    for(int i=0;i<N-1;i++){
        cin>>a>>b>>c;
        tonari[a-1].push_back({b-1,c});
        tonari[b-1].push_back({a-1,c});
    }
    int Q,K;
    cin>>Q>>K;
    vector<ll> dist(N,-1);

    queue<int> q;
    dist[K-1]=0;
    q.push(K-1);
    while(!q.empty()){
        int pos=q.front();
        q.pop();
        for(auto next:tonari[pos]){
            if(dist[next.first]>=0) continue;
            dist[next.first]=dist[pos]+(ll)next.second;
            q.push(next.first);
        }
    }
    int x,y;
    for(int i=0;i<Q;i++){
        cin>>x>>y;
        cout<<dist[x-1]+dist[y-1]<<endl;
    }

    return 0;
}



Measured memory_bytes: 8820
#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 <cassert>

using namespace std;

int main()
{
	int n;
	cin>>n;
	if((-2*n/7.0<=-n/4.0)&&(n%7==0||n%4==0||(((-n/4)+(2*n/7))>=1)))
	{
		cout<<"Yes"<<endl;
	}else
	{
		cout<<"No"<<endl;
	}
	
}


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

int main(){
 int B[105];
  int n,ans=0;
  cin >> n;
  for(int i = 0;i<n-1;i++){
    cin >> B[i];
  }
  for(int i=0;i<n-1;i++){
    if(i==0){
      ans = B[i];
    }else if(B[i]<B[i-1]){
       	ans += B[i];
    }else if(B[i]>=B[i-1]){
      ans += B[i-1];
    }
    if(i==n-2){
     ans += B[i]; 
    }
  }
  cout << ans << endl;
}

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

#define ll long long
#define mod 1000000007
#define ffor(i,a,b) for(int i=a;i<b;i++)
#define bfor(i,a,b) for(int i=a-1;i>=b;i--)
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
#define mem(x,y) memset(x,y,sizeof(x))
#define all(x) x.begin(),x.end()
#define SP(x) setprecision(x)
#define sz(x) (int)x.size()
#define fast  ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define PI 3.14159265358979323846
#define lb lower_bound
#define ub upper_bound
#define bs binary_search

int main()
{
    string a,b;
    cin>>a>>b;
    cout<<b+a;
    return 0;
}



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

using namespace std;

const int N_MAX = 200002;

int n;

int v[N_MAX];

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cin >> n;
    int pos = 1;
    for(int i = 1; i <= n; i++)
    {
        cin >> v[i];
        if(v[i] == pos)
            pos++;
    }
    if(pos == 1)
        cout << "-1\n";
    else
        cout << n - pos + 1 << "\n";
    return 0;
}


Measured memory_bytes: 1024
n = int(input())

a = [0]*4
for i in range(n):
    s = input()
    if s == 'AC':
        a[0] += 1
    elif s == 'WA':
        a[1] += 1
    elif s == 'TLE':
        a[2] += 1
    else:
        a[3] += 1

print('AC x',a[0])
print('WA x',a[1])
print('TLE x',a[2])
print('RE x',a[3])

Measured memory_bytes: 9212
#include <stdio.h>
int main(void){
    
    int a,b,c,cnt = 0;
    int x,n;
    
    while(1){
        scanf("%d %d",&n,&x);
        if(n == 0 && x == 0) break;
        for(a = 1; a <= n-2; a++){
            for(b = a+1; b <= n-1; b++){
                for(c = b+1; c <= n; c++){
                    if(x == a+b+c) cnt++;
                }
            }
        }
         printf("%d\n",cnt);
         cnt = 0;
    }
    
}

Measured memory_bytes: 1816
#include <iostream>
#include <unordered_map>

using namespace std;

int main(){
    int n;
    cin >> n;
    unordered_map<string, int> verdict;
    for (int i = 0; i < n; i++){
        string aux;
        cin >> aux;
        verdict[aux] += 1;
    }
    printf("AC x %d\nWA x %d\nTLE x %d\nRE x %d\n", verdict["AC"], verdict["WA"], verdict["TLE"], verdict["RE"]);
    return 0;
}

Measured memory_bytes: 3692
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef pair<ll, P> P3;
typedef pair<P ,P> PP;
constexpr ll MOD = ll(1e9) + 7;
constexpr int IINF = INT_MAX;
constexpr ll LLINF = LLONG_MAX;
constexpr int MAX_N = int(1e5) + 5;
constexpr double EPS = 1e-9;
constexpr int di[] = {0, 1, 0, -1}, dj[] = {1, 0, -1, 0};
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i > 0; i--)
#define SORT(v) sort((v).begin(), (v).end())
#define SORTR(v) sort((v).rbegin(), (v).rend())
#define ALL(v) (v).begin(), (v).end()

int main() {
    string s;
    cin >> s;
    bool ok = true;
    for(int i=0;i<3;i++){
        if(s[i]==s[i+1]) ok = false;
    }
    cout << (ok?"Good":"Bad") << endl;
    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for(ll i=0;i<n;i++)
using namespace std;
template<class T>bool chmax(T &a, const T &b) { if (b>a) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const long long INF = 2LL << 60;
using ll = long long;
using P = pair<ll, ll>;

int main(int argc, char const *argv[]) {
    ll n, ans=0;
    cin >> n;
    vector<ll> a(n);
    map<ll, ll> r;
    map<ll, ll> l;
    rep(i, n){
        cin >> a[i];
        r[a[i]+i]++;
        l[i-a[i]]++;
    }
    for(auto m: r){
        ll p = l[m.first];
        if(p>0){
            ans+=m.second*p;
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 38940
def main():
    MOD = 10**9 + 7
    N = int(input())
    n_10 = 1
    n_9 = 1
    n_8 = 1
    for _ in range(N):
        n_10 *= 10
        n_9 *= 9
        n_8 *= 8
        n_10 %= MOD
        n_9 %= MOD
        n_8 %= MOD
    print((2 * (n_10 - n_9) - (n_10 - n_8)) % MOD)


if __name__ == '__main__':
    main()

Measured memory_bytes: 9184
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int d, t, s;
  cin >> d >> t >> s;
 
  // 1.の出力
  if((t * s) < d) {
     cout << "No" << endl;
  } else {
     cout << "Yes" << endl;
  }

}

Measured memory_bytes: 3616
#include "bits/stdc++.h"
using namespace std;
#include "string"
#define int long long
#define pi pair <int, int>
#define ff first
#define ss second
#define boost ios::sync_with_stdio(false);cin.tie(nullptr)
#define endl '\n'

int32_t main() {
	boost;
	int n;
	cin >> n;
	vector < int > a(n), b(n);
	for(int &i : a)
		cin >> i;
	for(int &i : b)
		cin >> i;
	reverse(b.begin(), b.end());
	int l = 0, r = 0;
	for(int i = 0; i < n; i++) {
		if(a[i] != b[i])
			continue;
		l = i, r = i;
		while(r < n && a[r] == b[r])
			r++;
		break;
	}
	r--;

	for(int i = 0; i < n && l <= r; i++) {
		if(b[i] != a[l] && a[i] != b[l])
			swap(b[i], b[l++]);
	}
	if(l <= r) {
		cout << "No" << endl;
		return 0;
	}

	cout << "Yes" << endl;
	for(int &i : b)
		cout << i << ' ';
	cout << endl;
}

Measured memory_bytes: 6384
#include<iostream>
#include<vector>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<string>
#include<sstream>
#include<cmath>
#include<numeric>
#include<map>
#include<stack>
#include<queue>
#include<list>
#include<set>
#include<cstring>
using namespace std;
long long int mod = 1e9 + 7;
template <class T>
void inputV(vector<T> &x, int n){
  for(int i=0; i<n; i++) cin >> x[i];
}

int main() {
  int n; cin >> n;
  for(int i=n; i<1000; i++){
    string s = to_string(i);
    bool f = true;
    for(int j=0; j<s.size()-1; j++){
      if(s[j] != s[j+1]) f = false;
    }
    if(f){
      cout << i << endl;
      return 0;
    }
  }

  return 0;
}


//


Measured memory_bytes: 256
using System;
class AOJ{
public static  void Main(){
string[] st1=Console.ReadLine().Split(' ');
int a=int.Parse(st1[0]);
int b=int.Parse(st1[1]);
int[,] x=new int[a,b];
int[] y=new int[b];
for(int i=0;i<a;i++){
string[] st=Console.ReadLine().Split(' ');
for(int j=0;j<b;j++){
x[i,j]=int.Parse(st[j]);
}
}
for(int i=0;i<b;i++)
y[i]=int.Parse(Console.ReadLine());
int[] sum=new int[a];

for(int i=0;i<a;i++){
for(int j=0;j<b;j++){
sum[i]+=x[i,j]*y[j];
}
}
for(int i=0;i<a;i++)
Console.WriteLine(sum[i]);
}
}

Measured memory_bytes: 9208
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner teclado = new Scanner(System.in);

		int n, k;
		n = teclado.nextInt();
		k = teclado.nextInt();
		int cont =0;
		int a;
		if(k <= n && n <=50 && 1 <= k ) {
			for(int i=k-1; i <n ;i ++) {
				a=i+i+1;
				cont++;
			
			}
		}
		System.out.println(cont);

	}

}

Measured memory_bytes: 22868
#pragma GCC optimize("O2")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,tune=native")
#include<bits/stdc++.h>
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define pb push_back
using namespace std;
using ll = long long;
//using arr = array;
using pi = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vi>;
using vpi = vector<pi>;
using ld = long double;
const int maxn = 405, mod = 1e9 + 7;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int n, m;
vpi g[maxn];
int ok, vis[maxn];
void dfs(int v, int t) {
	vis[v] = 1;
	for(auto &i : g[v]) {
		if(i.second >= t) continue;
		if(vis[i.first]) ok = 0;
		if(ok) dfs(i.first, i.second);
	}
}
bool check(int u, int v) {
	memset(vis, 0, sizeof vis);ok = 1;
	dfs(u, 1<<30);
	if(ok) dfs(v, 1<<30);
	
	return ok;
}
int main() {
	cin.tie(0)->sync_with_stdio(0);
	cin >> n >> m;
	for(int f, t, i = 0; i < m; i++) {
		cin >> f >> t;
		g[f].pb({t, i});
		g[t].pb({f, i});
	}
	int ans = 0;
	for(int i = 1; i <= n; i++)
		for(int j = 1; j < i; j++)
			ans += check(i, j);
	cout << ans;
}


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

int main(){
  int N;
  string S, T;
  string res = "";
  cin >> N;
  cin >> S >> T;

  for(int i=0; i<N; i++){
    res += S[i];
    res += T[i];  
  }
  cout << res << endl;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
#include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include<queue>
#include<string>
#include<cmath>
#include<cstdint>
//#include<>
using namespace std;

typedef int64_t i64;typedef int32_t i32;
typedef int16_t i16;typedef int8_t i8;
typedef uint64_t ui64;typedef uint32_t ui32;
typedef uint16_t ui16;typedef uint8_t ui8;

typedef i32 int__;
#define rep(i,j) for(int__ i=0;i<j;i++)
#define repeat(i,j,k) for(int__ i=(j);i<(k);i++)
#define repeat_eq(i,j,k) for(int__ i=(j);i<=(k);i++)
#define all(v) begin(v),end(v)

const i32 INF=1<<30;//=10E10

class Path{

  public:
  struct Edge{i32 to,cost;Edge(i32 to_,i32 cost_):to(to_),cost(cost_){;}};


  vector< vector<Edge> > G;//接続リスト
  i32 V_num;
  i32 E_num;
  
  Path(i32 n){G.resize(n);V_num=n;E_num=0;}

  void add_arc(i32 x,i32 y,i32 c)
  {
    G[x].push_back(Edge(y,c));
    E_num+=1;
  }

  struct state{
    int index;
    int cost;
    state(int i,int c):index(i),cost(c){;}
    bool operator<(const state &r)const{return cost<r.cost;}
    bool operator>(const state &r)const{return cost>r.cost;}
      
  };
  
  i32 Prim(){
    i32 start=0;
    priority_queue< state ,vector<state>,greater<state> > que;
    vector<bool> used(G.size(),false);
    
    que.push(state(start,0));

    i32 ans=0,usednum=0;
    while(usednum!=G.size()){
      state now=que.top();que.pop();
      if(used[now.index])continue;
      used[now.index]=true;
      usednum+=1;
      ans+=now.cost;
      for(Edge e : G[now.index]){
	que.push(state(e.to,e.cost));	      
      }
    }
    return ans;
  }
  
  
};



int main()
{
  i32 v,e;cin>>v>>e;
  Path Graph(v);
  rep(i,e){
    i32 s,t,d;cin>>s>>t>>d;
    Graph.add_arc(s,t,d);
    Graph.add_arc(t,s,d);
  }
  cout<<Graph.Prim()<<endl;
  return 0;
}

Measured memory_bytes: 6040
#include <vector>
#include <map>
#include <iostream>

#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)

using namespace std;

typedef long long ll;
typedef pair<int,int> P;
const long long LINF = 1001002003004005006ll;
const int INF = 1001001001;
const int mod = 1000000007;

int main() {
  int n, m;
  cin >> n >> m;
  vector<int> ans(n, -1);

  for (int i = 0; i < m; i++) {
    int s, c;
    cin >> s >> c;
    s--;
    if (ans[s] == -1) {
      ans[s] = c;
    } else {
      if (ans[s] != c) {
        cout << -1 << endl;
        return 0;
      }
    }
  }

  if (n != 1 && ans[0] == 0) {
    cout << -1 << endl;
    return 0;
  }
  if (n == 1 && (ans[0] == 0 || ans[0] == -1) ) {
    cout << 0 << endl;
    return 0;
  }
  for (int i = 0; i < n; i++) {
    if (ans[i] == -1 && i == 0) {
      cout << 1;
    } else if (ans[i] == -1) {
      cout << 0;
    } else {
      cout << ans[i];
    }
  }
  cout << endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define all(vec) vec.begin(),vec.end()
typedef long long int ll;
typedef pair<ll,ll> P;
const ll MOD=1000000007;
const ll INF=1000000010;
const ll LINF=4000000000000000010LL;
const int MAX=310;
const double EPS=1e-9;
int dx[4]={0,1,0,-1};
int dy[4]={1,0,-1,0};
int main(){
    int w;cin>>w;cout<<w*32<<endl;
    return 0;
}



Measured memory_bytes: 3072
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
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 (b<a) { a=b; return 1; } return 0; }
const ll INF=1LL<<60;
const int inf=1<<30;
const int mod=1e9+7;
const int MOD=998244353;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int h,w;cin >> h >> w;
    int u[h][w]={},d[h][w]={},l[h][w]={},r[h][w]={};
    char c[h][w];
    for(int i=0;i<h;i++){
        for(int j=0;j<w;j++){
            cin >> c[i][j];
            if(c[i][j]=='.'){
                u[i][j]=d[i][j]=l[i][j]=r[i][j]=1;
            }
        }
    }
    for(int i=0;i<h;i++){
        for(int j=1;j<w;j++){
            if(c[i][j]=='.'){
                l[i][j]=l[i][j-1]+1;
            }
        }
        for(int j=w-2;j>=0;j--){
            if(c[i][j]=='.'){
                r[i][j]=r[i][j+1]+1;
            }
        }
    }
    for(int j=0;j<w;j++){
        for(int i=1;i<h;i++){
            if(c[i][j]=='.'){
                u[i][j]=u[i-1][j]+1;
            }
        }
        for(int i=h-2;i>=0;i--){
            if(c[i][j]=='.'){
                d[i][j]=d[i+1][j]+1;
            }
        }
    }
    int ans=0;
    for(int i=0;i<h;i++){
        for(int j=0;j<w;j++){
            chmax(ans,u[i][j]+d[i][j]+l[i][j]+r[i][j]-3);
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 66688
n,k = [int(j) for j in input().split()]
l = [int(j) for j in input().split()]
dp = {0:False}
for j in range(1,k+1):
    flag  =True
    for i in l:
        if j-i>-1:
            if not dp[j-i]:
                dp[j] = True
                flag =False
                break
    if flag:
        dp[j] = False
if dp[k]:
    print("First")
else:
    print("Second")    

Measured memory_bytes: 51804
#include <set>
#include <iostream>
#include <vector>

int main() {
    long long n;
    std::cin >> n;
    std::vector<long long> p_to_i(n+1);
    for (long long i = 0; i < n; ++i) {
        long long p;
        std::cin >> p;
        p_to_i[p] = i;
    }
    std::set<long long> indices;
    for (long long i = 0; i < n; ++i) {
        indices.insert(i);
    }
    long long ans = 0;
    for (long long p = 1; p < n; ++p) {
        long long i = p_to_i[p];
        const auto it = indices.find(i);
        auto next = std::next(it);
        if (it == indices.begin()) {
            long long r1 = *next;
            long long r2 = (std::next(next) == indices.end()) ? n : *std::next(next);
            ans += p * (r2-r1) * (i+1);
        } else if (std::next(it) == indices.end()) {
            auto prev = std::prev(it);
            long long l1 = *prev;
            long long l2 = (prev == indices.begin()) ? -1 : *std::prev(prev);
            ans += p * (l1-l2) * (n-i);
        } else {
            auto next = std::next(it);
            auto prev = std::prev(it);
            auto l1 = *prev;
            auto r1 = *next;
            long long l2 = (prev == indices.begin()) ? -1 : *std::prev(prev);
            long long r2 = (std::next(next) == indices.end()) ? n : *std::next(next);
            ans += p * ((l1-l2) * (r1-i) + (i-l1) * (r2-r1));
        }

        indices.erase(i);
    }
    std::cout << ans << std::endl;
}


Measured memory_bytes: 5760
#include <bits/stdc++.h>
using namespace std;
typedef signed long long ll;

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

ll N,A,B,K;
ll mo=998244353;

ll combi(ll N_, ll C_) {
	const int NUM_=400001;
	static ll fact[NUM_+1],factr[NUM_+1],inv[NUM_+1];
	if (fact[0]==0) {
		inv[1]=fact[0]=factr[0]=1;
		for (int i=2;i<=NUM_;++i) inv[i] = inv[mo % i] * (mo - mo / i) % mo;
		for (int i=1;i<=NUM_;++i) fact[i]=fact[i-1]*i%mo, factr[i]=factr[i-1]*inv[i]%mo;
	}
	if(C_<0 || C_>N_) return 0;
	return factr[C_]*fact[N_]%mo*factr[N_-C_]%mo;
}


void solve() {
	int i,j,k,l,r,x,y; string s;

	cin>>N>>A>>B>>K;
	ll ret=0;
	for(ll a=0;a<=N;a++) {
		ll left=K-a*A;
		if(left<0) continue;
		if(left%B) continue;
		ll b=left/B;
		if(b>N) continue;
		(ret+=combi(N,a)*combi(N,b))%=mo;;
		
	}
	cout<<ret<<endl;

}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	cout.tie(0); solve(); return 0;
}


Measured memory_bytes: 9600
#include<iostream>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<map>
using namespace std;
int main() {
  int n,m;
  cin >> n >> m;
  char a[50][50]={},b[50][50]={};
  for(int i=0; i<n; i++) {
    for(int j=0; j<n; j++) {
      cin >> a[i][j];
    }
  }
  for(int i=0; i<m; i++) {
    for(int j=0; j<m; j++) {
      cin >> b[i][j];
    }
  }
  for(int i=0; i<n-m+1; i++) {
    for(int j=0; j<n-m+1; j++) {
      int cnt=0;
      for(int k=0; k<m; k++) {
        for(int l=0; l<m; l++) {
          if(a[i+k][j+l]==b[k][l]) {
            cnt++;
          }
        }
      }
      if(cnt==m*m) {
        cout << "Yes" << endl;
        return 0;
      }
    }
  }
  cout << "No" << endl;
}

Measured memory_bytes: 256
#pragma GCC optimize ("-O3","unroll-loops")
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include<iterator>
#include<complex>
#include<stack>
#include<unordered_map>
#include<unordered_set>
#include<time.h>
#include <random>

using namespace std;

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define REVERSE(v,n) reverse(v,v+n);
#define VREVERSE(v) reverse(v.begin(), v.end());
#define ll long long
#define pb(a) push_back(a)
#define print(x) cout<<x<<'\n';
#define pe(x) cout<<x<<" ";
#define lb(v,n) lower_bound(v.begin(), v.end(), n);
#define ub(v,n) upper_bound(v.begin(), v.end(), n);
#define int long long
#define all(x) (x).begin(), (x).end()
#define print_space(v) REP(i,v.size())cout << v[i] << ((i == v.size() - 1) ? "\n" : " ");
//#define double long double



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

const int MOD = 998244353;
const ll INF = 1e17;
const int INT_INF = 1e9;
const double pi = acos(-1);
const double EPS = 1e-10;
typedef pair<int, int>P;
const int MAX = 200020;

int siz[MAX];//錬結成分のサイズ
int par[MAX];//親
int Rank[MAX];//木の深さ

//n要素で初期化
void init(int n) {
	REP(i, n) {
		par[i] = i;
		Rank[i] = 0;
		siz[i] = 1;
	}
}

//木の根を求める
int find(int x) {
	if (par[x] == x) {
		return x;
	}
	else {
		return par[x] = find(par[x]);//経路圧縮(根に直接つなぎなおす)もしつつ
	}
}

//xとyの属する集合を併合
void unite(int x, int y) {
	x = find(x);
	y = find(y);
	if (x == y)return;
	//低いほうを高いほうにつなげる(効率化)
	if (Rank[x] < Rank[y]) {
		par[x] = y;
		siz[x] += siz[y];
		siz[y] = siz[x];
	}
	else {
		siz[y] += siz[x];
		siz[x] = siz[y];
		par[y] = x;
		if (Rank[x] == Rank[y])Rank[x]++;
	}
}

//xとyが同じ集合に属するか否か
bool same(int x, int y) {
	return find(x) == find(y);
}

bool used[200020];
vector<int>X, Y;
signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);

	int N, M, Q; cin >> N >> M >> Q;
	bool other = 0;
	init(N);
	REP(i, Q) {
		int A, B, C; cin >> A >> B >> C;
		if (C) {
			other = true;
			X.pb(A); Y.pb(B);
		}
		else {
			unite(A, B);
		}
	}
	bool ok = true;
	REP(i, X.size()) {
		if (same(X[i], Y[i])) {
			print("No");
			return 0;
		}
	}
	unordered_set<int>st;
	int K = 0;//連結成分数
	REP(i, N) {
		int pare = find(i);
		if (st.find(pare) == st.end()) {
			K++;
			st.insert(pare);
		}
	}
	if (K <= 2) {
		if ((!other) && (M == N - 1)) {
			print("Yes");
		}
		else print("No");
	}
	else {
		if (!other) {
			if (N - 1 <= M && M <= (N - K) + K * (K - 1) / 2) {
				print("Yes");
			}
			else print("No");
		}
		else {
			if (N <= M && M <= (N - K) + K * (K - 1) / 2)print("Yes")
			else print("No");
		}
	}
}


Measured memory_bytes: 9068
//Author : Gaara

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

#define ll long long
#define pb push_back
#define endl "\n"
#define fo(i,n) for(ll i=0;i<n;i++)
#define ro(i,n) for(ll j=n-1;i>=0;i--)
#define vll vector<long long>

int main(){
    int t=1;
    //cin>>t;
    while(t--){
	  string s,t;
      cin>>s>>t;
      int ls = s.length(), lt = t.length(), ans = INT_MAX;
      fo(i,ls-lt+1){
        int x=0;
        fo(j,lt){
          if(s[i+j]!=t[j]) x++;
        }
        ans=min(ans,x);
      }
      cout<<ans<<endl;
    }
    return 0;
}

Measured memory_bytes: 3636
#include <stdio.h>
#define MAX 250
int main(){
  int n,i;
  int A[MAX];
  scanf("%d",&n);
  
  for(i=1;i<=n;i++) {
    scanf("%d",&A[i]);
  }

  for(i=1;i<=n;i++) {
        printf("node %d: key = %d, ", i, A[i]);
        if(i != 1) printf("parent key = %d, ", A[i/2]);
        if(i*2 <= n) printf("left key = %d, ", A[i*2]);
        if(i*2+1 <= n) printf("right key = %d, ", A[i*2+1]);
        printf("\n");
    }
    return 0;
}

Measured memory_bytes: 600
#include <stdio.h>

int main(){

  int n,i,a,b,c;

  scanf("%d",&n);

  for(i=0;i<n;i++){
    scanf("%d %d %d",&a,&b,&c);
    if(a>b && a>c){
      if(a*a==b*b+c*c){
        printf("YES\n");
      }else{
        printf("NO\n");
      }
    }else if(b>a && b>c){
      if(b*b==a*a+c*c){
        printf("YES\n");
      }else{
        printf("NO\n");
      }
    }else{
      if(c*c==a*a+b*b){
        printf("YES\n");
      }else{
        printf("NO\n");
      }
    }
  }
  return 0;
}


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

long long n;
vector<vector<int>> tree(10010,vector<int>(0));
vector<long long>data(10010,0);
vector<long long>dataout(10010,0);
vector<bool> flag(10010);

void bfs(int x)
{
    if(data.size()==0)return;
    flag.at(x)=1;
    REP(i,tree.at(x).size())
    {
        if(flag.at(tree.at(x).at(i))==1)continue;
        dataout.at(tree.at(x).at(i))=data.at(data.size()-1);
        data.pop_back();
    }

    REP(i,tree.at(x).size())
    {
        if(flag.at(tree.at(x).at(i))==1)continue;
        bfs(tree.at(x).at(i));
    }
}

int main()
{
    cin>>n;
    tree.resize(n);data.resize(n);dataout.resize(n);flag.resize(n);
    REP(i,n-1)
    {
        int a,b;
        cin>>a>>b;
        tree.at(a-1).push_back(b-1);
        tree.at(b-1).push_back(a-1);
    }

    long long sum=0;
    REP(i,n)
    {
        cin>>data.at(i);
        sum+=data.at(i);
    }
    sort(data.begin(),data.end());
    cout<<sum-data.at(data.size()-1)<<endl;

    dataout.at(0)=data.at(data.size()-1);
    data.pop_back();
    bfs(0);

    REP(i,n)
    {
        cout<<dataout.at(i)<<" ";
    }
    cout<<endl;
}

Measured memory_bytes: 2432
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stdio.h>
#include <map>
#include <math.h>
#include <queue>
#define INF 10000000
using namespace std;
int main() {

	int h, w; cin >> h >> w;
	char m[25][25];
	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) {
			cin >> m[i][j];
		}
	}

	int ans = 0;

	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) {
			if (m[i][j] == '#') { continue; }

			vector<vector<int>> dist(h, vector<int>(w, INF));
		    queue<pair<int, int>> q;

			auto update = [&](int tate, int yoko, int kyori) {
				if (dist[tate][yoko] != INF) { return; }
				dist[tate][yoko] = kyori;
				q.push(pair<int,int>(tate, yoko));
			};

			update(i, j, 0);
			int di[4] = { -1,0,1,0 };
			int dj[4] = { 0,-1,0,1 };


			while (!q.empty()) {
				int ta = q.front().first;
				int yo = q.front().second; q.pop();

				for (int rin = 0; rin < 4; rin++) {
					int nta = ta + di[rin], nyo = yo + dj[rin];
					if (nta < 0 || nta >= h || nyo < 0 || nyo >= w) { continue; }
					if (m[nta][nyo] == '#') { continue; }
					update(nta, nyo, dist[ta][yo] + 1);
				}
			
			}

			for (int ii = 0; ii < h; ii++) {
				for (int jj = 0; jj < w; jj++) {
					//cout << dist[ii][jj] << " ";
					if (dist[ii][jj] == INF) { continue; }
					ans = max(ans, dist[ii][jj]);
				}
				//cout << endl;
			}

			//cout << endl;

		}
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;    
typedef long long Int;

#define SEG_LEN (1 << 18)

int seg[SEG_LEN * 2];
Int update_val[1100000];

Int get(int ind){
    ind += SEG_LEN;
    int last_update = seg[ind];
    while(true){
        ind /= 2;
        if(ind == 0)break;
        last_update = max(last_update, seg[ind]);
    }
    return update_val[last_update];
}

void update(int l, int r, int time, Int val){
    update_val[time] = val;
    l += SEG_LEN;
    r += SEG_LEN;
    int ans = 0;
    while(l < r){
        if(l % 2 == 1){
            seg[l] = time;
            l++;
        }
        l /= 2;
        if(r % 2 == 1){
            seg[r-1] = time;
            ans += seg[r-1];
            r--;
        }
        r /= 2;
    }
}

int main(){
    int n, q, s, t, x, ind, com;
    cin >> n >> q;
    update(0, n, 0, (1LL<<31) - 1LL);
    for(int i = 0;i < q;i++){
        cin >> com;
        if(com == 0){//add
            cin >> s >> t >> x;
            update(s, t+1, i+1, x);
        }
        if(com == 1){//get sum
            cin >> ind;
            cout << get(ind) << endl;
        }
    }
    return 0;
}


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

ll Pow(ll x, ll n, ll mod){
  if(n == 0) return 1;
  if(n % 2 == 0) return Pow(x*x % mod,n/2,mod);
  else return x * Pow(x,n-1,mod) % mod;
}

void extgcd(ll a, ll b, ll &x, ll &y) {
  if(b == 0) {
    x = 1;
    y = 0;
    return;
  }
  extgcd(b, a%b, y, x);
  y -= a/b*x;
  return; 
}

ll mod_inverse(ll a, ll m) {
  ll x, y;
  extgcd(a,m,x,y);
  return (m + x % m) % m;
}

int main(){
  ll n, mod;
  cin >> n >> mod;
  string s;
  cin >> s;
  ll ans = 0;
  if(mod == 2) {
    rep(i,n) {
      if((s[i]-'0') % 2 == 0) ans += i+1;
    }
    cout << ans << endl;
    return 0;
  } else if(mod == 5) {
    rep(i,n) {
      if(s[i] == '5' || s[i] == '0') ans += i+1;
    }
    cout << ans << endl;
    return 0;
  }
  map<ll,ll> m;
  vector<ll> v(n+1);
  v[0] = 0;
  m[0]++;
  rep(i,n) {
    v[i+1] = (v[i]*10 + (s[i]-'0')) % mod;
    ll p = mod_inverse(Pow(10,i+1,mod),mod);
    ll c = (v[i+1]*p) % mod;
    ans += m[c];
    m[c]++;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 2564
#include <limits.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>

// 内部定数
#define D_CHAR_KIND		5										// 文字種類

// 内部変数
static long long sl1Cnt[D_CHAR_KIND];							// 各文字毎の人数
static long long slSum;											// 合計

// 内部変数 - テスト用
#ifdef D_TEST
	static int siRes;
	static FILE *szpFpT, *szpFpA;
#endif

// 実行メイン
int
fMain(
	int piTNo					// <I> テスト番号 1～
)
{
	int i, j, k;
	char lc1Buf[1024], lc1Out[1024];

	// データ初期化
	memset(sl1Cnt, 0, sizeof(sl1Cnt));							// 各文字毎の人数
	slSum = 0;													// 合計

	// テストファイルオープン
#ifdef D_TEST
	sprintf(lc1Buf, ".\\Test\\T%d.txt", piTNo);
	szpFpT = fopen(lc1Buf, "r");
	sprintf(lc1Buf, ".\\Test\\A%d.txt", piTNo);
	szpFpA = fopen(lc1Buf, "r");
	siRes = 0;
#endif

	// 人数取得
	int liHCnt;
#ifdef D_TEST
	fgets(lc1Buf, sizeof(lc1Buf), szpFpT);
#else
	fgets(lc1Buf, sizeof(lc1Buf), stdin);
#endif
	sscanf(lc1Buf, "%d", &liHCnt);

	// 各文字毎の人数セット
	for (i = 0; i < liHCnt; i++) {
#ifdef D_TEST
		fgets(lc1Buf, sizeof(lc1Buf), szpFpT);
#else
		fgets(lc1Buf, sizeof(lc1Buf), stdin);
#endif

		switch (lc1Buf[0]) {
			case 'M':	sl1Cnt[0]++;	break;
			case 'A':	sl1Cnt[1]++;	break;
			case 'R':	sl1Cnt[2]++;	break;
			case 'C':	sl1Cnt[3]++;	break;
			case 'H':	sl1Cnt[4]++;	break;
		}
	}

	// 合計セット
	for (i = 0; i < D_CHAR_KIND; i++) {
		for (j = i + 1; j < D_CHAR_KIND; j++) {
			for (k = j + 1; k < D_CHAR_KIND; k++) {
				slSum += sl1Cnt[i] * sl1Cnt[j] * sl1Cnt[k];
			}
		}
	}

	// 結果セット
	sprintf(lc1Out, "%lld\n", slSum);

	// 結果表示
#ifdef D_TEST
	fgets(lc1Buf, sizeof(lc1Buf), szpFpA);
	if (strcmp(lc1Buf, lc1Out)) {
		siRes = -1;
	}
#else
	printf("%s", lc1Out);
#endif

	// テストファイルクローズ
#ifdef D_TEST
	fclose(szpFpT);
	fclose(szpFpA);
#endif

	// テスト結果
#ifdef D_TEST
	if (siRes == 0) {
		printf("OK %d\n", piTNo);
	}
	else {
		printf("NG %d\n", piTNo);
	}
#endif

	return 0;
}

int
main()
{

#ifdef D_TEST
	int i;
	for (i = D_TEST_SNO; i <= D_TEST_ENO; i++) {
		fMain(i);
	}
#else
	fMain(0);
#endif

	return 0;
}



Measured memory_bytes: 128
A1=list(map(int,input().split()))
A2=list(map(int,input().split()))
A3=list(map(int,input().split()))
N=int(input())
b=[int(input()) for _ in range(N)]

A = [A1,A2,A3]

def check_bingo(l):
    if l[0][0] == l[0][1] == l[0][2]:print('Yes')
    elif l[1][0] == l[1][1] == l[1][2]:print('Yes')
    elif l[2][0] == l[2][1] == l[2][2]:print('Yes')
    elif l[0][0] == l[1][0] == l[2][0]:print('Yes')
    elif l[0][1] == l[1][1] == l[2][1]:print('Yes')
    elif l[0][2] == l[1][2] == l[2][2]:print('Yes')
    elif l[0][0] == l[1][1] == l[2][2]:print('Yes')
    elif l[0][2] == l[1][1] == l[2][0]:print('Yes')  
    else: print('No')

if __name__ == "__main__":
    for i in b:
        for y,row in enumerate(A):
            try:
                A[y][row.index(i)] = -1
                break
            except ValueError:
                continue
    check_bingo(A)

Measured memory_bytes: 3064
#include <iostream>
#include <complex>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <numeric>
#include <cstring>
#include <ctime>
#include <cstdlib>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <cmath>
#include <bitset>
#include <cassert>
#include <queue>
#include <stack>
#include <deque>
#include <random>
typedef long long int ll;
typedef long double ld;
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
const int MOD=1000000007;
const int MAX_N=500010;

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

int main(){
    ll n,k,ans=0;
    cin>>n>>k;
    vector<ll> g(k+2);
    for(ll m=k;m>=1;m--){
        ll kata=1;
        while(m*(kata+1)<=k) kata++;
        g[m]=modpow(kata,n,MOD)%MOD;
        for(ll i=2;m*i<=k;i++){
            g[m]-=g[m*i];
            g[m]%=MOD;
        }
    }
    for(int i=1;i<=k;i++){
        //cout<<i<<" "<<g[i]<<endl;
        ans+=i*g[i];
        ans%=MOD;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3940
N = int(input())
H = list(map(lambda x: int(x),input().split()))

maxDown = 0
currentDown = 0

for i in range(len(H)-1):
    if H[i]-H[i+1]>=0:
        currentDown += 1
    else:
        maxDown = max(maxDown,currentDown)
        currentDown = 0
    if i == len(H)-2:
        maxDown = max(maxDown,currentDown)
      
    

print(maxDown)
    

Measured memory_bytes: 14224
N, M = (int(i) for i in input().split())
L = [0] * M
for i in range(N):
    A = [int(i) for i in input().split()]
    A = A[1:]
    for a in A:
        L[a-1] += 1
aa = 0
for l in L:
    if l == N:
        aa += 1
print(aa)

Measured memory_bytes: 3060
n = int(input())
 
T_s = 0
H_s = 0
 
for i in range(n):
    animals = input().split()
    T_a = animals[0]
    H_a = animals[1]
    if T_a < H_a:
        H_s += 3
    elif T_a > H_a:
        T_s += 3
    else:
        T_s += 1
        H_s += 1
 
print(T_s, H_s)

Measured memory_bytes: 7616
/*input

*/
#include<bits/stdc++.h>
//priority_queue<ll, vector<ll>, std::greater<ll> > q;
//gcc 1.cpp -lstdc++ -o main.o
#define ull                 unsigned long long
#define ll                         long long
#define M                         1000000007
#define pb                         emplace_back
#define p_q                 priority_queue
#define pii         pair<ll,ll>
#define vi          vector<ll>
#define vii         vector<pii>
#define mi          map<ll,ll>
#define all(a)      (a).begin(),(a).end()
#define gcd(a,b)    __gcd((a),(b))
#define lcm(a,b)    ((a)*(b))/gcd((a),(b))
#define ios                    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define mp                         make_pair
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define F first
#define S second
#define N 200005
using namespace std;


int main(void)
{
        ios
        ll n;
        cin>>n;
        vi v(n);
        rep(i,0,n)
                cin>>v[i];
        ll ans = 0;
        rep(i,0,n)
                ans = ans^v[i];
        //vi w;
        ll t1;
        rep(i,0,n){
                t1 = ans^v[i];
                //w.pb(t1);
                cout<<t1<<" ";
        }

}

Measured memory_bytes: 4788
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <fstream>
#include <cassert>
#include <cstring>
#include <unordered_set>
#include <unordered_map>
#include <numeric>
#include <ctime>
#include <bitset>
#include <complex>
#include <chrono>
#include <random>
#include <functional>

using namespace std;

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

	int x, y;
	cin >> x >> y;
	int ans = 0;
	ans += max(0, 4 - x);
	ans += max(0, 4 - y);
	ans += 4 * (x == 1 && y == 1);
	cout << ans * (100000) << endl;
}

Measured memory_bytes: 3156
#include <bits/stdc++.h>
using namespace std;
struct ios_accelerate { ios_accelerate() { ios::sync_with_stdio(false); cin.tie(nullptr); } } CALL;

#define REP(i, n) for(auto (i) = (n)*0; (i) < (n); (i)++)
#define RNG(i, a, b) for(auto (i) = (a); (i) < (b); (i)++)
#define RBF(i, v) for(auto& (i) : (v))
#define ALL(x) (x).begin(), (x).end()

using LL = long long;
using UL = unsigned long;
using ULL = unsigned long long;
template<typename T> using V = vector<T>;
template<typename T> using VV = vector<vector<T>>;
template<typename T> using P = pair<T, T>;

const double PI = 3.141592653589793;
const int MOD = 1000000007;
const LL INF64 = static_cast<LL>(1e18) + 2;
const int INF = static_cast<int>(1e9) + 2;

template<typename T> inline void upsort(vector<T>& x) { sort(x.begin(), x.end()); }
template<typename T> inline void downsort(vector<T>& x) { sort(x.begin(), x.end(), greater<T>()); }
template<typename T> inline void col(T x) { cout << x << '\n'; }
template<> inline void col(double x) { cout << fixed << setprecision(12) << x << '\n'; }

signed main() {
	int a, b, c;
	cin >> a >> b >> c;

	set<int> s;
	s.insert(a);
	s.insert(b);
	s.insert(c);

	if (s.size() == 2) {
		col("Yes");
	}
	else {
		col("No");
	}

	return 0;
}


Measured memory_bytes: 3592