akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;


//TEMPLATE
#define pb                push_back
#define mp                make_pair
#define ll                long long
#define ld                long double
#define pii               pair <ll, ll>
#define piii              pair <ll, pii>
#define F                 first
#define S                 second

#define newline           printf("\n")
#define minusone          printf("-1\n")
#define zeroo             printf("0\n")
#define scl1(a)           scanf("%lld", &a)
#define scl2(a, b)        scanf("%lld %lld", &a, &b)
#define scl3(a, b, c)     scanf("%lld %lld %lld", &a, &b, &c)
#define prl1(a)           printf("%lld\n", a)
#define prl2(a, b)        printf("%lld %lld\n", a, b)
#define ssl1(s)           scanf(" %[^\n]", s)
#define scd1(a)           scanf("%lf", &a)
#define scd2(a, b)        scanf("%lf %lf", &a, &b)
#define prd(a)            printf("%lf\n", a)
#define prld(a)           printf("%Lf\n", a)
#define prcase(cs)        printf("Case %lld: ", cs)
#define cin1(a)           cin >> a
#define cin2(a, b)        cin >> a >> b
#define cin3(a, b, c)     cin >> a >> b >> c
#define cin4(a, b, c, d)  cin >> a >> b >> c >> d
#define cot1(a)           cout << a << "\n"
#define cot2(a, b)        cout << a << " " << b << "\n"
#define cot3(a, b, c)     cout << a << " " << b << " " << c << "\n"
#define cot4(a, b, c, d)  cout << a << " " << b << " " << c << " " << d << "\n"
#define cotline           cout << "\n"
#define cotminus          cout << "-1\n"
#define cot0              cout << "0\n"
#define cotyes            cout << "YES\n"
#define cotno             cout << "NO\n"
#define cotcase(cs)       cout << "Case " << cs << ": "

#define reversed(s)       reverse(s.begin(), s.end())
#define asort(s)          sort(s.begin(), s.end())
#define dsort(s)          sort(s.rbegin(), s.rend())
#define all(s)            s.begin(), s.end()
#define uniq(s)           s.resize(distance(s.begin(),unique(s.begin(), s.end())))
#define found(s, x)       (s.find(x) != s.end())

#define for0(i, n)        for (i = 0; i < n; i++)
#define for1(i, n)        for (i = 1; i <= n; i++)
#define fora(i, a, b)     for (i = a; i <= b; i++)
#define forb(i, b, a)     for (i = b; i >= a; i--)
#define fori(it, s)       for(auto it = s.begin(); it != s.end(); it++)

#define FR                ios_base::sync_with_stdio(false);cin.tie(NULL)
#define ms(a, x)          memset(a, x, sizeof a)
#define bitcount(n)       __builtin_popcountll(n)

//#define pi              3.1415926536
#define pi                acos(-1)

const ll INF = LLONG_MAX;
const ll SZ = 4e5+5;
const ll mod = 1e9+7;


ll n;
//ll a[SZ];
//ll b[SZ];
vector <ll> adj[SZ];
bool vis[SZ];

void dfs(ll u) {
    if(vis[u]) return;
    vis[u] = 1;

    for(auto v: adj[u]) {
        dfs(v);
    }
}

int main() {
    ll cs = 0, tc = 1, x, y, z, i, j, k, g, p, q, ans = 0, sum = 0, c = 0, t = 0;
    //    ll a, b, d;
    string s, s1, s2;

    cin2(n, q);

    while(q--) {
        cin3(x, y, z);
        adj[x].pb(y);
        adj[y].pb(x);
    }

    for1(i, n) {
        if(!vis[i]) {
            c++;
            dfs(i);
        }
    }

    cot1(c);

    return 0;
}



Measured memory_bytes: 19308
#pragma warning disable

using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.Serialization.Formatters.Binary;
using System.Text;
using System.Text.RegularExpressions;
using System.Diagnostics;
using System.Numerics;
using System.Collections;

static class MainClass
{
    public static void Main(string[] args)
    {
        var N = Console.ReadLine().ToInt32();

        BigInteger max = 0;
        for (int i = 0; i < Math.Sqrt(N) + 10; i++)
        {
            if (i * i <= N)
            {
                max = i * i;
            }
        }
        Console.WriteLine(max);
        Console.ReadLine();
    }
    

    #region ライブラリ
    public static long ToInt64(this string str) => long.Parse(str);
    public static int ToInt32(this string str) => int.Parse(str);
    public static BigInteger ToBigInteger(this string str) => BigInteger.Parse(str);
    public static List<string> SplittedStringToList(this string str) => str.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).ToList();
    public static List<int> SplittedStringToInt32List(this string str) => str.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Select(x => int.Parse(x)).ToList();
    public static List<long> SplittedStringToInt64List(this string str) => str.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Select(x => long.Parse(x)).ToList();
    public static List<BigInteger> SplittedStringToBigInteger(this string str) => str.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Select(x => BigInteger.Parse(x)).ToList();
    public const int INF = int.MaxValue / 2;
    public const long LONGINF = long.MaxValue / 2;

  
  

    public static void PrintArray(int[,] array)
    {
        for (int i = 0; i < array.GetLength(0); i++)
        {
            var sb = new StringBuilder();
            for (int j = 0; j < array.GetLength(1); j++)
            {
                sb.Append(array[i, j]).Append(" ");
            }
            Console.WriteLine(sb.ToString());
        }
    }

    #endregion
}



Measured memory_bytes: 13396
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#define max 1000000007
using namespace std;
int main(void){
    int N;
    cin >> N;
    vector<int>A(N);
    vector<int>k(N);
    for(int i=0;i<N;i++){
        cin >> A[i];
        k[i]=0;
    }
    int ans=1;
    bool odd;
    if(N%2==1)odd=true;
    else odd=false;
    for(int i=0;i<N;i++){
        if(odd){
            if(A[i]%2==1){
                cout << 0 << "\n";
                return 0;
            }
        }
        else{
            if(A[i]%2==0){
                cout << 0 << "\n";
                return 0;
            }
        }
    }
    if(N==1){
        if(A[0]!=0){
            cout << 0 << "\n";
            return 0;
        }
        else{
            cout << 1 << "\n";
            return 0;
        }
    }
    if(!odd){
        for(int i=0;i<N;i++){
            k[A[i]]++;
        }
        for(int i=0;i<(N/2);i++){
            if(k[2*i+1]!=2){
                cout << 0 << "\n";
                return 0;
            }
            else{
                for(int i=0;i<N/2;i++){
                    ans = ans*2%max;
                }
                cout << ans <<"\n";
                return 0;
            }
        }
    }
    else{
        for(int i=0;i<N;i++){
            k[A[i]]++;
        }
        for(int i=1;i<((N-1)/2);i++){
            if(k[2*i]!=2||k[0]!=1){
                cout << 0 << "\n";
                return 0;
            }
            else{
                for(int i=0;i<(N-1)/2;i++){
                    ans = ans*2%max;
                }
                cout << ans <<"\n";
                return 0;
            }
        }
    }
}

Measured memory_bytes: 1024
N=int(input())
S=input()
r,g,b=[0]*(N+1),[0]*(N+1),[0]*(N+1)
for x,c in ((r,'R'),(g,'G'),(b,'B')):
    for i in range(N):
        x[i+1]=x[i]+(1 if S[i]==c else 0)
a=0
for i in range(1,N-1):
    for j in range(i+1,N):
        for x,c in ((r,'R'),(g,'G'),(b,'B')):
            if S[i-1]!=S[j-1] and c not in (S[i-1],S[j-1]):
                a+=x[N]-x[j]-(x[2*j-i]-x[2*j-i-1] if 2*j-i<N+1 else 0)
print(a)

Measured memory_bytes: 68496
using System;

namespace A
{
    class Program
    {
        static void Main(string[] args)
        {
            int N = Convert.ToInt32(Console.ReadLine());
            if (N % 2 == 0)
            {
                Console.WriteLine(N);
            }
            else
            {
                Console.WriteLine(N * 2);
            }
        }
    }
}


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

//typedefs
typedef long long LL;
typedef vector < int > VI;
typedef vector < LL > VL;
typedef vector < VI > VVI;
typedef vector < VL > VVL;
typedef pair < int, int > PII;
typedef pair < double, double > PDD;
typedef pair < LL, LL > PLL;
typedef vector < PII > VII;
typedef vector < PLL > VLL;

//#Defines
#define pb push_back
// #define pb emplace_back
#define F first
#define S second
//#define mp make_pair
#define all(c)		c.begin(), c.end()
#define rev(c)      c.rbegin(), c.rend()
#define endl '\n'
#define pf printf
#define sf scanf
#define MOD 1000000007
//#define harmonic(n) 0.57721566490153286l+log(n)
//if harmonic numbers need to be calculated, precalculate upto 1e6, then for any x > 1e6
//call harmonic(x + 0.5)
#define RESET(a, b)	memset(a, b, sizeof(a))
#define sqr(a) ((a) * (a))
#define optimize() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

int dx[] = {1,1,0,-1,-1,-1, 0, 1}; // trick to explore an implicit 2D grid
int dy[] = {0,1,1, 1, 0,-1,-1,-1};  // S,SE,E,NE,N,NW,W,SW neighbors

// int dx[] = {1, 0, -1, 0}; // trick to explore an implicit 2D grid
// int dy[] = {0, 1, 0, -1};  // S,E,N,W neighbors

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

const double PI = acos(-1);
const double eps = 1e-9;
const int inf = 2000000000;
const LL infLL = 9000000000000000000;

/************************************* END OF TEMPLATE *************************************/

int main()
{
    #ifndef ONLINE_JUDGE
        freopen ("in.txt", "r", stdin);
        freopen ("out.txt", "w", stdout);
    #endif
    // optimize();

    string a, b;    cin >> a >> b;
    int size = a.size() - b.size();
    int b_size = b.size();
    int ans = 0;
    for (int i = 0; i <= size; i++) {
        string temp = a.substr(i, b_size);
        // cout << temp << endl;
        int count = 0;
        for (int i = 0; i < b_size; i++) {
            if (temp[i] == b[i]) count++;
        }
        ans = max (ans, count);
    }
    cout << b_size - ans << endl;
    return 0;
}

Measured memory_bytes: 3640
N, K = map(int, input().split())
mod = 998244353
L = [list(map(int, input().split())) for _ in range(K)]
D = {1: -1}
dp = [0 for _ in range(N)]
dp[0] = 1
for i in range(K):
    if L[i][0] in D:
        D[L[i][0]] -= 1
    else:
        D[L[i][0]] = -1
    if L[i][1]+1 in D:
        D[L[i][1]+1] += 1
    else:
        D[L[i][1]+1] = 1
dp[1] = -D[1] - 1
for i in range(2, N):
    for j in D:
        if i >= j:
            dp[i] += (-D[j]) * dp[i-j]
            dp[i] %= mod
print(dp[N-1])

Measured memory_bytes: 81080
using System;
using static System.Console;
using static System.Int32;
using System.Linq;

class Solution
{
    static void Main()
    {
        var sp = ReadLine().Split();
        int n = Parse(sp[0]);
        var q = Parse(sp[2]);
        var ary = Enumerable.Repeat(Parse(sp[1]) - q, n).ToArray();
        for(int i = 0; i < q; ++i)
        {
            ++ary[Parse(ReadLine()) - 1];
        }
        foreach(var i in ary)
        {
            WriteLine((0 < i) ? "Yes" : "No");
        }
    }
}


Measured memory_bytes: 17700
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
#define fi first
#define se second
typedef pair<ll,ll> P;
#define Mod 1000000007
using VP = vector<P>; using VVP = vector<VP>;
using VI = vector<ll>; using VVI = vector<VI>; using VVVI = vector<VVI>;
#define INF 1ll<<59

ll n,k;
VI used;
VVI v;

ll ans=1;

void solve(ll i){
  if(used[i]==1) return;
  else{
  used[i]=1;
  ll f=0;
  for(ll j=0;j<v[i].size();j++){
    if(used[v[i][j]]==1) f++;
  }
  if(f==0) {
    for(ll j=k;j>=k-(ll)v[i].size();j--) {
      ans*=j;
      ans%=Mod;
    }
  }
  else {
    for(ll j=k-f-1;j>=k-(ll)v[i].size();j--) {
      ans*=j;
      ans%=Mod;
    }
  }
  for(ll j=0;j<v[i].size();j++){
    if(used[v[i][j]]==0) solve(v[i][j]);
  }
  }

  return;

}
  
int main(){
    ll i,j;
    cin>>n>>k;
    v=VVI(n);
    used=VI(n,0);
    for(i=0;i<n-1;i++){
      ll a,b;
      cin>>a>>b;
      a--;
      b--;
      v[a].pb(b);
      v[b].pb(a);
    }
    solve(0);
    cout<<ans<<endl;
}

Measured memory_bytes: 8832
import java.util.Scanner;

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

	String s=sc.next();
	char[] c = s.toCharArray();

char test1[]=new char[s.length()];
char test2[]=new char[s.length()];

	for(int i=0;i<=s.length()-1;i++){
test1[i]=Zelo1(i);
test2[i]=Zelo2(i);
	}

	int te1,te2;
	te1=0;
	te2=0;
for(int i=0;i<=s.length()-1;i++){
	if(c[i]!=test1[i]){
te1++;
	}

	if(c[i]!=test2[i]){
		te2++;
	}



}
System.out.println(Math.min(te1, te2));

	}

	static public char Zelo1(int i) {
		int a = 1-i % 2;
		String ze = Integer.toString(a);
char x=ze.charAt(0);
		return x;

	}

	static public char Zelo2(int i) {
		int a = i % 2;
		String ze = Integer.toString(a);
char x=ze.charAt(0);
		return x;

	}
}

Measured memory_bytes: 34892
#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#pragma GCC target("avx")
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int (i)=0;i<(n);i++)
#define rrep(i,n) for(int (i)=1;i<=(n);i++)
#define REP(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define MOD 1000000007
#define INF 1e18
#define int long long
#define endl "\n"
#define yorn(f) puts((f)?"Yes":"No")
#define YORN(f) puts((f)?"YES":"NO")
typedef long long ll;
typedef pair<int, int> P;
int gcd(int a,int b){return b?gcd(b,a%b):a;};
int lcm(int a,int b){return a/gcd(a,b)*b;};
int mod(int a,int b){return (a+b-1)/b;};
template<typename A, size_t N, typename T>
void Fill(A(&array)[N],const T &val){std::fill((T*)array,(T*)(array+N),val);}
template<class T>inline bool chmax(T& a,T b){if(a<b){a=b;return true;}return false;};
template<class T>inline bool chmin(T& a,T b){if(a>b){a=b;return true;}return false;};



signed main() {
	cin.tie(0);
	cout.tie(0);
	ios::sync_with_stdio(false);
	//cout << fixed << setprecision(15);
	
	string s, t;
	cin >> s >> t;
	int ans = 0;
	rep(i, s.size()) {
		if(s[i] != t[i]) ans++;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3800
#include <iostream>
#include <string>

using namespace std;

string FindPath(int sx, int sy, int dx, int dy)
{
    string path = "";
    path.append(dx - sx, 'R');
    path.append(dy - sy, 'U');
    path.append(dx - sx, 'L');
    path.append(dy - sy + 1, 'D');
    path.append(dx - sx + 1, 'R');
    path.append(dy - sy + 1, 'U');
    path.append(1, 'L');
    path.append(1, 'U');
    path.append(dx - sx + 1, 'L');
    path.append(dy - sy + 1, 'D');
    path.append(1, 'R');
    return path;
}

int main()
{
    int sx, sy, dx, dy;
    cin >> sx >> sy >> dx >> dy;

    auto path = FindPath(sx, sy, dx, dy);
    cout << path << "\n";

    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
using namespace std;
int cmp(vector<int> &A,vector<int> &B)//1Ada,2Bda,3xiangdeng
{
	if(A.size() != B.size())
	{
		if(A.size()>B.size())
		return 1;
		else
		return 2;
	}
	for(int i = A.size()-1;i>=0;i--)
	{
		if(A[i] != B[i])
		{
			if(A[i] > B[i]) return 1;
			else return 2;
		}
		
	}
	return 3;
}
int main()
{
	string a;
	string b;
	while(cin >> a >> b)
	{
	vector<int>A,B;
	for(int i = a.size()-1;i>=0;i--) A.push_back(a[i]-'0');
	for(int i = b.size()-1;i>=0;i--) B.push_back(b[i]-'0');
		if(cmp(A,B) == 1)
		{
			cout << "GREATER" << endl;
		}
		else if(cmp(A,B) == 2)
		{
			cout << "LESS" << endl;
		}
		else if(cmp(A,B) == 3)
		{
			cout << "EQUAL" << endl;
		}
	}
	return 0;
}

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

class Program
{

    static void Main()
    {
        var sc = new Scanner();
        int gu = 0;
        int a = sc.Int();
        int[] kusi =new int[2*a];
        for (int i = 0; i < 2*a; i++)
        {
            kusi[i] = sc.Int();
        }
        Array.Sort(kusi);
        Array.Reverse(kusi);
        for (int i = 0; i < 2*a; i=i+2)
        {
            if (kusi[i]>=kusi[i+1])
            {
                gu += kusi[i+1];
            }
            else
            {
                gu += kusi[i];
            }
        }
        Console.WriteLine(gu);
    }
}
static class Extentions
{
    public static IEnumerable<T> Outpuut<T>(this IEnumerable<T> source)
    {
        foreach (var item in source)
        {
            Console.WriteLine(item);
        }
        return source;
    }
    public static T Print<T>(this T obj)
    {
        Console.WriteLine(obj);
        return obj;
    }
}
public class Scanner
{
    public Scanner()
    {
        byte[] inputBuffer = new byte[1024];
        System.IO.Stream inputStream = Console.OpenStandardInput(inputBuffer.Length);
        Console.SetIn(new System.IO.StreamReader(inputStream, Console.InputEncoding, false, inputBuffer.Length));
    }
    string[] buffer = new string[0];
    int index = 0;
    public char[] SplitChars { get; set; }
    public string String()
    {
        if (index < buffer.Length) return buffer[index++];
        string line = "";
        while (line == "") line = Console.ReadLine();
        if (line == null) return null;
        buffer = line.Split(SplitChars, StringSplitOptions.RemoveEmptyEntries);
        index = 0;
        return buffer[index++];
    }
    public string[] StringArray(int count) { return NextArray(count, x => x); }
    public void Skip(int count) { for (int i = 0; i < count; i++) String(); }
    public T Next<T>(Func<string, T> parser) { return parser(String()); }
    public T[] NextArray<T>(int count, Func<string, T> parser)
    {
        var arr = new T[count];
        for (int i = 0; i < count; i++) arr[i] = Next(parser);
        return arr;
    }
    public int Int() { return Next(int.Parse); }
    public int[] IntArray(int count) { return NextArray(count, int.Parse); }
    public double Double() { return Next(double.Parse); }
    public double[] DoubleArray(int count) { return NextArray(count, double.Parse); }
}


Measured memory_bytes: 3032
#include <iostream>
#include <vector>
#include <utility>
#include <map>
#include <algorithm>
#include <queue>
#include <cmath>

using namespace std;

int main() {
	int a,b,c,d;
	cin >> a >> b >> c >> d;
	
	while (1) {
		 c = c - b;
		 if (c<=0){
			 cout << "Yes" << endl;
			 return 0;
		 }
		 a = a - d;
		 if (a<=0){
			 cout << "No" << endl;
			 return 0;
		 }
	}

	return 0;
}

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

using namespace std;

int main() {
  int64_t X;
  cin >> X;
  int64_t money = 100;
  int64_t t = 0;
  while (money < X) {
    money += money / 100;
    t++;
  }
  cout << t << endl;

  return 0;
}


Measured memory_bytes: 3640
n,m=map(int,input().split())
ab=[list(map(int,input().split())) for i in range(m)]
count=0
for i in range(m):
    data=[[] for i in range(n+1)]
    for j in range(m):
        if j==i:
            continue
        else:
            a,b=ab[j]
            data[a].append(b)
            data[b].append(a)
    flag=[0]*(n+1)
    flag[1]=1
    que=[1]
    cnt=1
    while que:
        h=que.pop()
        for u in data[h]:
            if flag[u]==0:
                flag[u]=1
                que.append(u)
                cnt+=1
    if cnt!=n:
        count+=1
print(count)

Measured memory_bytes: 40560
#include <iostream>
#include <queue>
#include <vector>

using namespace std;

class Solution {
public:
	int league(const vector<vector<int>>& A) {
		const int n = A.size();
		vector<vector<int>> adjLists(n * n);
		for (int i = 1; i <= n; ++i) {
			int prevMatch = -1;
			for (int j : A[i - 1]) {
				const int playerX = min(i - 1, j - 1), playerY = max(i - 1, j - 1);
				const int currMatch = playerX * n + playerY;
				if (prevMatch != -1)
					adjLists[prevMatch].push_back(currMatch);
				prevMatch = currMatch;
			}
		}

		/* Use the Kahn's algorithm for the topological sorting */
		vector<int> nIndegree(n * n);
		for (const auto& adjList : adjLists) {
			for (int v : adjList)
				++nIndegree[v];
		}

		queue<int> Q;
		for (int i = 0; i < n * n; ++i) {
			if (!nIndegree[i])
				Q.push(i);
		}

		int ans = 0, nVisited = 0;
		for (int depth = 1; !Q.empty(); ++depth) {
			for (int i = Q.size(); i > 0; --i) {
				const int u = Q.front();
				++nVisited, Q.pop();
				for (int v : adjLists[u]) {
					if (nIndegree[v] && !--nIndegree[v])
						Q.push(v);
				}
			}
			ans = max(ans, depth);
		}
		if (nVisited < n * n)
			return -1; /* failed */
		return ans;
	}
};

int main() {
	int n;
	cin >> n;
	vector<vector<int>> A(n, vector<int>(n - 1));
	for (int i = 0; i < n; ++i) {
		for (int j = 0; j < n - 1; ++j)
			cin >> A[i][j];
	}

	Solution sol;
	int ans = sol.league(A);
	cout << fixed << ans << endl;
	return 0;
}


Measured memory_bytes: 49188
n = int(input())
s1=''
s2=''
ptn=[('.','.'),('.','#'),('#','.'),('#','#')]
for i in range(n):
    for j in range(4):
        print(s1+ptn[j][0],flush=True)
        print(s2+ptn[j][1],flush=True)
        r = input()
        if r=='T':
            s1+=ptn[j][0]
            s2+=ptn[j][1]
            break
        elif r=='end':
            exit(0)
    else:
        break
for i in range(n):
    for j in range(4):
        print(ptn[j][0]+s1,flush=True)
        print(ptn[j][1]+s2,flush=True)
        r = input()
        if r=='T':
            s1=ptn[j][0]+s1
            s2=ptn[j][1]+s2
            break
        elif r=='end':
            exit(0)
    else:
        break



Measured memory_bytes: 3532
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		int x = sc.nextInt();
		int sum = 0;
		int count = 1;

		for (int i = 0; i < n; i++) {
			int d = sc.nextInt();
			sum += d;

			if (sum <= x) {
				count++;
			}
		}

		System.out.println(count);

		sc.close();

	}
}


Measured memory_bytes: 35984
#include<bits/stdc++.h>
#define lli long long int
#define MOD 1000000007
#define KING 1000000002
#define queen 1000002
#define fi first
#define se second
#define se second
#define lsb(i) (i & -i)
#define nl cout<<'\n'
#define TEST cout<<"TEST",nl
#define all(a) a.begin(), a.end()
#define pr pair<lli,lli>
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define vi vector<lli>
#define vpi vector<pr> 
#define P pair<lli,pr>
#define fastIO ios_base::sync_with_stdio(false); cin.tie(NULL)
#define NA(i,s,n) for(lli i=s;i<n;i++)
using namespace std;

lli power(lli x,lli y,lli p) { 
	lli res = 1;	 
	x = x % p; 
	while (y > 0) 
	{ 
		if (y & 1) 
			res = (res*x) % p; 
		y = y>>1; 
		x = (x*x) % p; 
	} 
	return res; 
} 

lli n,a,b,c,m,ans=0;
vi gp[100001];
void solve(){
    cin>>n>>m;
	vi h(n+1);
	NA(i,1,n+1) cin>>h[i];
	NA(i,0,m) cin>>a>>b, gp[a].pb(b), gp[b].pb(a);
	NA(i,1,n+1){
		bool fg = 1;
		for(lli j:gp[i]) if(h[i]<=h[j]) {fg = 0; break;}
		if(fg) ++ans;
	}
	cout<<ans;
    return;
}

int main(){
    fastIO;
    lli t = 1; 
    // cin>>t;
    NA(i,0,t) solve();
    return 0;
}


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

using namespace std;
typedef long long ll;
#define rep(i, j, n) for (int i = j; i < n; i++)
#define out(ans) cout << ans << endl;
const long long mod = 1e9 + 7;

typedef pair<int,int>P;
int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};

int main() {

  int h,w;cin>>h>>w;
  char s[h+10][w+10];
  queue<P>q;
  int next=0;
  rep(i,0,h){
    rep(j,0,w){
      cin>>s[i][j];
      if(s[i][j]=='#'){
        q.push(P(j,i));
        next++;
      }
    }
  }

  int cnt=next;next=0;
  int ans=0,hoge=0;
  while(!q.empty()){
    P p=q.front();
    q.pop();
    int x=p.first,y=p.second;

    for(int i=0;i<4;i++){
      int nx=x+dx[i],ny=y+dy[i];
      if(nx>=0&&ny>=0&&nx<w&&ny<h&&s[ny][nx]=='.'){
        q.push(P(nx,ny));
        s[ny][nx]='#';
        next++;
      }
    }
    hoge++;
    if(cnt==hoge){
      if(next==0)break;
      cnt=next;
      next=0;
      hoge=0;
      ans++;
    }
  }

  out(ans);

  return 0;
}


Measured memory_bytes: 9488
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int (i) = 0; (i) < (n); ++(i))
#define rrep(i,n) for(int (i) = (n) - 1; (i) >= 0; --(i)) //Reversi rep
#define nfor(i,a,b) for(int (i) = (a); (i) < (b); ++(i)) //Natural for
#define rfor(i,a,b) for(int (i) = (b); (i) >= (a); --(i)) //Reversi for
#define mod (1000000007)

int main()
{
    int a,b,c,d,ans = 0;
    cin >> a >> b >> c >> d;
    ans += min(a, b) + min(c, d);
    cout << ans << endl;
    return 0;
}

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

using namespace std;

int main(int argc, const char * argv[]) {
    
    int n = 0;
    cin >> n;
    
    int *b = new int[n];
    for(int i=0;i<n-1;i++)
    {
        cin >> b[i];
    }
    
    int *a = new int[n]();
    
    
    a[0] = b[0];
    a[1] = b[0];
    
    for(int i=1;i<n-1;i++)
    {
        if(a[i] > b[i]) a[i] = b[i];
        a[i+1] = b[i];
    }
    
    
    int sum = 0;
    for(int i=0;i<n;i++)
    {
        sum += a[i];
    }
    
    
    cout << sum << endl;
    
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll MOD = 1e9+7;

ll u[]={3,5,7};

bool isOK(ll x){
    bool t=0,f=0,s=0;
    while(x>0){
        if(x%10==3) t=1;
        if(x%10==5) f=1;
        if(x%10==7) s=1;
        x/=10;
    }
    if(t&&f&&s) return 1;
    else return 0;
}

void dfs(ll n,ll keta,vector<ll> &vec){
    if(keta==10) return;
    vec.push_back(n);
    for(ll i=0;i<3;i++){
        dfs(n*10+u[i],keta+1,vec);
    }
}

int main() {
    ll n;
    cin >> n;
    vector<ll>vec,num;
    dfs(3,1,vec);
    dfs(5,1,vec);
    dfs(7,1,vec);
    for(ll x:vec){
        if(isOK(x)) num.push_back(x);
    }
    ll ans=0;
    for(ll x:num){
        if(x>n) continue;
        ans++;
    }
    cout << ans << endl;
}

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

using namespace std;

int main(){
	int N;
	vector <int> v;
	int cnt=0;

	cin>>N;
	v.resize(N);
	for(int i=0; i<N; i++){
		cin>>v[i];
		v[i]--;
	}

	for(int i=0; i<N; i++){
		if(v[v[i]]==i) cnt++;
	}

	cout<<cnt/2<<endl;
	
	return 0;
}


Measured memory_bytes: 640
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")

def main():
    def parity_onebit(x):
        return bin(x).count("1") & 1

    def make_route(s, g, state):
        if state.count(-1) == 1:
            return [s, g]
        sep_dig = bin(s ^ g)[::-1].find("1")
        s_bit = (s >> sep_dig) & 1
        Lstate = state[:]
        Rstate = state[:]
        Lstate[sep_dig] = s_bit
        Rstate[sep_dig] = 1 - s_bit
        for i in range(16):
            ng = 0
            i_copy = i
            for sk in Lstate[::-1]:
                ng <<= 1
                if sk == -1:
                    ng += i_copy & 1
                    i_copy >>= 1
                else:
                    ng += sk
            ns = ng ^ (1 << sep_dig)
            if ng != s and parity_onebit(ng) != parity_onebit(s) and ns != g:
                break
        res = make_route(s, ng, Lstate)
        state[sep_dig] = 1 - s_bit
        res += make_route(ns, g, Rstate)
        return res

    n, s, g = map(int, input().split())
    if parity_onebit(s) == parity_onebit(g):
        print("NO")
        exit()
    ans=make_route(s, g, [-1] * n)
    print("YES")
    print(*ans)
    #print(*[format(a,"b").zfill(n) for a in ans])

main()


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

// Begin {{{
using namespace std;

#define all(x) x.begin(), x.end()
#define rep(i, n) for (i64 i = 0; i < (n); ++i)
#define reps(i, s, n) for (i64 i = (s); i <= (n); ++i)
#define VAR(Type, ...) Type __VA_ARGS__; IN(__VA_ARGS__)

#ifdef DEBUG
#define dump(...) _dump(#__VA_ARGS__, __VA_ARGS__);
#else
#define dump(...)
#endif

using i64 = int_fast64_t;
using pii = pair<i64, i64>;

template <class A, class B>
inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }

template <class A, class B>
inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }

constexpr int INF = 0x3f3f3f3f;
constexpr i64 LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr int MOD = int(1e9) + 7;

// IN
void IN() {}
template <class Head, class... Tail>
void IN(Head&& head, Tail&&... tail) {
  cin >> head;
  IN(forward<Tail>(tail)...);
}

// OUTS
void OUTS() {}
template <class Head, class... Tail>
void OUTS(Head&& head, Tail&&... tail) {
  cout << head << " \n"[sizeof...(tail)==0];
  OUTS(forward<Tail>(tail)...);
}

template <class T>
void OUTS(vector<T> &vec) { for (auto &e : vec) cout << e << " \n"[&e==&vec.back()]; }

template <class T>
void OUTS(vector<vector<T>> &df) { for (auto &vec : df) OUTS(vec); }

// OUTL
void OUTL() {}
template <class Head, class... Tail>
void OUTL(Head&& head, Tail&&... tail) {
  cout << head << "\n";
  OUTL(forward<Tail>(tail)...);
}

template <class T>
void OUTL(vector<T> &vec) { for (auto &e : vec) cout << e << "\n"; }

// OUTN
void OUTN() {}
template <class Head, class... Tail>
void OUTN(Head&& head, Tail&&... tail) {
  cout << head;
  OUTN(forward<Tail>(tail)...);
}

template <class T>
void OUTN(vector<T> &vec) { for (auto &e : vec) cout << e; }

// DEGUG
template <class T>
void _dump(const char *s, T&& x) {
    clog << '{';
    while(*s != '\0') clog << *(s++);
    clog << ": " << x << '}' << "\n";
}

template <class Head, class... Tail>
void _dump(const char *s, Head&& head, Tail&&... tail) {
  clog << '{';
  while(*s != ',') clog << *(s++);
  clog << ": " << head << "}, ";
  for (++s; !isgraph(*s); ++s);
  _dump(s, forward<Tail>(tail)...);
}
// }}} End

i64 sigma(i64 n) { return n * (1 + n) / 2; }

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

  VAR(i64, n);
  OUTL(sigma(n - 1));

  return 0;
}


Measured memory_bytes: 256
#include <vector>
#include <functional>

template <typename T>
class func_sum
{
private:
    std::vector<std::vector<T>> sum_table;
protected:
    virtual T acc_sum(int i, int j);
public:
    func_sum(std::function<T(int, int)> func, int nx, int ny) ;
    ~func_sum();

    T calc_section_sum(int px, int qx, int py, int qy);
};

template <typename T>
T func_sum<T>::acc_sum(int i, int j) {
    return sum_table[i][j];
};

template <typename T>
func_sum<T>::~func_sum() {}

template <typename T>
func_sum<T>::func_sum(std::function<T(int, int)> func, int nx, int ny) {
    sum_table = std::vector<std::vector<T>>(ny + 1, std::vector<T>(nx + 1, T()));
    //j=0の場合の総和の計算
    for (int i = 1; i <= nx; i++) {
        sum_table[i][0] += func(i - 1, 0);
    }
    //i=0の場合の総和の計算
    for (int j = 1; j <= ny; j++) {
        sum_table[0][j] += func(0, j - 1);
    }
    //総和の計算
    for (int i = 1; i <= nx; i++) {
        for (int j = 1; j <= ny; j++) {
            sum_table[i][j] += func(i - 1, j - 1) +
                sum_table[i - 1][j] +
                sum_table[i][j - 1] -
                sum_table[i - 1][j - 1];

        }
    }
}

template <typename T>
T func_sum<T>::calc_section_sum(int px, int qx, int py, int qy) {
    return acc_sum(qx, qy) - 
           acc_sum(qx, py - 1) - 
           acc_sum(px - 1, qy) + 
           acc_sum(px - 1, py - 1);
}

#include <vector>
#include <iostream>

int main()
{
    int N, M, Q;
    std::cin >> N >> M >> Q;
    std::vector<std::vector<int>> table(N, std::vector<int>(N, 0));
    for (int i = 0; i < M; i++) {
        int L, R;
        std::cin >> L >> R;
        table[L - 1][R - 1]++;
    }

    auto func = [](int i, int j,
        const std::vector<std::vector<int>>& table) { return table[i][j]; };

    std::function<int(int, int)>  func_curried = std::bind(func,
        std::placeholders::_1,
        std::placeholders::_2,
        table);

    func_sum<int> ds(func_curried, N, N);

    for (int i = 0; i < Q; i++) {
        int p, q;
        std::cin >> p >> q;
        std::cout << ds.calc_section_sum(p, q, p, q) << std::endl;
    }
    return 0;
}




Measured memory_bytes: 4864
#include <stdio.h>

int
main(int argc, char *argv[])
{
  int i = 0, j = 0;
  char s[100];
  scanf("%s", s);
  char t[100];
 

  while(s[i] != '\0'){
    if(s[i] == '0'){ t[j++] = '0'; t[j] = '\0';}
    else if(s[i] == '1'){ t[j++] = '1';t[j] = '\0';}
    else if(j != 0){
      j--;
      t[j] = '\0';
    }
    i++;
    
  }
  printf("%s\n", t);
  return 0;
}


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

int main(){
    int N;
    string A, B, C;
    cin >> N >> A >> B >> C;
    int ans = 0;
    for (int i = 0; i < N; i++) {
        if (A[i] == B[i] && B[i] == C[i]) continue;
        else if (A[i] == B[i] || B[i] == C[i] || C[i] == A[i]) ans++;
        else ans += 2;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <utility>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstdio>
#include <stdio.h>
#include <string.h>

using namespace std;

static const double EPS = 1e-9;
template<class T> bool INRANGE(T x, T a, T b) { return a <= x && x <= b; }
template<class T> void amin(T &a, T v) { if (a > v) a = v; }
template<class T> void amax(T &a, T v) { if (a < v) a = v; }
int ROUND(double x) { return (int)(x + 0.5); }
bool ISINT(double x) { return fabs(ROUND(x) - x) <= EPS; }
bool ISEQUAL(double x, double y) { return fabs(x - y) <= EPS * max(1.0, max(fabs(x), fabs(y))); }
double SQSUM(double x, double y) { return x * x + y * y; }
#define PI  (acos(-1))
#define ARRAY_NUM(a) (sizeof(a)/sizeof(a[0])) 
#define NG (-1)
#define BIG ((int)1e9+10)
#define BIGLL ((ll)4e18)
#define SZ(a) ((int)(a).size())
#define SQ(a) ((a)*(a))
typedef unsigned long long ull;
typedef long long ll;



int main() 
{
	vector <int> a(4);
	cin >> a[0] >> a[1] >> a[2] >> a[3];
	sort(a.begin(), a.end());

	if (a[0] == 1 && a[1] == 4 && a[2] == 7 && a[3] == 9)
	{
		printf("YES\n");
	}
	else
	{
		printf("NO\n");
	}




	return 0;
}


Measured memory_bytes: 256
#ifndef DEBUG
#pragma GCC optimize("O3,unroll-loops")
#pragma loop_opt(on)
#endif
#include <bits/stdc++.h>
using namespace std;

#ifdef DEBUG
#define FAST ;
#else
#define FAST ios::sync_with_stdio(0);cin.tie(0);
#define endl '\n'
#define cerr
#endif
#define _ <<' '<<
#define Fr(i, s, e) for(auto i = s; i < e; ++i)
#define All(v) v.begin(),v.end()
#define Ft first
#define Sd second
using ll = long long;
using pii = pair<int, int>;
constexpr ll MOD = 1e9+7;

signed main() {
    FAST;

    int a, b, k;
    cin >> a >> b >> k;
    Fr(i, 0, k) {
        cout << a++ << endl;
        if (a > b) exit(0);
    }
    a = max(a, b-k+1);
    Fr(i, 0, k) {
        cout << a++ << endl;
        if (a > b) exit(0);
    }

}


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

int main(){
	int a, b;
	cin >> a >> b;
	cout << a/b << " " << a%b << " ";
	std::cout << std::fixed;
	std::cout << std::setprecision(6) << (double)a/(double)b;
}


Measured memory_bytes: 3240
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, srt, end) for (long long i = (srt); i < (long long)(end); i++)
#define VL vector<ll>
#define VS vector<string>
#define VB vector<bool>
#define VP vector<pair<ll,ll>>
#define VVL vector<vector<ll>>
#define VVP vector<vector<pair<ll,ll>>>
#define PL pair<ll,ll>
#define ALL(v) (v).begin(), (v).end()
ll d1[4] = {1, -1, 0, 0};
ll d2[4] = {0, 0, 1, -1};

int main(){
    ll x, n;
    cin >> x >> n;
    VL p(n);
    set<ll> st;
    rep(i, 0, n){
        cin >> p[i];
        st.insert(p[i]);
    }
    ll mn = 1e18, ans = 1e18;
    rep(i, -1000, 1000){
        if(st.count(i) > 0) continue;
        if(mn > abs(x-i)){
            ans = i;
            mn = abs(x-i);
        }
    }
    cout << ans << endl;
    return 0;
}

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

int main(void){
   string S[3];
   for(int i=0;i<3;i++){
      cin>>S[i];
   }
   int t=0;
   char c='A';
   while(1){
      if(S[t].size()==0){
         c+=t;
         cout<<c<<endl;
         return 0;
      }
      char temp=S[t][0];
      S[t].erase(S[t].begin());
      if(temp=='a'){
         t=0;
      }else if(temp=='b'){
         t=1;
      }else if(temp=='c'){
         t=2;
      }
   }
   return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int cnt[100010]={0};

int main(){
   for(int x=1;x<=100;x++){
    for(int y=1;y<=100;y++){
        for(int z=1;z<=100;z++){
            cnt[x*x+y*y+z*z+x*z+y*z+y*x]++;
        }
    }
   }
   int n;
   scanf("%d",&n);
   for(int i=1;i<=n;i++){
    printf("%d\n",cnt[i]);
   }
    return 0;
}


Measured memory_bytes: 4056
// abc053d: Card Eater
#include <stdio.h>

#define upto(i,s,e,d) for(int i=(s);i<=(e);i+=(d))
#define in(n) scanf("%d",n)
#define out(d) printf("%d\n",d)

#define MAX 100000
int b[MAX+1];

int main(){
  int n;in(&n);
  int c=0;
  upto(i,0,n-1,1){
    int a;in(&a);
    if(b[a]==0){
      b[a] = 1;
      c++;
    }
  }
  out(c%2? c: c-1);
  return 0;
}

Measured memory_bytes: 512
while True:
    H, W = map(int, input().split())
    if not(H or W):
        break
    for i in range(H):
        print('#', end='')
        for j in range(W-2):
            if i > 0 and i < H - 1:
                print('.', end='')
            else:
                print('#', end='')
        print('#')
    print()

Measured memory_bytes: 8992
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,r=0,b=0;
  string s;
  cin>>n>>s;
  for(int i=0; i<n; i++){
    if(s[i]=='R'){
      r++;
    }else{
      b++;
    }
  }
  if(r>b){
    cout<<"Yes"<<'\n';
  }else{
    cout<<"No"<<'\n';
  }
  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(){

int K;

scanf("%d",&K);
if(K == 3){
printf("%d",2);
}else if(K%2 == 0){
  printf("%d",(K/2)*(K/2));
}else{
int a = K/2;
int b = K-K/2;
  printf("%d",a*b);
}

}

Measured memory_bytes: 128
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <list>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <numeric>
#include <deque>

#define dump(x) cerr << #x << "=" << (x) << endl;
using namespace std;
using ll = long long;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define IN(x) int (x); cin >> x
#define INS(x) string (s); cin >> s
#define INL(x) ll (x); cin >> x
#define VINT(a,n) vector<int> a(n)
#define VIN(a,n) VINT(a,n); REP(i,n){cin >> a[i];}
#define ALL(x) (x).begin(),(x).end()

int main () {
  IN(n);
  IN(x);
  VIN(l,n);
  ll d=0;
  int c=1;
  REP(i,n){
    ll temp=d+l[i];
    if(temp>x)
      break;
    else {d=temp;
      c++;
    }
  }
  cout<<c;
}


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

    using namespace std;
    template <typename T>
    void debug(string t, T input) {
        cout<<t<<"-> "<<input<<"\n";
    }
    template <typename T>
    void debug(int i,string t, T input) {
        cout<<"Case#"<<i<<" "<<t<<"-> "<<input<<"\n";
    }

    int ans=0;
    int n,m,q;
    int a[50],b[50],c[50],d[50];
    vector<int>v;
    int check(){
        int val=0;
        for(int i=0;i<q;i++){
            if(v[b[i]]-v[a[i]]==c[i])
                val+=d[i];
        }
        return val;
    }

    void dfs(int i, int cur){
        if(i>=n){
            ans=max(ans,check());
            return ;
        }
        for(int j=cur;j<=m;j++){
            v.push_back(j);
            dfs(i+1,j);
            v.pop_back();
        }
    }
    int main(){
        cin>>n>>m>>q;
        for(int i=0;i<q;i++){
            cin>>a[i]>>b[i]>>c[i]>>d[i];
            a[i]--;
            b[i]--;
        }
        dfs(0,1);
        cout<<ans<<"\n";
        return 0;
    }


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

using int64 = long long;

int main()
{
  long long x, y;
  scanf("%lld%lld", &x, &y);

  if (x >= y)
  {
    printf("%d\n", 1);
    return 0;
  }

  long long count = 1;
  while (x * 2 <= y)
  {
    count++;
    x *= 2;
  }

  printf("%lld\n", count);

  return 0;
}


Measured memory_bytes: 888
# from fractions import gcd
# mod = 10 ** 9 + 7
# N = int(input())
# a = list(map(int,input().split()))
# a,b,c = map(int,input().split())
# ans = [0] * N
# math.ceilで切り上げ
# dp = [[0] * 4 for i in range(3)] #2次元配列初期化
# dp = [[[0] * 2 for i in range(3)] for j in range(5)]
# (ord('A'))でASCII出力 Aは65
import math
import statistics
import string


def intinput():
    return int(input())

def listintinput():
    return list(map(int, input().split()))

def splitintinput():
    return map(int, input().split())

def factorialsurplus(x, y, z):  # xからyまでの階乗をzで割ったあまりを求める
    ret = 1
    for i in range(x, y + 1):
        ret = (ret * i) % z
    return (ret)

def isprime(x):
    if x == 1:
        return False
    if x == 2:
        return True
    sq = int(math.sqrt(x))
    for i in range(2,sq+1):
        if x % i == 0:
            return False
    return True

x = intinput()

while True:
    if isprime(x):
        print(x)
        break
    else:
        x += 1



Measured memory_bytes: 5744
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int(i) = 0;(i)<(n);(i)++)
#define pb push_back
#define mp make_pair
#define All(X) X.begin(),X.end()

int main(){
	vector<int> vx, vy;
	while (1){
		vx.clear();
		vy.clear();
		REP(i, 8){
			string str;
			cin >> str;
			if (cin.eof()){
				return 0;
			}	
			REP(j, 8){
				if (str[j] == '1'){
					vx.pb(i);
					vy.pb(j);
				}
			}
		}
		char ans = 'G';
		if (vx[0] == vx[1] && vy[0] == vy[2]) ans = 'A';
		if (vy[0] == vy[1] && vy[0] == vy[2] && vy[0] == vy[3]) ans = 'B';
		if (vx[0] == vx[1] && vx[0] == vx[2] && vx[0] == vx[3]) ans = 'C';
		if (vx[1] == vx[2] && vy[1] == vy[3] && vy[0] == vy[2]) ans = 'D';
		if (vx[0] == vx[1] && vx[2] == vx[3] && vy[1] == vy[2] && vy[0] + 2 == vy[3]) ans = 'E';
		if (vx[1] == vx[2] && vy[0] == vy[1] && vy[2] == vy[3]) ans = 'F';
		
		cout << ans << endl;
		
	}
}

Measured memory_bytes: 3140
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<vector>
using namespace std;

long long cnt;
int l;
int A[1000000];
int n;
vector<int> G;

void insertionSort(int A[], int n, int g){
    for(int i = g; i < n; i++){
        int v = A[i];
        int j = i - g;
        while(j >= 0 && A[j] > v){
            A[j + g] = A[j];
            j -= g;
            cnt++;
        }
        A[j + g] = v;
    }
}

void shellSort(int A[], int n){
    for(int h = 1; ;){
        if(h > n) break;
        G.push_back(h);
        h = 3*h + 1;
    }
    
    for(int i = G.size() - 1; i >= 0; i--){
        insertionSort(A, n, G[i]);
    }
}

int main(){
    cin >> n;
    for(int i = 0; i < n; i++) scanf("%d", &A[i]);
    cnt = 0;
    
    shellSort(A, n);
    
    cout << G.size() << endl;
    for(int i = G.size() - 1; i >= 0; i--){
        printf("%d", G[i]);
        if(i) printf(" ");
    }
    printf("\n");
    printf("%d\n", cnt);
    for(int i = 0; i < n; i++)printf("%d\n", A[i]);
    
    return 0;
}


Measured memory_bytes: 7172
open Batteries
open Printf
let () =
  let x,y = Scanf.scanf "%d %d " (fun a b -> a,b) in

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

  Printf.printf "%s\n" @@
  if List.mem x a && List.mem y a || List.mem x b && List.mem y b || List.mem x c && List.mem y c then
    "Yes" else "No"


Measured memory_bytes: 1024
#include<stdio.h>
#include<math.h>
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<string.h>
#include<string>
#include<map>
#include<utility>
#include<functional>
typedef long long ll;
using namespace std;
typedef pair<int,float> p;

int miria[26]={};
int main(){
  string hoge;
  cin >> hoge;
  for(int i=0;i<hoge.size();i++){
    miria[hoge[i]-'a']++;
  }
  int flag = 1;
  for(int i='a';i<='z';i++){
    if(miria[i-'a']==0){
      cout << (char)i << endl;
      flag = 0;
      break;
    }
  }
  if(flag){
    cout << "None" << endl;
  }
  return 0;
}


Measured memory_bytes: 512
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) throws IOException{
		InputStreamReader is = new InputStreamReader(System.in);
		BufferedReader bf = new BufferedReader(is);
		String[] strAry = bf.readLine().split(" ");
		int h = Integer.parseInt(strAry[0]);
		int w = Integer.parseInt(strAry[1]);
		System.out.println(h * w + " " + ((h * 2) + (w * 2)));
	}
}

Measured memory_bytes: 24340
#include <iostream>
#include <string>
#include <queue>
#include <stack>
#include <algorithm>
#include <list>
#include <vector>
#include <complex>
#include <utility>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <bitset>
#include <ctime>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <cassert>
#include <cstddef>
#include <iomanip>
#include <numeric>
#include <tuple>
#include <sstream>
#include <fstream>
#include <functional>

using namespace std;
#define REP(i, n) for (int (i) = 0; (i) < (n); (i)++)
#define FOR(i, a, b) for (int (i) = (a); (i) < (b); (i)++)
#define RREP(i, a) for(int (i) = (a) - 1; (i) >= 0; (i)--)
#define FORR(i, a, b) for(int (i) = (a) - 1; (i) >= (b); (i)--)
#define DEBUG(C) cerr << #C << " = " << C << endl;
using LL = long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VL = vector<LL>;
using VVL = vector<VL>;
using VD = vector<double>;
using VVD = vector<VD>;
using PII = pair<int, int>;
using PDD = pair<double, double>;
using PLL = pair<LL, LL>;
using VPII = vector<PII>;
template<typename T> using VT = vector<T>;
#define ALL(a) begin((a)), end((a))
#define RALL(a) rbegin((a)), rend((a))
#define SORT(a) sort(ALL((a)))
#define RSORT(a) sort(RALL((a)))
#define REVERSE(a) reverse(ALL((a)))
#define MP make_pair
#define FORE(a, b) for (auto &&a : (b))
#define EB emplace_back
#define GREATER(T) T, VT<T> greater<T>
template<typename T> inline bool chmax(T &a, T b){if (a < b){a = b;return true;}return false;}
template<typename T> inline bool chmin(T &a, T b){if (a > b){a = b;return true;}return false;}

const int INF = 1e9;
const int MOD = INF + 7;
const LL LLINF = 1e18;

int calc2(int v) {
    while (v >= 10) v /= 10;
    return v;
}

int get(char high, int mid, char low, int zero_cnt) {
    return stoi(high + string(zero_cnt, '0') + to_string(mid) + low);
}

int N;
LL memo[10][10];

int main(void) {
    cin >> N;

    FOR(i, 1, 10) {
        FOR(j, 1, 10) {
            if (i == j && i > N) {
                continue;
            }
            if (i * 10 + j > N) {
                memo[i][j] = i == j;
                continue;
            }
            memo[i][j] = 1 + (i == j);
            for (int k = 0; ; k++) {
                int z = 0;
                for (; ; z++) {
                    const int v = get('0' + i, k, '0' + j, z);
                    if (v <= N) {
                        memo[i][j]++;
                    } else {
                        break;
                    }
                }
                if (z == 0) break;
            }
        }
    }

    LL cnt = 0;
    FOR(i, 1, N + 1) {
        if (i % 10 == 0) continue;
        //const auto cur = memo[calc2(i)][i % 10];
        const auto cur = memo[i % 10][calc2(i)];
        //cerr << i << " " << cur << endl;
        cnt += cur;
    }

    cout << cnt << endl;
}


Measured memory_bytes: 256
fun main(args: Array<String>) = shojin06a()

fun shojin06a() {
    val (n, d) = readLine()!!.split(' ').map { it.toInt() }
    val xList = (1..n).map { readLine()!!.split(' ').map { it.toInt() } }

    var answer = 0

    for (l in 0 until n) {
        for (r in l + 1 until n) {
            val left = xList[l]
            val right = xList[r]
            val sum = (0 until d).map { Math.pow(Math.abs(left[it] - right[it]).toDouble(), 2.0).toInt() }.sum()
            val sqrt = Math.sqrt(sum.toDouble())
            if (sqrt == Math.floor(sqrt)) answer++
        }
    }

    println(answer)
}


Measured memory_bytes: 36440