akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ABC134A
{
    class Program
    {
        static void Main(string[] args)
        {
            int r = int.Parse(Console.ReadLine());
            Console.WriteLine(3 * r * r);
        }
    }
}


Measured memory_bytes: 27520
def Get_i() #空白区切の入力を数値(整数)の配列で返す
  return gets.chomp.split(" ").map(&:to_i)
end
def Get_f() #空白区切の入力を数値(実数)の配列で返す
  return gets.chomp.split(" ").map(&:to_f)
end
def Get() #空白区切の入力を文字列の配列で返す
  return gets.chomp.split(" ")
end
def Get_nsp() #入力されたものを一文字ずつに区切った文字列の配列で返す
  return gets.chomp.split("")
end

head=0
tail=10**9
x=gets.to_i
def Fulfil?(k,x)
  return (k+1)*k/2>=x
end
while tail-head>1
  mid=(head+tail)/2
  if Fulfil?(mid,x)
    tail=mid
  else
    head=mid
  end
end
puts tail

Measured memory_bytes: 1788
#include <iostream>
#include <algorithm>
#include <vector>
#include<string>
#include <set>
#include <map>
#include <queue>
#include <limits.h>
#include <bitset>

using namespace std;

#define rip(i, n, s) for (int i = (s);i < ( int )( n ); i++)
#define all(a) (a).begin(), (a).end()
typedef long long ll;

int main(){
    string s;
    cin >> s;
    int n=s.size(),co=n/2;
	char base=s[co];
    while(s[co-1]==base && s[n-co]==base){
        co--;
		if(co==0){
			break;
		}
    }
	cout << n-co <<endl;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it)
#define ALLOF(c) (c).begin(), (c).end()
typedef long long ll;
typedef unsigned long long ull;


int main(){
  int N;
  cin >> N;
  vector<ll> v;
  rep(i,N){
    ll a;
    cin >> a;
    v.push_back(a);
  }

  ll ret = 0;
  REP(C,1,N){
    ll score = 0;
    ll x = 0;
    map<int,int> m;
    bool flg = true;
    while(true){
      // range
      if(x*C >= N) break;
      if((N-1)-x*C < 0) break;
      // B > 0 <=> A-C > 0
      if((N-1)-x*C-C <= 0) break;
      // overlap
      if(m.count(x*C) > 0) break;
      m[x*C] = 1;
      if(m.count((N-1)-x*C) > 0) break;
      m[(N-1)-x*C] = 1;
      
      score += v[x*C];
      score += v[(N-1)-x*C];
      //cout << C << " " << x << " " << score << endl;
      ret = max(ret, score);
      x++;
    }
  }

  cout << ret << endl;
  
  return 0;
}



Measured memory_bytes: 5748
#include <bits/stdc++.h>
#define MOD 1000000007
#define MAX 300000
using ll = long long;
using namespace std;

ll kaijo[MAX + 1];
ll gyaku[MAX + 1];

ll myPow(ll a, ll b) {
	ll res = 1;
	while (b) {
		if (b & 1) {
			res = (res * a) % MOD;
		}
		a = (a * a) % MOD;
		b >>= 1;
	}
	return res;
}

ll C(ll n, ll k) {
	return min(k, n - k) >= 0 ? kaijo[n] * gyaku[k] % MOD * gyaku[n - k] % MOD : 0;
}

int main()
{
	kaijo[0] = gyaku[0] = 1;
	for (int i = 1; i <= MAX;i++) {
		kaijo[i] = (kaijo[i - 1] * i) % MOD;
		gyaku[i] = myPow(kaijo[i], MOD - 2);
	}
	ll N, M, K, res = 0;
	cin >> N >> M >> K;
	for (ll i = 0; i <= K; i++) {
		res = (res + (C(N + M + K * 2, M + i * 2) * ((C(M + i * 2, i) + MOD - C(M + i * 2, i - 1)) % MOD) % MOD * ((C(N + (K - i) * 2, K - i) + MOD - C(N + (K - i) * 2, K - i - 1)) % MOD) % MOD)) % MOD;
	}
	cout << res << endl;
	return 0;
}

Measured memory_bytes: 7772
#include <map>
#include <iostream>
#include <algorithm>
#define int long long 
using namespace std;
map<pair<int, int>,int>t;
int N;
int arr[200100][4];
int po[200100];
int gc(int a, int b)
{
	return b ? gc(b, a % b) : a;
}
signed main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cin >> N;
	int i;
	int rr = 0;
	for (i = 0; i <= N; i++)
	{
		if (!i)
			po[i] = 1;
		else
			po[i] = po[i - 1] * 2 % 1000000007;
	}
	int ans = 1;
	for (i = 0; i < N; i++)
	{
		int a, b;
		cin >> a >> b;
		if ((a == 0) && (b == 0))
		{
			rr++;
			continue;
		}
			
		int c = 0;
		while (!((a >= 0) && (b > 0)))
		{
			c++;
			int r = a;
			a = -b;
			b = r;
		}
		
		int x = gc(a, b);
		a /= x;
		b /= x;
		int r = t[{a, b}];
		if (r)
		{
			arr[r][c]++;
		}
		else
		{
			t[{a, b}] = t.size();
			arr[t.size()][c]++;
		}
	}
	N = t.size();
	
	for (i = 1; i <= N; i++)
	{
		int th = (po[arr[i][0] + arr[i][2]] + po[arr[i][1] + arr[i][3]] - 1) % 1000000007;
		ans = ans * th % 1000000007;
	}
	cout << (ans + rr+1000000006) % 1000000007;
}

Measured memory_bytes: 23904
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#ifdef tabr
#include "library/debug.cpp"
#else
#define debug(...)
#endif

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n, m;
    cin >> n >> m;
    vector<pair<int, int>> p(n);
    for (int i = 0; i < n; i++) {
        cin >> p[i].first >> p[i].second;
    }
    sort(p.begin(), p.end());
    vector<int> a(n), b(n), c(n + 1);
    for (int i = 0; i < n; i++) {
        tie(a[i], b[i]) = p[i];
    }
    c[0] = b[0];
    c[n] = b[n - 1];
    for (int i = 1; i < n; i++) {
        c[i] = b[i] ^ b[i - 1];
    }
    a.emplace_back(2e9);
    map<pair<int, int>, int> mp;
    vector<vector<int>> g(n + 1);
    for (int i = 0; i < m; i++) {
        int l, r;
        cin >> l >> r;
        l = lower_bound(a.begin(), a.end(), l) - a.begin();
        r = upper_bound(a.begin(), a.end(), r) - a.begin();
        if (l < r) {
            mp[{l, r}] = i + 1;
            g[l].emplace_back(r);
            g[r].emplace_back(l);
        }
    }
    vector<int> was(n + 1);
    vector<int> val(n + 1);
    set<int> ans;
    function<void(int, int)> dfs = [&](int v, int p) {
        if (was[v]) return;
        was[v] = 1;
        val[v] = c[v];
        for (int to : g[v]) {
            if (to == p) continue;
            if (was[to]) continue;
            dfs(to, v);
            val[v] ^= val[to];
        }
        if (val[v] && p == -1) {
            cout << -1 << '\n';
            exit(0);
        }
        if (val[v]) {
            ans.emplace(mp[{min(v, p), max(v, p)}]);
        }
    };
    for (int i = 0; i < n + 1; i++) {
        if (was[i]) continue;
        dfs(i, -1);
    }
    cout << ans.size() << '\n';
    for (int i : ans) {
        cout << i << " ";
    }
    cout << '\n';
    return 0;
}

Measured memory_bytes: 34680
package main

import (
	"fmt"
	"bufio"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func nextInt() int {
    sc.Scan()
    i, e := strconv.Atoi(sc.Text())
    if e != nil {
        panic(e)
    }
    return i
}

func main() {
	sc.Split(bufio.ScanWords)

	n := nextInt()
	fmt.Println(n*n*n)
}

Measured memory_bytes: 640
mod = 10 ** 9 + 7

K = map(int, iter(input()))
D = int(input())

s = 0
dp = [0] * D
for k in K:
    ndp = [0] * D
    for d in range(10):
        for i, dpi in enumerate(dp):
            ndp[(i + d) % D] += dpi

    for d in range(k):
        ndp[(s + d) % D] += 1

    s = (s + k) % D
    dp = [x % mod for x in ndp]

print((dp[0] - (s != 0)) % mod)

Measured memory_bytes: 43996
#include <stdio.h>

int main(int argc, char *argv[])
{
    int a, b, c;
    scanf("%d %d %d", &a, &b, &c);
    const char *const answer = ((a < b) && (b < c)) ? "Yes" : "No";
    printf("%s\n", answer);
    return 0;
}



Measured memory_bytes: 2132
N=int(input())
S=input()
all=S.count("R") * S.count("G") * S.count("B")

for i in range(N-1):
  for j in range(i,N):
    if 0 <= 2*i-j < N:
      if S[2*i-j] != S[i] != S[j] != S[2*i-j]:
        all -= 1
print(all)


Measured memory_bytes: 9112
#include <bits/stdc++.h>
#include <cmath>
using namespace std;
int main() {
	int n;
	cin >> n;
	while (n) {
		if (n % 10 == 7) {
			cout << "Yes";
			return 0;
		}
		n = n / 10;


	}
	cout << "No";


}

Measured memory_bytes: 3592
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;
using System.Text;
using System.IO;
using static System.Math;
namespace AtCoder
{
    class Program
    {
        static public long[] Sarray() { return ReadLine().Split().Select(long.Parse).ToArray(); }
        static public List<long> Slist() { return ReadLine().Split().Select(long.Parse).ToList(); }

        static readonly long Mod = 1000000000 + 7;

        static void Main(string[] args)
        {
            //SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
            var S = ReadLine();
            var cent = S.Length / 2 - 1;
            for (var i = S.Length - 2; 0 < i; i -= 2)
            {
                if (S.Substring(0, i / 2) == S.Substring(i / 2, i / 2))
                {
                    WriteLine(i);
                    return;
                }
            }
            //Out.Flush();
        }
    }
}

Measured memory_bytes: 11092
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(ll i=0, i##_len=(n); i<i##_len; ++i)
#define repin(a,n) vector<ll> a(n);rep(i,n){cin>>a[i];}
#define repins(a,n) vector<string> a(n);rep(i,n){cin>>a[i];}
#define repind(a,n) vector<double> a(n);rep(i,n){cin>>a[i];}
#define in(a) ll a;cin>>a;
#define ins(a) string a;cin>>a;
#define ind(a) double a;cin>>a;
template<class T>
inline void out(T a){cout<<a<<endl; }
inline void out(double a){ printf("%.10f\n", a);} 
#define all(x) (x).begin(),(x).end()
#define rep2(i,a,b) for(ll i=(a);i<(b);++i)
#define range(i,s,c) for(ll i=(s);i<(s+c);++i)
using vell = vector<ll>;
using ves = vector<string>;
using ved = vector<double>;

ll mod = 1000000007;

ll mmul(ll a, ll b) { return ((a % mod) * (b % mod)) % mod;}

ll mpow(ll a, ll b) {
	if (b == 0) return 1;
	if (b % 2 == 0) {
		ll d = mpow(a, b / 2);
		return (d * d) % mod;
	}
	return (a * mpow(a, b - 1)) % mod;
}

ll mdiv(ll a, ll b) { return mmul(a, mpow(b, mod - 2)); }

int main()
{
	in(n);
	in(k);
	repin(h,n);

	ll ans = 0;
	rep(i,n){
		if(h[i]>=k){
			ans++;
		}
	}
	out(ans);
}

Measured memory_bytes: 1024
/*
─────────────────────
───────────████████──
──────────███▄███████
──────────███████████
──────────███████████
──────────██████─────
──────────█████████──
█───────███████──────
██────████████████───
███──██████████──█───
███████████████──────
███████████████──────
─█████████████───────
──███████████────────
────████████─────────
─────███──██─────────
─────██────█─────────
─────█─────█─────────
─────██────██────────
─────────────────────
*/
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>

#define int long long
#define read(a) int a; cin >> a;
#define readb(a, b) int a, b; cin >> a >> b;
#define readc(a, b, c) int a, b, c; cin >> a >> b >> c;
#define reads(s) string s; cin >> s;
#define readarr(a, n) int a[(n) + 1] = {}; fori (i, 1, n) {cin >> a[i];}
#define readmat(a, n, m) int a[(n) + 1][(m) + 1] = {}; fori (i, 1, n) {fori (j, 1, m) cin >> a[i][j];}

#define print(a) cout << a << endl;
#define printarr(a, n) fori (i, 1, n) cout << a[i] << " "; cout << endl;
#define printv(v) for (int i: v) cout << i << " "; cout << endl;
#define printmat(a, n, m) fori (i, 1, n) {fori (j, 1, m) cout << a[i][j] << " "; cout << endl;}
#define all(v) v.begin(), v.end()
#define sz(s) (int)(s.size())
#define pb push_back
#define fi first
#define se second
#define rz resize
#define fori(i, a, b) for (int i = (a); i <= (b); i++)
#define ford(i, a, b) for (int i = (a); i >= (b); i--)
#define endl '\n'
#define setprec(x) cout << fixed << setprecision(x);
 
using namespace std;
using namespace __gnu_pbds; 
 
typedef tree<long long,null_type,less<long long>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef vector<pair <int, int>> vpi;
typedef vector < vector <int> > vvi;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 
const int INF = 4e18;
const int mod = 1e9+7; 

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

    #ifndef ONLINE_JUDGE 
        freopen ("INPUT.txt" , "r" , stdin);
        freopen ("OUTPUT.txt" , "w" , stdout);
        freopen ("OUTPUT_ERROR.txt" , "w" , stderr);
    #endif

    //start from here

    read(n) readarr(a, n)

    map <int, int> mp;

    fori (i, 1, n)
    {
        mp[a[i]]++;
        if(mp[a[i]] > 1) {cout << "NO"; return 0;}
    }

    print("YES")

    return 0;
}




Measured memory_bytes: 17604
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
using namespace std;
const int MAX = 100005;
const int NIL = -1;


struct Node {
    int p, l, r;
};
Node Tree[MAX];
int n, Depth[MAX];


void print(int u) {
    printf("node %d: ", u);
    printf("parent = %d, ", Tree[u].p);
    printf("depth = %d, ", Depth[u]);

    if (Tree[u].p == NIL)
        printf("root, ");
    else if (Tree[u].l == NIL)
        printf("leaf, ");
    else
        printf("internal node, ");

    printf("[");
    // 浠庡瓙缁撶偣鐨勬渶宸﹁竟寮€濮嬮亶鍘?
    int c = Tree[u].l;
    while (c != NIL) {
        printf("%d", c);
        if (Tree[c].r != NIL)
            printf(", ");
        // 璺冲埌鍙充晶绱ч偦鐨勫厔寮熺粨鐐?
        c = Tree[c].r;
    }
    printf("]\n");
}

// 閫掑綊寰楁眰娣卞害
void rec(int u, int depth) {
    Depth[u] = depth;
    if (Tree[u].r != NIL)  // 鍙充晶鍏勫紵璁剧疆涓虹浉鍚屾繁搴?
        rec(Tree[u].r, depth);
    if (Tree[u].l != NIL)  // 鏈€宸︿晶瀛愮粨鐐圭殑娣卞害璁剧疆涓鸿嚜宸辩殑娣卞害 + 1
        rec(Tree[u].l, depth + 1);
}
int main() {
    int n;
    scanf("%d", &n);

    for (int i = 0; i < n; i++) {
        Tree[i].p = Tree[i].l = Tree[i].r = NIL;
    }
    int v, num, c, l, root;
    for (int i = 0; i < n; i++) {
        // v鏄綋鍓嶇粨鐐瑰€?锛宯um鏄痸缁撶偣鐨勫瓙缁撶偣鏁?
        scanf("%d %d", &v, &num);
        for (int j = 0; j < num; j++) {
            scanf("%d", &c);

            //璁剧疆鏈€宸︿晶缁撶偣 鍜?绱ч偦鍙充晶鍏勫紵缁撶偣
            // l璁板綍鐨勬槸涓婁竴涓粨鐐癸紝灏嗗綋鍓嶇殑缁撶偣璁剧疆涓簂鐨勭揣閭诲彸渚х粨鐐?
            if (j == 0)
                Tree[v].l = c;
            else
                Tree[l].r = c;
            l = c;
            // 璁剧疆鐖剁粨鐐?
            Tree[c].p = v;
        }
    }
    // 鎵惧嚭鏍圭粨鐐?
    for (int i = 0; i < n; i++) {
        if (Tree[i].p == NIL)
            root = i;
    }

    rec(root, 0);
    for (int i = 0; i < n; i++)
        print(i);
    return 0;
}


Measured memory_bytes: 7756
import java.util.*;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        int max = Math.max(Math.max(a,b),c);
        int min = Math.min(Math.min(a,b),c);
        System.out.println(max-min);
    }
}

Measured memory_bytes: 21844
import java.util.*;
public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        if(n==1){
            System.out.println("Hello World");
        }
        else{
            int a = sc.nextInt();
            int b = sc.nextInt();
            System.out.println(a+b);
        }
    }
}

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

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int a, b;
  cin >> a >> b;
  cout << a * b - (a + b - 1) << endl;
  return 0;
}

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

using namespace std;

int main(){
	string s;
	cin >> s;
	for(int i = 0; i < 3; i++){
		if(s[i] == '1') s[i] = '9';
		else if(s[i] == '9') s[i] = '1';
	}

	cout << s << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <cctype>
#include <cmath>
#include <iomanip>
#include <climits>
#include <cfloat>
#define ll long long
#define uint unsigned
#define MOD 1000000007
using namespace std;

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

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

    // --------------------------------
    size_t n {};
    cin >> n;

    string s {}, t {};
    cin >> s >> t;

    for (size_t i {}; i < n; ++i) {
    	cout<<s.at(i)<<t.at(i);
    }
    cout<<endl;
    return 0;
}

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

long long inputs[200005];
long long oddsum[200005];
long long evensum[200005];

int main(){
   int n,m,x;
   cin >> n >> m >> x;
   map<int,int>mp;
   for(int i=0; i<m; i++)
   {
       int a;
       cin >> a;
       mp[a]++;
   }
   int an1 = 0 , an2 = 0 ;

   for(int i=x; i<=n; i++)
   {
       an1 += mp[i];
   }for(int i=x; i>=0; i--)
   {
       an2 += mp[i];
   }

   cout << (min(an1,an2)) << endl;

}


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

#define ll long long
#define value(x) cout << #x << " " << x << '\n';
#define print_vec(vec)    \
    for (auto x : vec)    \
        cout << x << " "; \
    cout << endl;

void solve()
{
    int a;
    cin >> a;
    cout << a + (a * a) + (a * a * a) << '\n';
}

int main()
{
    int t = 1;
    // cin>>t;
    while (t--)
        solve();
}

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

int main(){

  int n;
  cin >> n;

  int mm[201][201];
  for(int i=1;i<201;i++){
    for(int j=1;j<201;j++){
      int I = i; int J = j;
      if(J<I){int temp=I; I=J; J=temp;}
      while(true){
        int templ = J;
        J = I % J;
        I = templ;
        if(J==0){mm[i][j]=I; break;}
        if(J==1){mm[i][j]=J; break;}
      }
    }
  }


  int cnt = 0;
  for(int i=1;i<n+1;i++){
    for(int j=1;j<n+1;j++){
      for(int k=1;k<n+1;k++){
        cnt += mm[mm[i][j]][mm[j][k]];
      }
    }
  }

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


Measured memory_bytes: 3720
import java.util.*;

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

		int n=sc.nextInt();
		int k=sc.nextInt();

		long[] a= new long[n];

		int mod=(int)Math.pow(10,9)+7;

		for(int i=0;i<n;i++){
			a[i]=sc.nextInt()%mod;
		}

		Arrays.sort(a);
		
		int left=0;
		int right=n-1;
		
		long ans= k%2==0? 1:a[right--];
		int c=1;
		if(ans<0)c=-1;
		
		while(k>=2) {
			if(c*a[left]*a[left+1]>c*a[right]*a[right-1]) {
				ans=ans*a[left]%mod;
				ans=ans*a[left+1]%mod;
				left+=2;
			}else {
				ans=ans*a[right]%mod;
				ans=ans*a[right-1]%mod;
				right-=2;
			}
			k-=2;
		}
		



		if(ans<0)ans+=mod;
		System.out.println(ans);

	}
}

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

public class Main {

    public static void main(String[] args) throws IOException {
        BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
        String line[] = line = bf.readLine().split("\\s");
        int n = Integer.parseInt(line[0]);
        int w = Integer.parseInt(line[1]);
        int wt[] = new int[n];
        int val[] = new int[n];

        for (int i = 0; i < n; ++i) {
            line = bf.readLine().split("\\s");
            wt[i] = Integer.parseInt(line[0]);
            val[i] = Integer.parseInt(line[1]);
        }
        int total_value = 0;
        for (int value : val) total_value += value;
        long[] dp = new long[total_value + 1];
        dp[0] = 0;
        long INF = Long.MAX_VALUE - Integer.MAX_VALUE;
        for (int i = 1; i < total_value + 1; i++) {
            dp[i] = INF;
        }

        for (int i = 0; i < n; i++) {
            for (int v = total_value - val[i]; v >= 0; v--) {
                dp[v + val[i]] = Math.min(dp[v + val[i]], dp[v] + wt[i]);
            }
        }
        long ans = 0;
        for (int i = 0; i <= total_value; i++) {
            if (dp[i] <= w) {
                ans = Math.max(ans, i);
            }
        }

        System.out.println(ans);


    }
}


Measured memory_bytes: 22996
#include <stdio.h>
int main(void){
    char x[4096];
    int sum,i;
 
    while(1){
        scanf("%s",x);
        if(x[0] ==  '0' && x[1] == '\0')
            break;
        sum = 0;i = 0;
        while(x[i] != '\0')
            sum += x[i++] - '0';
        printf("%d\n",sum);
    }
    return 0;
}



Measured memory_bytes: 2112
n, a, b = map(int, input().split())
ans_array = []
for i in range(1, n + 1):
    s = str(i)
    array = list(map(int, s))
    sum_array = sum(array)
    if sum_array >= a and sum_array <= b:
        ans_array.append(i)
print(sum(ans_array))

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

int main(){
  int N,cnt=0;
  bool f=true;
  string s,t;
  cin>>N>>s>>t;
  while(f){
    for(int i=0;i<N;i++){
      if(s[s.size()-i-1]!=t[t.size()-i-1]){
        s+=t[t.size()-cnt-1];
        cnt++;
      }
      if(i==N-1) f=false;
    }
  }
  cout<<s.size()<<endl;
}



Measured memory_bytes: 256
while True:
   H, W = map(int, input().split())
   if H == 0 and W == 0:
      break
   for i in range(int(H/2)):
      if W % 2 == 0:
         print("#." * int(W/2))
      else:
         print("#."*int(W/2) + "#")
      if W % 2 == 0:
         print(".#" * int(W/2))
      else:
         print(".#"*int(W/2) + ".")
   if H % 2 != 0:
      if W % 2 == 0:
         print("#." * int(W/2))
      else:
         print("#."*int(W/2) + "#")
   print("")


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

int main() {
  int N; cin >> N;
  int C[10][10];
  for (int i = 0; i < 10; i++) {
    for (int j = 0; j < 10; j++) {
      C[i][j] = 0;
    }
  }
  int place = 1;
  for (int i = 1; i <= N; i++) {
    if (i / place >= 10) place *= 10;
    if (i % 10 == 0) continue;
    C[i / place][i % 10]++;
  }
  int count = 0;
  for (int i = 1; i < 10; i++) {
    for (int j = 1; j < 10; j++) {
      count += C[i][j] * C[j][i];
    }
  }
  cout << count << endl;
}


Measured memory_bytes: 256
n = int(input())
S = [None] * n
T = [None] * n
for i in range(n):
    S[i], T[i] = input().split()
x = input()
sleep_song_index = S.index(x)

counter = 0
for i in range(sleep_song_index+1, n):
    counter += int(T[i])
print(counter)

Measured memory_bytes: 38384
import java.util.Scanner;
public class Main {
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		String S = scan.nextLine();

		if (S.equals("ABC")){
			System.out.println("ARC");
		}else if (S.equals("ARC")){
			System.out.println("ABC");
		}
	}
}

Measured memory_bytes: 35756
#include<bits/stdc++.h>
using namespace std;
 
// #define int long long int
#define ff first
#define ss second
#define pb push_back
 
int bexp(int a, int b, int mod)
{
    int res = 1;
    if (mod <= 0)
        return 0;
 
    while (b)
    {
        if (b & 1) res = (res * a) % mod;
 
        a = (a * a) % mod; 
        b >>= 1;
    }
    return res;
}
 
#define N 300010
#define MOD 1000000007
 
int gcd(int a, int b)
{
    if (b == 0)
        return a;
    return gcd(b, a % b);
}

struct comp {
    bool operator() (const pair<int, int> a, const pair<int, int> b) const
    {
        return a.ss * (a.ff - a.ff / 2) > b.ss * (b.ff - b.ff / 2);
    }
};


vector<int> getprimes()
{
    int f[1001] = {};
    vector<int> ans;

    f[1] = 1, f[0] = 1;
    f[2] = 0;
    for (int i = 2; i < 1001; ++i)
    {
        if (f[i] == 0)
        {
            for (int j = i * i; j < 1001; j += i)
            {
                f[j] = 1;
            }
        }
    }
    ans.push_back(2);

    for (int i = 3; i < 1001; i += 2)
        if (f[i] == 0)
            ans.push_back(i);

    return ans;
}

int32_t main()
{
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    cout.precision(10);

    int n;
    cin >> n;

    int a;
    int k = 0;
    int p = 1;

    vector<int> primes = getprimes();
    set<int> si;
    for (int i = 0; i < n; ++i)
    {
        cin >> a;
        k = __gcd(k, a);

        int l = a;

        for (int k : primes)
        {
            if (k * k > a)
                break;
            if (a % k == 0)
            {
                if (si.insert(k).ss == false) p = 0;

                while (a % k == 0) a /= k;
                
            }
        }

        if (a > 1)
        {
            if (si.insert(a).second == false) p = 0;
        }
    }


    if (p == 1)
        cout << "pairwise coprime\n";
    else if (k == 1)
        cout << "setwise coprime\n";
    else
        cout << "not coprime\n";
    return 0;
}

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

int main(){
	long long int N,K,X,Y,ans;
	scanf("%lld %lld %lld %lld",&N,&K,&X,&Y);
	if (N<K){
		ans=N*X;
	}else{
		ans=K*X+(N-K)*Y;
	}
	cout << ans;
	return 0;
}

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

#define ll long long
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define fi first
#define se second
#define PI 3.1415926535897932384626433832795
#define MOD 1000000007

using namespace std;
ll power(ll a,ll n)
{
          ll result=1;
          while(n>0)
          {
               if(n&1)
                    result=result*a;
               a=a*a;
               n=n>>1;
          }
          return result;
}
ll lcm(ll a,ll b)
{
          return ((a*b)/__gcd(a,b));
}
bool ispow2(ll n)
{
          return (ceil(log2(n))==floor(log2(n)));
}
bool isprime(ll n)
{
          if(n==1)
               return false;
          else if(n==2)
               return true;
          else
          {
               for(ll i=2;i*i<=n;++i)
               {
                    if(n%i==0)
                         return false;
               }
               return true;
          }
}

ll ncr(ll n,ll r)
{
    if(r > n - r)
          r = n - r;
    ll ans = 1;
    ll i;

    for(i = 1; i <= r; i++)
     {
        ans *= n - r + i;
        ans /= i;
    }

    return ans;
}
void sieve(int n)
{
    // Create a boolean array "prime[0..n]" and initialize
    // all entries it as true. A value in prime[i] will
    // finally be false if i is Not a prime, else true.
    bool prime[n+1];
    memset(prime, true, sizeof(prime));
     prime[1]=false;
     prime[0]=false;
    for (int p=2; p*p<=n; p++)
    {
        // If prime[p] is not changed, then it is a prime
        if (prime[p] == true)
        {
            // Update all multiples of p greater than or
            // equal to the square of it
            // numbers which are multiple of p and are
            // less than p^2 are already been marked.
            for (int i=p*p; i<=n; i += p)
                prime[i] = false;
        }
    }

    // Print all prime numbers
    for (int p=2; p<=n; p++)
       if (prime[p])
          cout<<p<<" ";
}
int main()
{
          ios_base::sync_with_stdio(0);
          cin.tie(0);

          int t=1;
          //cin>>t;
          while(t--)
          {
                    double d,t,s;
                    cin>>d>>t>>s;
                    double temp = d/s;

                    if(temp<=t)
                         cout<<"Yes";
                    else
                         cout<<"No";
          }
          return 0;
}


Measured memory_bytes: 3760
#pragma GCC optimize (2)
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=100005;
int a[N], b[N], c[N];
inline int read()
{
    int x=0,f=1;char ch=getchar();
    for (;ch<'0'||ch>'9';ch=getchar()) if (ch=='-') f=-1;
    for (;ch>='0'&&ch<='9';ch=getchar()) x=(x<<1)+(x<<3)+ch-'0';
    return x*f;
}
bool cmp(ll p,ll q){return p>q;}

int main()
{
	int n=read(), cnt=0, ans=0; ll sum=0;
	for (int i=1;i<=n;i++) a[i]=read();
	for (int i=1;i<=n;i++) b[i]=read();
	for (int i=1;i<=n;i++)
	{
		if (a[i]>b[i]) c[++cnt]=a[i]-b[i];
			else if (a[i]<b[i]) {ans++;sum+=(b[i]-a[i]);}
	}
	if (sum==0) {puts("0");return 0;}
	sort(c+1,c+1+cnt,cmp);
	for (int i=1;i<=cnt;i++)
	{
		if (sum>=c[i]) sum-=c[i];
		else sum=0;
		ans++;
		if (sum==0) break;
	}
	if (sum) puts("-1");
		else printf("%d\n",ans);
	return 0;
}


Measured memory_bytes: 1280
#include <stdio.h>

int main()
{
	int number[3],i,j,k;
	scanf("%d %d %d", number, number + 1, number + 2);
	for (i = 0; i < 2; i++){
		if (number[i]>number[i + 1]){
			j = number[i];
			number[i] = number[i + 1];
			number[i + 1] = j;
		}

	}
	if (number[0] > number[1]){
		k = number[0];
		number[0] = number[1];
		number[1] = k;
	}
	printf("%d %d %d\n", number[0], number[1], number[2]);
	return 0;
}

Measured memory_bytes: 596
import java.util.Scanner;

public class Main {

    private static long f(long n) {
        // nが偶数のとき
        if (n % 2 == 0) {
            // 1 xor 1 xor ...  xor 1 の1が偶数個
            if ((n / 2) % 2 == 0) {
                return n;
            }
            // 奇数個
            return 1 ^ n;
        }
        // nが奇数のとき
        return f(n - 1) ^ n;
    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long a = sc.nextLong();
        long b = sc.nextLong();

        System.out.println(f(a - 1) ^ f(b));
    }

}


Measured memory_bytes: 23252
#include <iostream>

using namespace std;
typedef long long ll;

ll N, K;
ll ans;

int main()
{
    cin >> N >> K;

    ll tmp = N / K;

    ans = tmp * tmp * tmp;
    if (K % 2 == 0) {
        if (N % K < K / 2)
            ans = ans * 2;
        else
            ans += (tmp + 1) * (tmp + 1) * (tmp + 1);
    }

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


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import java.util.StringTokenizer;

public class Main {
  public static void main(String[] args) {
    FastReader sc = new FastReader();
    int n = sc.nextInt();
    Map<String, Long> map = new HashMap<>();
    
    for (int i = 0; i < n; i++) {
    	String s = sc.next();
    	char[] tmpChar = s.toCharArray();
    	Arrays.sort(tmpChar);
    	String key = new String(tmpChar);
    	
    	if (map.containsKey(key)) {
    		if (map.get(key) == 0) {
    			map.put(key, 1L);
    		} else {
    			map.put(key, map.get(key) + 1);
    		}
    	} else {
    		map.put(key, 0L);
    	}
    }
    long res = 0;
    
    for (String key: map.keySet()) {
    	long a = map.get(key);
    	res += (((a + 1) * a) / 2);
    }
    
    System.out.println(res);
  }

  static class FastReader {
    BufferedReader br;
    StringTokenizer st;

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

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

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

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

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


Measured memory_bytes: 45128
import sys

sys.setrecursionlimit(10 ** 8)
ini = lambda: int(sys.stdin.readline())
inm = lambda: map(int, sys.stdin.readline().split())
inl = lambda: list(inm())
ins = lambda: sys.stdin.readline().rstrip()
debug = lambda *a, **kw: print(*a, **dict(file=sys.stderr, **kw))

N = ini()
A = [ini() for _ in range(N)]


def solve():
    c = 0
    ans = 0
    for i in range(N - 1, -1, -1):
        s = A[i]
        if s > i:
            return -1
        if s < c:
            return -1
        if s > c:
            ans += s
        c = s - 1
    return ans


print(solve())


Measured memory_bytes: 17060
#include<iostream>
using namespace std;
int main(void) {
    int n;
    cin >> n;

    int numbers[n];
    for (int i = 0; i < n; i++) {
        cin >> numbers[i];
    }
    cout << numbers[n - 1];
    for (int i = n - 2; i >= 0; i--) {
        cout << " " << numbers[i];
    }
    cout << endl;

    return 0;
}

Measured memory_bytes: 1160
#include <cstdio>
#include <cmath>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <algorithm>

#ifdef _DEBUG
#define DMP(x) cerr << #x << ": " << x << "\n"
#else
#define DMP(x) ((void)0)
#endif

const int MOD = 1000000007, INF = 1111111111; 
using namespace std;
typedef long long lint;

int main() {

	cin.tie(0);
	ios::sync_with_stdio(false);

	int N;
	cin >> N;

	double x, ans = 0.0;
	string u;
	for (int i = 0; i < N; i++) {

		cin >> x >> u;
		if (u == "JPY") ans += x;
		else ans += x * 380000.0;

	}

	cout.precision(15);
	cout << ans << "\n";

	return 0;
}

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

typedef long long ll;
typedef long double ld;

#define pb push_back
#define sort(s) sort(s.begin(),s.end())
#define reverse(s) reverse(s.begin(),s.end())
#define rep(i,n) for(ll (i)=0;(i)<(n);(i)++)

const ll mod = 1e9+7;

//最大公約数
ll gcd(ll a, ll b) {
    return b ? gcd(b, a%b) : a;
}

//最小公倍数
ll lcm(ll a, ll b) {
    return a / gcd(a, b) * b;
}

//素数判定
bool isPrime(ll x){
    ll i;
    if(x < 2)return 0;
    else if(x == 2) return 1;
    if(x%2 == 0) return 0;
    for(i = 3; i*i <= x; i += 2) if(x%i == 0) return 0;
    return 1;
}

//桁和
int digsum(ll n) {
    int res = 0;
    while(n > 0) {
        res += n%10;
        n /= 10;
    }
    return res;
}

//桁数
int dignum(ll n) {
    int res = 0;
    while(n > 0) {
        res++;
        n /= 10;
    }
    return res;
}

//文字列中の特定の文字カウント
ll stringcount(string s,char c){
    return count(s.cbegin(),s.cend(),c);
}

//階乗
ll ka(ll i){
    ll res=1;
    while(i>0){
        res=res*i;
        i--;
    }
    return res;
}
 
//ncr
ll ncr(ll x,ll y){
    ll a = x;
    ll b = 1;
    if(y>(x/2)){
        y=x-y;
    }
    for(ll i=1;i<y;i++){
        a*=x-i;
        b*=i+1;
    }
    return a/b;
}

//フィボナッチ数列 -92
ll f(ll x){
    ll dp[x+1];
    dp[1]=1;
    dp[2]=1;
    for(ll i=3;i<=x;i++){
        dp[i]=dp[i-1]+dp[i-2];
    }
    return dp[x];
}



int main(){
    int a,p;
    cin >> a >>p;
    int x = a*3+p;
    cout << x/2 << endl;
}

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

using namespace std;


int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
   int a,b,c,k; cin>>a>>b>>c>>k;
    if(k<=a) cout<<k<<'\n'; 
    else if(k>a && k<= (a+b)) cout<<a<<'\n';
    else if(k>(a+b) ) cout<<2*a-k+b <<'\n';
    
   
    return 0;
}

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

using namespace std;

int main() {

    int t;
    cin >> t;
    vector < pair < string, pair < int, int > >> a;
    for (int i = 0; i < t; i++) {
        string s;
        cin >> s;
        int x;
        cin >> x;
        a.push_back({
            s,
            {
                x,
                i + 1
            }
        });
    }
    sort(a.begin(), a.end());

    stack < int > st;
    for (int i = 0; i < t; i++) {
        if (st.empty()) {
            st.push(a[i].second.second);
        } else if (a[i].first == a[i - 1].first) {
            st.push(a[i].second.second);
        } else {
            while (!st.empty()) {
                cout << st.top() << endl;
                st.pop();
            }
            st.push(a[i].second.second);
        }
    }
    while (!st.empty()) {
        cout << st.top() << endl;
        st.pop();
    }

    return 0;
}

Measured memory_bytes: 256
#if defined(LOCAL)
#define PROBLEM_NAME "a"
const double _max_double_error = 1e-9;
#include "testutils.h"
#define L(x...) (debug(x, #x))
#define C(x...) CHECK(x)
#else
#define L(x, ...) (x)
#define C(x, ...) ;
#include <bits/stdc++.h>
#endif

using namespace std;
using vi = vector<int>; using vvi = vector<vi>;
using ii = pair<int,int>; using vii = vector<ii>;
using l = long long; using vl = vector<l>; using vvl = vector<vl>;
using ll = pair<l,l>; using vll = vector<ll>; using vvll = vector<vll>;
using lu = unsigned long long;
using vb = vector<bool>; using vvb = vector<vb>;
using vd = vector<double>; using vvd = vector<vd>;
using mll = unordered_map<l, l>;
const l INF = numeric_limits<l>::max();
const double EPS = 1e-10; static constexpr auto PI = acos(-1);
const l e0=1, e3=1000, e5=100000, e6=10*e5, e7=10*e6, e8=10*e7, e9=10*e8;
const char lf = '\n';
#define all(x) begin(x), end(x)
#define F(a,b,c) for (l a = l(b); a < l(c); a++)
#define B(a,b,c) for (l a = l(c) - 1; a >= l(b); a--)
#define MAX(a,b)({__typeof__(a)__x=(a);__typeof__(b)__y=(b);__x<__y?__y:__x;})
#define MIN(a,b)({__typeof__(a)__x=(a);__typeof__(b)__y=(b);__x<__y?__x:__y;})

l d(l a, l b, l c) {
  if (a == b) return c;
  if (a == c) return b;
  return a;
}

void solve(istream& cin, ostream& cout) {
  l a, b, c; cin >> a >> b >> c;
  cout << d(a, b, c) << endl;
}

int main() {
  ios_base::sync_with_stdio(false); cin.tie(0);
  cout << fixed << setprecision(15);
#if defined(LOCAL)
  // _generate_random_test = generate_random;
  // _solve_brute = solve_brute;
  // _player_b = player_b;
  // _custom_solution_checker = solution_checker;
  maybe_run_tests(cin, cout);
#else
  solve(cin, cout);
#endif
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pp;
void read(int& x){ scanf("%d",&x); }
template<typename T,typename... Args>
void read(T& a,Args&... b){ read(a); read(b...); }
#define all(x) (x).begin(),(x).end()
#define pb push_back

int n;
char a[510][510];

int main()
{
    read(n);
    int s=0;
    for(int i=0; i<n; ++i){
		scanf("%s", a[i]);
		for(int j=0; j<n; ++j) s+=(a[i][j]=(a[i][j]=='#'));
    }
    if(!s){
		puts("-1");
		return 0;
    }
    int ans=1e9;
    for(int i=0; i<n; ++i){
    	bool f=1;
		for(int j=0; j<n; ++j){
			if(!a[i][j]) f=0;
		}
		if(f){
			int c=0;
			for(int i=0; i<n; ++i){
				int f=1;
				for(int j=0; j<n; ++j)
					if(!a[j][i]) f=0;
				if(!f) ++c;
			}
			printf("%d\n", c);
			return 0;
		}
    }
    int ec=0;
    for(int i=0; i<n; ++i){
		int f=1;
		for(int j=0; j<n; ++j) if(!a[j][i]) f=0;
		if(!f) ++ec;
    }
    for(int i=0; i<n; ++i){
		bool f=0;
		for(int j=0; j<n; ++j){
			if(a[j][i]) f=1;
		}
		int c=0;
		for(int j=0; j<n; ++j){
			if(!a[i][j]) ++c;
		}
		ans = min(ans, c + ec + 1-f);
    }
    if(ans == int(1e9)){
		ans=-1;
    }
    printf("%d\n", ans);
    return 0;
}


Measured memory_bytes: 512
#!/usr/bin/env python
from collections import deque, defaultdict
from itertools import combinations, combinations_with_replacement
import bisect
from math import factorial, sqrt, log, ceil, floor

def main():
    N, M = map(int, input().split())
    Hs = list(map(int, input().split()))

    bads = set()
    height = {idx+1: h for idx, h in enumerate(Hs)}
    for m in range(M):
        A, B = map(int, input().split())

        if height[A] <= height[B]:
            bads.add(A)
        if height[B] <= height[A]:
            bads.add(B)

    print(N - len(bads))


if __name__ == '__main__':
    main()


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

int main() {
	int N;
	cin >> N;
	vector <int> pn(N);
	for (int i=0;i<N;i++){
		cin >> pn.at(i);
	}
	
	bool pro =true;
	vector<int> num(0);
	for (int i=0;i<N-1;i++){
		if(pn.at(i)>=pn.at(i+1)){
			num.push_back(i+1);
		}
	}
	
	if (num.size()>2||num.size()==1){
			pro =false;
	}
	
	else if (num.size()==2){
		if(pn.at(num.at(1))<pn.at(num.at(0)) && pn.at(num.at(1)-1)<pn.at(num.at(0)-1)){
		}
		else {
			pro = false;
		}
	}
	
	if (pro){
		cout << "YES"<< endl;
	}
	
	else {
		cout << "NO"<< endl;
	}
	
	
	
}


Measured memory_bytes: 256
n = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
need1 = 0
need2 = 0
for i in range(n):
    s = B[i]-A[i]
    if s < 0:
        need1 -= s
    else:
        need2 += s//2
if need1 > need2:
    print("No")
else:
    print("Yes")

Measured memory_bytes: 4596
//#include <algorithm>
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <unordered_map>
//#include <math.h>

using namespace std;

using ll = long long;
using ld = long double;
using ull = unsigned long long;

template<class T> using vec = vector<T>;
template<class T> using vvec = vector<vector<T>>;

#define REP(i, s, e) for (ll i = s; i < e; ++i)

ll calc(ll n)
{
    if (n < 2) return 0;

    ll c = 1;
    for (ll i = n; i > n - 2; --i)
    {
        c *= i;
    }

    return c / 2;
}

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

    ll N; cin >> N;

    vec<ll> As(N);
    vec<ll> T(N);
    vec<ll> T2(N);
    REP(i, 0, N)
    {
        ll A; cin >> A;
        As[i] = A;
        T[A - 1] += 1;
    }

    ll sum = 0;
    REP(i, 0, N)
    {
        ll r = calc(T[i]);
        sum += r;
        T2[i] = r;
    }

    REP(i, 0, N)
    {
        ll n = As[i];
        cout << sum - T2[n - 1] + calc(T[n - 1] - 1) << endl;
    }

    return 0;
}


Measured memory_bytes: 7296
// ABC176E - Bomber
 
#include <bits/stdc++.h>
using namespace std;
 
typedef unsigned long long int ull;
typedef long long int ll;
 
int main() {
	int H, W, M;
	cin >> H >> W >> M;

	int h[M], w[M];
	map<int, int> row;
	map<int, int> col;
	set<pair<int,int>> bomb;
	for (int i = 0; i < M; i++) {
		cin >> h[i] >> w[i];
		row[h[i]]++;
		col[w[i]]++;
		bomb.insert(make_pair(h[i], w[i]));
	}

	int r_max = 0;
	for (int i = 1; i <= H; i++) {
		if (r_max < row[i]) {
			r_max = row[i];
		}
	}
	int c_max = 0;
	for (int i = 1; i <= W; i++) {
		if (c_max < col[i]) {
			c_max = col[i];
		}
	}

	set<int> r_max_num;
	for (int i = 1; i <= H; i++) {
		if (r_max == row[i]) {
			r_max_num.insert(i);
		}
	}
	set<int> c_max_num;
	for (int i = 1; i <= W; i++) {
		if (c_max == col[i]) {
			c_max_num.insert(i);
		}
	}

	if (r_max_num.size() * c_max_num.size() > M) {
		cout << r_max + c_max << endl;
		return 0;
	}

	for (auto i = r_max_num.begin(); i != r_max_num.end(); i++) {
		for (auto j = c_max_num.begin(); j != c_max_num.end(); j++) {
			if (bomb.find(make_pair(*i, *j)) == bomb.end()) {
				cout << r_max + c_max << endl;
				return 0;
			}
		}
	}

	cout << r_max + c_max - 1 << endl;

	return 0;
}


Measured memory_bytes: 76224
using System;
 
class main{
public static void Main(String[] g){
string s;
int a,b,c;
bool R;
string RS;
int N= int.Parse(Console.ReadLine());

 for(int i=0;i<N;i++){
s=Console.ReadLine();
string[] sa= s.Split();
a=int.Parse(sa[0]);
b=int.Parse(sa[1]);
c=int.Parse(sa[2]);
R=a*a-b*b==c*c||b*b-c*c==a*a||c*c-a*a==b*b;
RS=R?"YES":"NO";
Console.WriteLine(RS);
}}
}

Measured memory_bytes: 8912
#include<bits/stdc++.h>
using namespace std;
int main()
{
  string a,b,c;
  int d,e;
  cin>>a>>b>>d>>e>>c;
 
  if(a==c)
    d--;
  else
    e--;
  cout<<d<<" "<<e<<endl;
  return 0;
}
  

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define sz(x) int(x.size())
#define show(x) {for(auto i: x){cout << i << " ";} cout << endl;}
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main() {
  int N;
  cin >> N;
  vector<int> A(N);
  rep(i, N) cin >> A[i];
  ll cur = 1000;
  ll stock = 0;
  for (int i = 0; i < N; i++) {
    cur += stock * A[i];
    stock = 0;
    if (i < N-1 && (A[i] < A[i+1])) {
      ll x = cur / A[i];
      stock = x;
      cur -= x * A[i];
    }
  }
  cout << cur << '\n';
  return 0;
}

Measured memory_bytes: 3620
s = input()
n = 0
while n == 0:
  if s[len(s)-5:len(s)] == "dream":
    s = s[:len(s)-5]
  elif s[len(s)-5:len(s)] == "erase":
    s = s[:len(s)-5]
  elif s[len(s)-7:len(s)] == "dreamer":
    s = s[:len(s)-7]
  elif s[len(s)-6:len(s)] == "eraser":
    s = s[:len(s)-6]
  else:
    if len(s) == 0:
      n = 1
      print("YES")
    else:
      n = -1
      print("NO")


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

main(){
long A = 0;
long B = 0;
int C = 0;
int D = 0;

  cin >> A;
  cin >> B;
  cin >> C;
  cin >> D;
long N = B - A + 1;
long N_c = 0;
long N_d = 0;
long N_cd = 0;
  
  long cm = 1;
  int C_cm = C;
  int D_cm = D;
  //cout << min(C_cm,D_cm) << endl;
  while(true){
    
  if((C_cm % D_cm) == 0 || (D_cm % C_cm) == 0){
  cm = min(C_cm , D_cm);
  break;
  }else{
  if(C_cm > D_cm){
  C_cm = C_cm - D_cm; 
  }else{
  D_cm = D_cm - C_cm; 
  }
  }
    
  }
  //cout << cm << endl;
  cm = C / cm * D ;
  //cout << cm << endl;

  if(A % C == 0){
  N_c = 1;
  }
  if(A % D == 0){
  N_d = 1;
  }
  if(A % cm == 0){
  N_cd = 1;
  }
  //cout << N_cd << endl;
  
  N_c += (B / C) - (A / C) ;
  N_d += (B / D) - (A / D) ;
  N_cd += (B / cm) - (A / cm);
  
  //cout << N << endl;
  //cout << N_c << endl;
  //cout << N_d << endl;
  //cout << N_cd << endl;
  cout << N - N_c - N_d + N_cd << endl;
 
}

Measured memory_bytes: 256
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools
from collections import deque

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

DR = [1, -1, 0, 0]
DC = [0, 0, 1, -1]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()

class UnionFind():
    def __init__(self, n):
        self.parent = [i for i in range(n)]

    def unite(self, a, b):
        # set a's parent as b's parent
        r1 = self.root(a)
        r2 = self.root(b)
        if r1 == r2:
            return
        self.parent[r2] = r1

    def root(self, a):
        if self.parent[a] == a:
            return a
        par = self.root(self.parent[a])
        self.parent[a] = par
        return par

    def sameRoot(self, a, b):
        return self.root(a) == self.root(b)

    def reroot(self):
        for ix, a in enumerate(self.parent):
            self.parent[ix] = self.root(a)
        return

def main():
    N, M = LI()
    P = LI_()
    X, Y = [], []
    uf = UnionFind(N)
    for _ in range(M):
        x, y = LI_()
        uf.unite(x, y)
    cnt = 0
    for ix, p in enumerate(P):
        if uf.sameRoot(ix, P[ix]):
            cnt += 1
    print(cnt)
main()



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


vector<int> primes={2,3,5,7};
int primes_extend(int calc_from, int calc_to);
int factoring(int n, map<int,int> &factors);


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

	primes_extend(10,100);
	primes_extend(100,10000);
	primes_extend(10000,32767);

	map<int,int> factors;
	factoring(n,factors);

	cout << n << ":";
	for (pair<int,int> p:factors)
	{
	 	// fprintf(stderr,"%d: %d\n",p.first,p.second);
		for (int j=0;j<p.second;++j)
		{
			cout << " " << p.first;
		}
	}
	cout << endl;



}

int primes_extend(int calc_from, int calc_to)
{

	for (int i=calc_from;i<=calc_to;++i)
	{
		int j;
		int loop_max=sqrt(i);
		for (j=0;(primes[j]<=loop_max)&&(j<primes.size());++j)
		{
			if ((i%primes[j])==0)
			{
				// not prime...
				break;
			}
		}
		if ((j>=primes.size())||(primes[j]>loop_max))
		{
			primes.push_back(i);
		}
	}
	//fprintf(stderr,"count: %d\n",primes.size());
}

int factoring(int n, map<int,int> &factors)
{
	int maxfactor=sqrt(n);
	for (int i=0;(n>1)&&(primes[i]<=maxfactor);++i)
	{
		while ((n%primes[i])==0)
		{
			n/=primes[i];
			factors[primes[i]]++;
		}
	}
	if (n!=1)
	{
		factors[n]++;
	}

	return 0;
}






Measured memory_bytes: 3196
#ifdef DEBUG
#define _GLIBCXX_DEBUG
#endif
//#pragma GCC optimize("O3")
#include<bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef long double ld;

int main() {
#ifdef DEBUG
    freopen("input.txt", "r", stdin);
#else
    //    freopen("zalupa.in","r",stdin);
    //    freopen("zalupa.out","w",stdout);
#endif
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << setprecision(20);
    cout << fixed;
    ll n, m, v, p;
    cin >> n >> m >> v >> p;
    v = n-v;
    vector<ll> a(n);
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
    }
    sort(a.begin(), a.end());
    reverse(a.begin(), a.end());
    int ans = p;
    ll sum = 0;
    for (int i = p; i < n; i++) {
        sum += (a[i - 1] - a[i]) * (i + 1 - p);
//        sum +=
        if (sum > m * v || a[p - 1] - a[i] > m) {
            break;
        }
        ans++;
    }
    cout << ans;

    return 0;
}

Measured memory_bytes: 1024
using System;

class Program
{
	static void Main(string[] args)
	{
		string[] input = Console.ReadLine().Split(' ');
		string a = input[0], b = input[1], c = input[2];
		if(a[a.Length-1] == b[0] && b[b.Length-1] == c[0]){
			Console.WriteLine("YES");
		}else{
			Console.WriteLine("NO");
		}
	}
}

Measured memory_bytes: 13140