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

using namespace std;
using ll = long long;
const int MAXN = 3010;
const int mod = 998244353;
inline ll mul(ll a) { return a; }
template<typename... T> inline ll mul(ll a, T... b) { return (int) ((ll) a * (ll) mul(b...) % mod); }
inline int inv(int a) {
  a %= mod;
  if (a < 0) a += mod;
  int b = mod, u = 0, v = 1;
  while (a) {
    int t = b / a;
    b -= t * a; swap(a, b);
    u -= t * v; swap(u, v);
  }
  assert(b == 1);
  if (u < 0) u += mod;
  return u;
}
ll dp[MAXN][MAXN];
int ar[MAXN];
int n, k;

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

ll rec(int i, int sum) {
  if(sum == k) return n - i + 1;
  if(i == n || sum > k) return 0;
  ll &res = dp[i][sum];
  if(res != -1) return res;
  ll a = rec(i + 1, sum);
  ll b = rec(i + 1, sum + ar[i]);
  res = 0;
  add(res, a); add(res, b);
  return res;
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  memset(dp, -1, sizeof dp);
  cin >> n >> k;
  for(int i = 0; i < n; ++i) cin >> ar[i];
  rec(0, 0);
  ll res = 0;
  for(int i = 0; i < n; ++i) {
    add(res, rec(i, 0));
  }
  cerr << rec(0, 0) << '\n';
  cout << res << '\n';
  return 0;
}


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

typedef long long ll;
map<ll,ll>mp;
ll mod=1000000007;

void primefact(ll n)
{
    while(n%2==0)
    {
        mp[2]++;
        n/=2;
    }
    for(ll i=3;i*i<=n;i+=2)
    {
        while(n%i==0)
        {
            mp[i]++;
            n/=i;
        }
    }
    if(n>2)
    {
        mp[n]++;
    }
    return;
}
int main()
{
    ll n;
    cin>>n;
    for(ll i=2;i<=n;i++)
    {
        primefact(i);
    }
    ll prd=1;
    map<ll,ll>::iterator it;
    for(it=mp.begin();it!=mp.end();it++)
    {
        prd=(prd*((it->second)+1))%mod;
    }
    cout<<prd<<endl;
    return 0;
}

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

int main(){
  int A, B;
  int c = 0; 
  cin >> A >> B;
  
  for(int i = A;i <= B;i++){
    if(i % 10 == i / 10000){
      int t, h;
      t = i / 10;
      h = i % 10000;
      if(t%10 == h / 1000){
        c++;
      }
      else continue;
    }
    else continue;
  }
  cout << c << endl;
  return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	static Scanner scanner;

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

	    int k=gi();
	    int g=gi();

	    //System.out.print(String.valueOf(c));

        if (k==g) {
        	System.out.print("Yes");
        }else {
        	System.out.print("No");
        }


	}
	// 文字列として入力を取得
	public static String gs() {
		return scanner.next();
	}

	// intとして入力を取得
	public static int gi() {
		return Integer.parseInt(scanner.next());
	}

	// longとして入力を取得
	public static long gl() {
		return Long.parseLong(scanner.next());
	}

	// doubleとして入力を取得
	public static double gd() {
		return Double.parseDouble(scanner.next());
	}
}

Measured memory_bytes: 35592
def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

import sys
input = sys.stdin.readline
N, M, K = map(int, input().split())
mod = 998244353
ans = 0
g1 = [1, 1]
g2 = [1, 1]
inverse = [0, 1]

for i in range( 2, N + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )
for i in range(K+1):
    ans += pow(M-1, N-1-i, mod) * pow(M, 1, mod) * cmb(N-1, i, mod)
    ans %= mod
ans %= mod
print(ans)

Measured memory_bytes: 112344
import java.util.*;
public class Main {
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		while(sc.hasNext()){
		int d = sc.nextInt();
		int count=600/d;
		int sum=0;
		int x=0;
		for(int i=0;i<count;i++){
			sum+=(d*x*x);
			x+=d;
		}
		System.out.println(sum);
	}
	}
	
}

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

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

    string s; cin >> s;

    int ans = 0;

    for (int i=0; i<3; i++)
    {
        if (s[i]=='1') ans += 1;
    }

    cout << ans;

    cout << "\n";

    return 0;
}

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

using namespace std;

#ifdef _MSC_VER
#define __typeof__ decltype

template <class T>
int __builtin_popcount(T n) { return n ? 1 + __builtin_popcount(n & (n - 1)) : 0; }
#endif

#define foreach(it, c) for (__typeof__((c).begin()) it=(c).begin(); it != (c).end(); ++it)
#define all(c) (c).begin(), (c).end()
#define rall(c) (c).rbegin(), (c).rend()
#define popcount __builtin_popcount

const double EPS = 1e-10;
typedef long long ll;
typedef pair<int, int> pint;


int main()
{
	enum bit
	{
		a = 1,
		b = 1 << 1,
		c = 1 << 2,
		d = 1 << 3,
		e = 1 << 4,
		f = 1 << 5,
		g = 1 << 6,
		all = (1 << 7) - 1,
	};
	const int pat[] = { all^g, b|c, all^c^f, all^e^f, b|c|f|g
		, all^b^e, all^b, a|b|c|f, all, all^e };

	int n, disp, t;
	while (scanf("%d", &n), n != -1)
	{
		disp = 0;
		while (n--)
		{
			scanf("%d", &t);
			for (int i = 6; i >= 0; --i)
				printf("%d", ((disp ^ pat[t]) >> i) & 1);
			printf("\n");
			disp = pat[t];
		}
	}

	return 0;
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
using namespace std;
long long N,cnt1,cnt0,ans=1000000000LL;
int main(){
    cin>>N;
    int c[N+1];
    char color;
    for(int i=1;i<=N;i++){
        cin>>color;
        c[i]=(color=='W');
    }
    for(int i=1;i<=N;i++)c[i]=c[i]+c[i-1];
    for(int border=0;border<=N;border++){
        cnt1=c[border]-c[0];
        cnt0=N-(border)-(c[N]-c[border]);
        //cout<<cnt1<<" "<<cnt0<<endl;
        ans=min(ans,max(cnt0,cnt1));
    }
    //cout<<endl<<cnt[0]<<" "<<cnt[1]<<endl;
    cout<<ans<<endl;
    return 0;
}

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

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REP1(i,n) for(int i=1, i##_len=(n); i<i##_len; ++i)
#define ll long long
static const int MAX = 10000;
static const ll INFTY = 1e12;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

const ll MRINF = 5000000000000000;

int main() {

    ll N;
    cin >> N;
    vector<ll> ans(100000000);
    REP1(x, 101){
        REP1(y, 101){
            REP1(z, 101){
                ans[x*x+y*y+z*z+x*y+y*z+z*x]++;
            }
        }
    }
    REP(i, N){
        cout << ans[i+1]<< endl;
    }



}
/*
                   _ooOoo_
                  o8888888o
                  88" . "88
                  (| -_- |)
                  O\  =  /O
               ____/`---'\____
             .'  \\|     |//  `.
            /  \\|||  :  |||//  \
           /  _||||| -:- |||||-  \
           |   | \\\  -  /// |   |
           | \_|  ''\---/''  |   |
           \  .-\__  `-`  ___/-. /
         ___`. .'  /--.--\  `. . __
      ."" '<  `.___\_<|>_/___.'  >'"".
     | | :  `- \`.;`\ _ /`;.`/ - ` : | |
     \  \ `-.   \_ __\ /__ _/   .-` /  /
======`-.____`-.___\_____/___.-`____.-'======
                   `=---='
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
         pass System Test!
*/

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

#define REP(i, n) for(decltype(n) i = 0; i < n; i++)

#define ALL(c)   c.begin(), c.end()
#define SORT(c)  std::sort(ALL(c))
#define RSORT(c) std::sort(ALL(c), std::greater<decltype(c)::value_type>())

using namespace std;
using ll = long long;

const int MOD  = (int)1e9 + 7;
const int INF  = (int)1e9 + 1;
const ll  LINF = (ll)1e18 + 1;

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

    int N, M, C;
    std::cin >> N >> M >> C;

    vector<int> B(M);
    REP(i, M) {
        std::cin >> B[i];
    }

    int ans = 0;
    REP(i, N) {
        vector<int> A(M);
        REP(i, M) {
            std::cin >> A[i];
        }

        int val = C;
        REP(i, M) {
            val += A[i] * B[i];
        }

        if(0 < val) {
            ans++;
        }
    }

    std::cout << ans << std::endl;

    return 0;
}


Measured memory_bytes: 256
m=1000000007
f=lambda j,k:(j%m)*(k%m)%m
a,b=sorted(map(int,input().split()))
x=1
for i in range(2,a+1):
  x=f(x,i)
print(f(f(x,[x*b,x][a==b]),[1,2][a==b]) if b-a<2 else 0)


Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define rep1(i,n) for(int i=1, i##_len=(n); i<=i##_len; ++i)
#define repr(i,n) for(int i=0, i##_len=(n); i<i##_len; --i)
#define REP(i,m,n) for(int i=int(m), i##_len=(n); i<i##_len; ++i)
#define VV(T) vector<vector<T>>
#define pb push_back
using namespace std;
typedef vector<int> vi;
typedef vector<vi> vvi;;
typedef long long ll;
typedef double D;

int main(){
  int N;
  cin >> N;
  if(N/100==N%10) cout << "Yes" << endl;
  else cout << "No" << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include<vector>
using namespace std;
#define ll long long
ll dp[300]={0};
ll frog1(ll d[],ll b){
    //if b==0 no steps to jump
    if(b<=1)
    return 0;
    
    //he may jump 1 or 2 steps
    //with minimum cosst
      int p=abs(d[b-1]-d[b-2])+frog1(d,b-1);
      int r=(b<=2)? 10000:abs(d[b-1]-d[b-3])+frog1(d,b-2);
     return min(p,r);
}
ll frog(ll d[],ll b){
    //if b==0 no steps to jump
    vector<int>dp(b+1);
    //he may jump 1 or 2 steps
    //with minimum cost
    dp[1]=0;
    for(int i=2;i<=b;i++){
      int p=abs(d[i]-d[i-1])+dp[i-1];
      int r=(i==2)? 1000000:abs(d[i]-d[i-2])+dp[i-2];
     dp[i]= min(p,r);
    // cout<<dp[i]<<" ";
    }
     return dp[b];
     
}
int main(){
    ll b;
	    cin>>b;
	    ll d[b];
	    for(ll i=1;i<=b;i++)
	    cin>>d[i];
	    cout<<frog(d,b)<<endl;
	
	return 0;
}

Measured memory_bytes: 1408
#include<bits/stdc++.h>
   
using namespace std;
  
string S;
int idx;
int mp[256];
map< int, int > SS;
  
bool E()
{
  if(S[idx] == '0') {
    ++idx;
    return(0);
  }
  if(S[idx] == '1') {
    ++idx;
    return(1);
  }
  if(isalpha(S[idx])) {
    ++idx;
    return(mp[S[idx - 1]]);
  }
  if(S[idx] == '-') {
    ++idx;
    return(1 ^ E());
  }
  ++idx;
  bool F = E();
  bool isxor = S[idx] == '^';
  ++idx;
  bool G = E();
  ++idx;
  if(isxor) return(F ^ G);
  else return(F & G);
}
  
int tobit(const string& s)
{
  int bit = 0;
  S = s;
  for(int j = 0; j < (1 << 4); j++) {
    mp['a'] = (j >> 0) & 1;
    mp['b'] = (j >> 1) & 1;
    mp['c'] = (j >> 2) & 1;
    mp['d'] = (j >> 3) & 1;
    idx = 0;
    bit |= E() << j;
  }
  return(bit);
}
  
int main()
{
  vector< string > valid[17];
  
  int ret = 0;
    
  for(int i = 1; i < 16; i++) {
    vector< string > vv;
    if(i == 1) {
      vv.emplace_back("0");
      vv.emplace_back("1");
      vv.emplace_back("a");
      vv.emplace_back("b");
      vv.emplace_back("c");
      vv.emplace_back("d");
    }
    for(auto& s : valid[i - 1]) {
      vv.emplace_back("-" + s);
    }
    int sz = i - 3;
    for(int k = 1; k < sz; k++) {
      int l = sz - k;
      for(auto&& s : valid[k]) {
        for(auto&& t : valid[l]) {
          vv.emplace_back("(" + s + "^" + t + ")");
          vv.emplace_back("(" + s + "*" + t + ")");
        }
      }
    }
    for(auto& s : vv) {
      int bit = tobit(s);
      if(!SS.count(bit)) {
        SS[bit] = i;
        valid[i].push_back(s);
      }
    }
  }
  string S;
  while(cin >> S, S != ".") {
    auto z = tobit(S);
    if(SS.count(z)) cout << SS[z] << endl;
    else cout << 16 << endl;
  }
}

Measured memory_bytes: 3876
// Daniel Grzegorzewski
// while (clock()<=69*CLOCKS_PER_SEC)
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
// #pragma GCC target ("avx2")
// #pragma GCC optimization ("O3")
// #pragma GCC optimization ("unroll-loops")

#define MP make_pair
#define PB push_back
#define ST first
#define ND second

using namespace __gnu_pbds;
using namespace std;

template <typename T>
using ordered_set =
    tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

//X.find_by_order(k); - zwraca iterator na k-ty element (numeracja od zerowego)
//X.order_of_key(k); - zwraca liczbę elementów ostro mniejszych niż k

typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<PII> VII;
typedef long long LL;

void init_ios() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
}

const int N = 2003;

int n, x, y, cnt[N], dis[N];
VI child[N];
bool vis[N];

void bfs(int v) {
  for (int i = 1; i <= n; ++i)
    dis[i] = 0;
  queue<int> q;
  q.push(v);
  vis[v] = true;
  while (!q.empty()) {
    int u = q.front();
    q.pop();
    for (int x: child[u])
      if (!vis[x]) {
        vis[x] = true;
        dis[x] = dis[u]+1;
        ++cnt[dis[x]];
        q.push(x);
      }
  }
}

int main() {
  init_ios();
  cin >> n >> x >> y;
  for (int i = 1; i < n; ++i) {
    child[i].PB(i+1);
    child[i+1].PB(i);
  }
  child[x].PB(y);
  child[y].PB(x);
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j <= n; ++j)
      vis[j] = false;
    bfs(i);
  }
  for (int i = 1; i < n; ++i)
    cout<<cnt[i]/2<<"\n";
}

Measured memory_bytes: 384
#include<iostream>
const int MAX_X = 100;
const int MAX_Y = 100;
int Y[MAX_X + 1][MAX_Y + 1] = { -1 };
int limx, limy;

const int vx[4] = { 0, 1, 0, -1 };
const int vy[4] = { 1, 0, -1, 0 };

int ans = 0;
void dfs(int x, int y){
	int type = Y[x][y];
	Y[x][y] = 3;
	int newx, newy;
	for (int i = 0; i < 4; i++){
		newx = x + vx[i];
		newy = y + vy[i];
		if (Y[newx][newy] == type && limx>newx && newx >= 0 && limy > newy && newy >= 0)dfs(newx, newy);
	}
}
int main(){
	char b;
	while (true){
		std::cin >> limy >> limx;
		if (limy == 0 && limx == 0)break;
		for (int i = 0; i < limy; i++){
			for (int j = 0; j < limx; j++){
				std::cin >> b;
				if (b == '#')Y[j][i] = 0;
				else if (b == '*')Y[j][i] = 1;
				else if (b == '@')Y[j][i] = 2;
			}
		}
		for (int i = 0; i < limx; i++){
			for (int j = 0; j < limy; j++){
				if (Y[i][j] != 3){
					dfs(i, j);
					ans++;
				}
			}
		}
		std::cout << ans << "\n";
		ans = 0;
	}
}

Measured memory_bytes: 3600
#include<bits/stdc++.h>
//ios::sync_with_stdio(false);
//cin.tie(0);
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<pii,int> ppii;
typedef pair<int,pii> pipi;
typedef pair<ll,ll> pll;
typedef pair<pll,ll> ppll;
typedef pair<ll,pll> plpl;
typedef tuple<ll,ll,ll> tl;
ll mod=1000000007;
ll mod2=998244353;
ll inf=1000000000000000000;
double pi=2*acos(0);
#define rep(i,m,n) for(ll i=m;i<n;i++)
#define rrep(i,n,m) for(ll i=n;i>=m;i--)
int dh[4]={1,-1,0,0};
int dw[4]={0,0,1,-1};
int ddh[8]={-1,-1,-1,0,0,1,1,1};
int ddw[8]={-1,0,1,-1,1,-1,0,1};
ll lmax(ll a,ll b){
    if(a<b)return b;
    else return a;
}
ll lmin(ll a,ll b){
    if(a<b)return a;
    else return b;
}
ll gcd(ll a,ll b){
    if(a<b)swap(a,b);
    if(a%b==0)return b;
    return gcd(b,a%b);
}
ll Pow(ll n,ll k){
    ll ret=1;
    ll now=n;
    while(k>0){
        if(k&1)ret*=now;
        now*=now;
        k/=2;
    }
    return ret;
}
ll gya[200010];
ll kai[200010];
ll m;
ll beki(ll n,ll k){
  ll ret=1;
  ll now=n;
  while(k>0){
    if(k%2==1){
      ret*=now;
      ret%=m;
    }
    now*=now;
    now%=m;
    k/=2;
  }
  return ret;
}
ll gyaku(ll n){
  return beki(n,mod-2);
}
void nckinit(ll n){
  kai[0]=1;
  kai[1]=1;
  for(int i=2;i<=n;i++){
    kai[i]=kai[i-1]*i;
    kai[i]%=mod;
  }
  gya[n]=gyaku(kai[n]);
  for(int i=n-1;i>=1;i--){
    gya[i]=gya[i+1]*(i+1);
    gya[i]%=mod;
  }
  gya[0]=1;
}    
ll nck(ll n,ll k){
  if(k<0)return 0;
  if(k==0||n==k)return 1;
  ll ret=kai[n];
  ret*=gya[n-k];
  ret%=mod;
  ret*=gya[k];
  ret%=mod;
  return ret;
}
ll npk(ll n,ll k){
  if(k<0)return 0;
  if(k==0)return 1;
  ll ret=kai[n];
  ret*=gya[n-k];
  ret%=mod;
  return ret;
}
random_device rnd;
mt19937 mt(rnd());
uniform_real_distribution<double> ra(1,6);
int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n,m;cin>>n>>m;
  int imos[m+2];
  fill(imos,imos+m+2,0);
  rep(i,0,n){
    int l,r;cin>>l>>r;
    int num=1;
    for(;;){
      if(num*num>l)break;
      int lr=l/num;
      int rr=r/num;
      if(lr==rr&&l%num!=0&&r%num!=0){
        imos[num]++;
        imos[num+1]--;
      }
      num++;
    }
    rrep(j,l/num,1){
      int a=l/(j+1)+1;
      int b=l/j;
      if(l%j==0)b--;
      int c=r/(j+1)+1;
      int d=r/j;
      if(r%j==0)d--;
      if(b<c)continue;
      if(a>b)continue;
      if(c>d)continue;
      imos[c]++;
      imos[b+1]--;
    }
    imos[r+1]++;
    //cout<<imos[1]<<endl;
  }
  rep(i,1,m+1){
    imos[i]+=imos[i-1];
    cout<<n-imos[i]<<endl;
  }
}
  

Measured memory_bytes: 1280
import heapq
import time
st = time.time()
n = int(input())
a = list(map(int,input().split()))
hq = []
for i, ai in enumerate(a):
    heapq.heappush(hq,(-ai,i))
dp = [[0 for i in range(j+1)] for j in range(n+1)]
dp[0][0] = 0
ai,hi = heapq.heappop(hq)
dp[1][0] = -ai*(n-1-hi)
dp[1][1] = -ai*hi
for i in range(2,n+1):
    ai,hi = heapq.heappop(hq)
    dp[i][0] = dp[i-1][0] - ai*abs(n-i-hi)
    dp[i][i] = dp[i-1][i-1] - ai*abs(hi-i+1)
    for j in range(1,i):
        dp[i][j] = max(dp[i-1][j-1]-ai*abs(hi-j+1),dp[i-1][j]-ai*abs(n-i+j-hi))

print(max(dp[n]))


Measured memory_bytes: 121476
n = gets.to_i
l = n.times.map{ gets.to_i }
dp = [Array.new(n, 0)] + [l.rotate(-1)]
(1...n).each do |i|
  n.times do |j|
    k = ((n-i)+j-1)%n
    if i % 2 == 1
      if l[j] < l[k] then dp[0][j] = [dp[0][j], dp[1][j]].max
      else dp[0][(j+1)%n] = [dp[0][(j+1)%n], dp[1][j]].max
      end
    else
      dp[1][j] = [dp[1][j], dp[0][j]+l[k]].max
      dp[1][(j+1)%n] = [dp[1][(j+1)%n], dp[0][j]+l[j]].max
    end
  end
  dp[i%2].fill(0)
end
p dp[n%2].max

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

long long n, a;
map<long long, long long> counter;

long long perm2(long long n)
{
    return n * (n - 1) / 2;
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin >> n;
    vector<long long> nums(n);
    for (int i = 0; i < n; i++)
    {
        cin >> a;
        nums[i] = a;
        counter[a]++;
    }

    long long sum = 0;

    for (auto x : counter)
    {
        sum += perm2(x.second);
    }

    long long total = 0;

    for (int k = 0; k < n; k++)
    {
        cout << sum - (counter[nums[k]] - 1) << '\n';
    }

    cin >> n;
}

Measured memory_bytes: 11136
#include <cstdio>
#include <algorithm>

int main() {
  int x1, y1, x2, y2;
  scanf("%d %d %d %d", &x1, &y1, &x2, &y2);

  int dx = x2-x1;
  int dy = y2-y1;
  y2 += dx;
  x2 -= dy;
  printf("%d %d ", x2, y2);

  x2 -= dx;
  y2 -= dy;
  printf("%d %d\n", x2, y2);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long int
#define mod 1000000007 
#define pb push_back
//#define mp make_pair
#define INF 2000000011LL
#define INFLL 1000000000000000011LL
#define eps 1e-9
#define pp pair < pair<ll,ll> , ll> 
#define fo(i,j,k) for(int i=j;i<=k;i++)
#define foll(i,j,k) for(ll i=j;i<=k;i++)
#define clr(a) memset(a,0,sizeof(a))
#define vi vector<int>
#define vll vector<ll>
#define sz(a) a.size()
#define len(a) a.length()
#define all(a) a.begin(),a.end()
#define io_file freopen("Contest/input_file.in", "r", stdin); freopen("Contest/output_file.in", "w", stdout)

const int MAXN = 2e5+5;
using namespace std;
ll power(ll x, ll y)
{
  ll res = 1;
  while(y>0)
  {
    if(y&1)
       {
         res = (res*x)%mod;
        }
     x = (x*x)%mod;
     y = y>>1;
  }
    return res;
}
// std::vector<ll> divi[100004];
// void divisor(int n)
// {
//    for(ll i=1;i<=n;i++)
//    {
//      for(ll j=i;j<=n;j+=i)
//      {
//        divi[j].pb(i);
//      }
//    }
// }
ll n;

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    
    ll a,b;
    cin>>a>>b;
    if(a>=13)
    {
      cout<<b<<endl;
    }
    else if(a>=6)
    {
      cout<<b/2<<endl;
    }
    else {
      cout<<0<<endl;
    }

    return 0;

}



Measured memory_bytes: 764
#include <bits/stdc++.h>
#define ll long long
#define f(i, a, b) for(ll i = a; i <= b; ++i)
#define ff(i, a, b) for(ll i = a; i < b; ++i)
#define F(i, a, b) for(ll i = a; i >= b; --i)
#define FF(i, a, b) for(ll i = a; i > b; --i)
#define x first
#define y second
#define X real()
#define Y imag()
using namespace std;
typedef complex<ll> P;
typedef pair<ll, ll> ii;
typedef tuple<ll, ll, ll> iii;

const ll N = 1e5+7;
ll n, ans = 0, a[N];
vector<ll> brr;
vector<ii> arr;

signed main(){
	scanf("%lld", &n);
	f(i,1,n){
		scanf("%lld", &a[i]);
	}
	sort(a+1, a+1+n);
	ans = a[1];
	ff(i,2,n){
		if(a[i] >= 0){
			arr.push_back({ans, a[i]});
			ans -= a[i];
		}else brr.push_back(a[i]);
	}
	brr.push_back(ans);
	ans = a[n];
	ff(i,0,brr.size()){
		arr.push_back({ans, brr[i]});
		ans -= brr[i];
	}
	printf("%lld\n", ans);
	for(auto i : arr){
		printf("%lld %lld\n", i.x, i.y);
	}
}


Measured memory_bytes: 5104
# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub

sys.setrecursionlimit(100000)
input = sys.stdin.readline
INF = 2**62-1

def read_int():
    return int(input())


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


def read_float():
    return float(input())


def read_float_n():
    return list(map(float, input().split()))


def read_str():
    return input().strip()


def read_str_n():
    return list(map(str, input().split()))


def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


@mt
def slv(A, B, C, D, E, F):
    ans = 0
    w = set()
    for i in range(F//A + 1):
        for j in range(F//B + 1):
            m = 100*(i*A + j*B)
            if m < F:
                w.add(m)
    mw = max(w)


    ms = (mw // 100) * E
    s = set()
    for i in range(ms+1):
        for j in range(ms+1):
            s.add(i*C + j*D)
    W = sorted(w)
    S = sorted(s)

    ans = (0, A*100, 0)
    for w in W:
        if w == 0:
            continue
        ts = w // 100 * E
        if F < ts + w:
            ts = F - w
        si = bisect.bisect_left(S, ts)
        if S[si] == ts:
            s = ts
        else:
            if si == 0:
                continue
            s = S[si-1]
        if s + w <= F and  s / w > ans[0]:
            ans = (s/w, w + s, s)
    return ' '.join(map(str, ans[1:]))


def main():
    A, B, C, D, E, F = read_int_n()
    print(slv(A, B, C, D, E, F))


if __name__ == '__main__':
    main()


Measured memory_bytes: 68456
#include <iostream>
using namespace std;
int h;
int w;
char s[3000][3000];
int L[3000][3000];
int R[3000][3000];
int D[3000][3000];
int U[3000][3000];
int main(){
    cin >> h >> w;
    for(int i=0;i<h;i++){
        for(int j=0;j<w;j++){
            cin >> s[i][j]; 
        }
    }
    for(int i=0;i<h;i++){
        for(int j=0;j<w;j++){
            if(s[i][j] == '#'){
                L[i][j] = 0;
            }
            else if(j==0){
                L[i][j] = 1;
            }
            else{
                L[i][j] = L[i][j-1] +1;
            }
        }

        for(int j=w-1;j>=0;j--){
            if(s[i][j] == '#'){
                R[i][j] = 0;
            }
            else if(j==w-1){
                R[i][j] = 1;
            }
            else{
                R[i][j] = R[i][j+1] +1;
            }
        }
    }

    for(int j=0;j<w;j++){
        for(int i=0;i<h;i++){
            if(s[i][j] == '#'){
                D[i][j] = 0;
            }
            else if(i==0){
                D[i][j] = 1;
            }
            else{
                D[i][j] = D[i-1][j] +1;
            }
        }
        for(int i=h-1;i>=0;i--){
            if(s[i][j] == '#'){
                U[i][j] = 0;
            }
            else if(i==h-1){
                U[i][j] = 1;
            }
            else{
                U[i][j] = U[i+1][j] +1;
            }
        }
    }
    int ans = 0;
    for(int i=0;i<h;i++){
        for(int j=0;j<w;j++){
            int tmp = L[i][j]+R[i][j]+U[i][j]+D[i][j]-3;
            if(ans < tmp){
                ans = tmp;
            }
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 106752
#include <algorithm>
#include <cmath>
#include <iostream>
#include <vector>

int main()
{
    int A, B, C;
    std::cin >> A >> B >> C;
    std::vector<int> nums({A, B, C});
    std::sort(nums.begin(), nums.end());
    std::reverse(nums.begin(), nums.end());
    std::cout << nums.at(0) * 10 + nums.at(1) + nums.at(2) << std::endl;
    return 0;
}

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

int	main()
{
	int	N;
	set<int>	d_set;
	cin >> N;
	int	d;
	for (int i = 0; i < N; ++i) {
		cin >> d;
		d_set.insert(d);
	}
	cout << d_set.size() << endl;
}


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

namespace AthleteProgramming
{
    class Program
    {
        static void Main()
        {
            for(int i = 1; i < 10; i++)
            {
                for(int j = 1; j < 10; j++)
                {
                    Console.WriteLine("{0}x{1}={2}",i,j,i*j);
                }
            }
        }
    }
}

Measured memory_bytes: 8988
N = int(input())
S = list(input())
INF = int(1e6)

nE = S.count("E")
nW = N - nE

lnW = 0
ans = INF

for i in S:
    if i == "W":
        nW -= 1
        ans = min(ans, nE + lnW)
        lnW += 1
    else:
        nE -= 1
        ans = min(ans, nE + lnW)

print(ans)


Measured memory_bytes: 5796
#include <iostream>
#include <sstream>
#include <cmath>
using namespace std;

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

	stringstream ss;
	ss << a << b;
	int num = stoi(ss.str());
	int digit = log10(num)+1;
	string ans;
	for (int i = 0; i < num; i++) {
		if (i*i == num) {
			ans = "Yes";
			i = num;
		} else if (num < i*i) {
			ans = "No";
			i = num;
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 384
#include <stdio.h>
#include <stdlib.h>
#include <algorithm>
#include <queue>
#include <utility>
#include <vector>

#define MAX_N (100000)

using namespace std;

int main(int argc, char *argv[]) {
  // read inputs
  int N, C, ss[MAX_N], ts[MAX_N], cs[MAX_N];
  scanf("%d %d", &N, &C);
  for (int i = 0; i < N; i++) {
    scanf("%d %d %d", &ss[i], &ts[i], &cs[i]);
    cs[i]--;  // NOTE : modified input
  }

  // sort
  vector<pair<int, pair<int, int>>> channels;
  for (int i = 0; i < N; i++) {
    channels.push_back(
        pair<int, pair<int, int>>(ss[i], pair<int, int>(ts[i], cs[i])));
  }
  sort(channels.begin(), channels.end());

  // solve
  int ans = 0, in_use = 0;
  vector<int> finish_times(C, 0);
  for (int i = 0; i < N; i++) {
    const int s = channels[i].first, t = channels[i].second.first,
              c = channels[i].second.second;
    // check for those that have finished recording
    for (int j = 0; j < C; j++) {
      if (finish_times[j] > 0 && s > finish_times[j]) {
        finish_times[j] = 0;
        in_use--;
        // printf("recording of channel %d complete.\n", j);
      }
    }
    if (s == finish_times[c]) {  // continue recording
      finish_times[c] = t;
      // printf("continue recording channel %d until time %d\n", c, t);
    } else {  // start recording
      finish_times[c] = t;
      ans = max(ans, ++in_use);
      // printf("start recording channel %d until time %d\n", c, t);
    }
    // printf("is_use = %d, ans = %d\n", in_use, ans);
  }
  printf("%d\n", ans);

  return 0;
}


Measured memory_bytes: 3064
import java.io.*;
import java.util.*;

class Main {

    public static void main(String[] args) {
       MyScanner sc = new MyScanner();
       int N = sc.nextInt();
       Map<String, Long> map = new HashMap<>();
       long ans = 0;
       for (int i=0; i<N; i++) {
           char[] s = sc.next().toCharArray();
           Arrays.sort(s);
           String key = String.valueOf(s);
           if (map.get(key) != null) {
               ans += map.get(key);
               map.put(key, map.get(key) + 1);     
           }
           else {
               map.put(key, 1L);
           }
       }
       System.out.println(ans);
    }

    static class MyScanner {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in), 1 << 15);
        StringTokenizer tokenizer;
    
        String next() {
            try {
                while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                    tokenizer = new StringTokenizer(reader.readLine());
                }
            } catch (IOException ignored) {
            }
            return tokenizer.nextToken();
        }
    
        int nextInt() {
            return Integer.parseInt(next());
        }
    
        long nextLong() {
            return Long.parseLong(next());
        }
    }
}

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

#define  prec(n)        fixed<<setprecision(n)
#define  optimize       ios::sync_with_stdio(0); cin.tie(0);
#define  PI             acos(-1.0)
#define  RESET(a, b)    memset(a, b, sizeof(a))
#define  pb             push_back
#define  pii            pair<int,int>
#define  pll            pair<ll,ll>
#define  vv             vector<int>
#define  ff             first
#define  ss             second
#define  sz(v)          v.size()
#define  all(v)         v.begin(),v.end()

int const MOD=(int) 1e9+7;
inline void normal(ll &a) { a %= MOD; (a < 0) && (a += MOD); }
inline ll modMul(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a*b)%MOD; }
inline ll modAdd(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a+b)%MOD; }
inline ll modSub(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); a -= b; normal(a); return a; }
inline ll modPow(ll b, ll p) { ll r = 1; while(p) { if(p&1) r = modMul(r, b); b = modMul(b, b); p >>= 1; } return r; }
inline ll modInverse(ll a) { return modPow(a, MOD-2); }
inline ll modDiv(ll a, ll b) { return modMul(a, modInverse(b)); }
inline ll mod(ll a, ll m){ if(a<0) return m-(abs(a)%m); else if(a<m) return a; else return (a%m); }
const int N = 200007;
const int MAX=1000005;

int main()
{
    optimize
    ll a,b,c,d;
    cin>>a>>b>>c>>d;
    /*if(a>0 && b>0){
        if(c>=0 && d>0) cout<<b*d<<endl;
        else if(c<0 && d<0) cout<<b*d<<endl;
        else if(c<0 && d>0)  cout<<b*d<<endl;
        else if(c<0 && d==0) cout<<0<<endl;
    }
    else if(a<0 && b<0){
        if(c>=0 && d>0) cout<<a*c<<endl;
        else if(c<0 && d<0) cout<<b*d<<endl;
        else if(c<0 && d>0) cout<<
    }*/
    ll x=max(a*c,a*d);
    ll y=max(b*c,b*d);
    cout<<max(x,y)<<endl;
}


Measured memory_bytes: 3644
#include<bits/stdc++.h>
using namespace std;
typedef pair<int,int> ii;

bool max_bipartite_match(const vector<vector<bool>>&adj, vector<bool>&vis, vector<int>&match, 
	const int& u, const int& n){
	for(int v=0;v<n;v++){
		if(adj[u][v] && !vis[v]){
			vis[v]=true;
			if(match[v]==-1 || max_bipartite_match(adj,vis,match,match[v],n)){
				match[v]=u;
				return true;
			}
		}
	}
	return false;
}
int main(){
	int n; cin>>n;
	vector<ii>red(n), blue(n);
	for(int i=0;i<n;i++){
		int a,b; cin>>a>>b;
		red[i]={a,b};
	}
	for(int i=0;i<n;i++){
		int c,d; cin>>c>>d;
		blue[i]={c,d};
	}
	vector<vector<bool>>adj(n,vector<bool>(n,false));
	for(int i=0;i<n;i++){
		for(int j=0;j<n;j++){
			if(red[i].first<blue[j].first && 
				red[i].second<blue[j].second){
				adj[i][j]=true;
			}
		}
	}
	int ret=0;
	vector<int>match(n,-1);
	for(int u=0;u<n;u++){
		vector<bool>vis(n,false);
		if(max_bipartite_match(adj,vis,match,u,n)){
			ret++;
		}
	}
	cout<<ret<<'\n';
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define rrep(i,n) for(int i=((int)(n)-1);i>=0;(i)--)
#define rrep1(i,n) for(int i=((int)(n));i>0;(i)--)
#define sz(c) ((int)(c).size())
#define all(x) (x).begin(),(x).end()
#define mp make_pair
#define pb push_back
#define fi first
#define se second

using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int, int> P;
typedef pair<int, pair<int, int> > PP;
const ll MOD=1e9+7;

int N;
vll ct(60);
void input(){
	cin>>N;
	rep(i,N){
		ll A;
		cin>>A;
		rep(k, 60){
			ct[k]+=(1&(A >> k));
		}
	}
}
void solve(){
	ll ans=0;
	rep(k, 60){
		ll tmp=(1ull<<k)%MOD;
		tmp=(tmp * ct[k])%MOD;
		tmp=(tmp * (N-ct[k]))%MOD;
		ans=(ans+tmp)%MOD;
	}
	cout<<ans<<endl;

}
void output(){
  
}

int main(){
  input();
  solve();
  output();
}

Measured memory_bytes: 764
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(){
  int i,j,ans,tstr,len,min;
  char S[11],str[4];
  scanf("%s",S);
  len=strlen(S);
  min=999;
  for(i=0;i<len-2;i++){
    for(j=0;j<3;j++)
      str[j]=S[i+j];
    str[3]='\0';
    tstr=atoi(str);
    if(min>abs(753-tstr))
      min=abs(753-tstr);
  }
  printf("%d",min);
}


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

typedef long long ll;
typedef pair<ll, ll> P;

#define pb push_back
#define rep(i, n) for(int i = 0; i < (n); i++)
#define FOR(i, a, n) for(int i = a; i < (n); i++)
#define mod (ll)(1e9+7)
#define int ll
#define INF 100000000

__attribute__((constructor))
void initial() {
  cin.tie(0);
  ios::sync_with_stdio(false);
}

signed main() {
	ll a, b;
  cin >> a >> b;
  if(a <= 8 && b <= 8) {
    cout << "Yay!" << endl;
    return 0;
  }
  cout << ":(" << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)
 
#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=(int)(a)-1;i>=(int)(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)
 
#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define bit(n) (1LL<<(n))
 
// #define DEBUG
 
#ifdef DEBUG
    #define dump(...) fprintf(stderr, __VA_ARGS__)
#else
    #define dump(...)
#endif
 
template<class T>bool chmax(T &a, const T &b) { return (a<b)?(a=b,1):0;}
template<class T>bool chmin(T &a, const T &b) { return (b<a)?(a=b,1):0;}
 
using namespace std;
using ll=long long;
using vi=vector<int>;
using vll=vector<ll>;
 
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int inf = INT_MAX;
const ll INF = LLONG_MAX;
const ll MOD = 1000000007LL;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
 
ll extgcd(ll a,ll b,ll& x,ll& y){x=1,y=0;ll g=a;if(b!=0) g=extgcd(b,a%b,y,x),y-=a/b*x;return g;}
ll ADD(const ll &a, const ll &b, const ll mod=MOD) { return (a+b)%mod;}
ll SUB(const ll &a, const ll &b, const ll mod=MOD) { return (a-b+mod)%mod;}
ll MUL(const ll &a, const ll &b, const ll mod=MOD) { return (1LL*a*b)%mod;}
ll DIV(const ll &a, const ll &b, const ll mod=MOD) {ll x,y; extgcd(b,mod,x,y);return MUL(a,(x+mod)%mod,mod);}
 
int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);

    int A, B; cin >> A >> B;

    int res = -1;
    if(A <= 9 and B <= 9){
        res = A * B;
    }

    cout << res << endl;

    return 0;
}


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

int main(){
	int n;
	cin  >> n;
	
	long a[n];
	long money, kabu;

	for (int i=0; i<n; i++) {
		cin >> a[i];
	}
	
	money = 1000;
	kabu = 0;
	
	for (int i = 0; i<n-1; i++){
		if (a[i] < a[i+1]){
			money = money  +a[i] * kabu;
			kabu = 0;
			
			kabu = money / a[i];
			money = money - a[i] * kabu;
		}
		else {
			money = money + a[i] * kabu;
			kabu = 0;
		}
	}
	
	money = money + a[n-1]*kabu;
	kabu = 0;
	
	cout << money << endl;
return 0;
}


Measured memory_bytes: 3576
import java.util.Scanner;

public class Main {

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

		int N = sc.nextInt();
		int T = sc.nextInt();

		int t=0;
		int t_old=0;
		int stopTime=0;
		for (int i=1;i<=N;i++) {
			t = sc.nextInt();
			if (t-t_old>T) {stopTime += t-t_old-T;}
			t_old = t;
		}

		System.out.print(t+T-stopTime);

	}
}

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

using namespace std;

#define rep(i,a,b) for(int (i) = (a); (i) < (b); ++(i))
#define per(i,a,b) for(int (i) = (n-1); (i) >= (a); --(i))
#define fi first
#define se second
#define pb push_back
#define pf push_front
#define mp make_pair
#define mt make_tuple
#define all(v) (v).begin(), (v).end()
#define sz(v) (int) (v).size()
#define fast() ios::sync_with_stdio(0);cin.tie(0);

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> ii;
typedef tuple<int, int, int> iii;
typedef vector<int> vi;
typedef vector<vi> vvi;

const int inf = 0x3f3f3f3f;
const int neginf = 0xc0c0c0c0;
const int mod = 1000000007;

ll powmod(ll a, ll b){
	ll res = 1;
	a %= mod;
	assert(b >= 0);
	for(;b;b>>=1){
		if(b&1) res = (res*a)%mod;
		a = (a*a)%mod;
	} 
	return res;
}



int main(){
	fast();
	int N;
	string s = "xablau";
	cin >> N;
	if(N < 20){
		rep(i,0,N){
			cout << i << endl;
			cin >> s;
			if(s == "Vacant"){
				return 0;
			}
		}
	}
	int lo = 0, hi = N-1, mid = 0;
	string sLo, sHi, sMid;
	cout << lo << endl;
	cin >> sLo;

	while(lo < hi){
		mid = (lo + hi + 1) >> 1;
		cout << mid << endl;
		cin >> sMid;
		if(lo%2 == mid%2){
			// mesmo sexo
			// temos um ciclo desse "lado" 
			if(sMid != sLo) hi = mid - 1;
			else{
				lo = mid ;
				sLo = sMid;
			}
		}
		else{
			if(sMid == sLo) hi = mid - 1;
			else{
				lo = mid; 
				sLo = sMid;
			}
		}
	}
	return 0;

}




Measured memory_bytes: 852
n, m = map(int, input().split())
a = [None] * n
b = [None] * m
for i in range(n):
    a[i] = list(map(int, input().split()))
for i in range(m):
    b[i] = int(input())
for i in range(n):
    c = 0
    for j in range(m):
        c += a[i][j] * b[j]
    print(c)


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

def double(n):
  return n**2

points = list(map(int, input().split( )))
points_2 = sum(list(map(double, points)))

total = list()

for i in range(n):
  for j in range(n):
    total.append(points[i] * points[j])

print(round((sum(total)-points_2)/2))



Measured memory_bytes: 3060
#include <stdio.h>

int main(void)
{
	int a[4];
	int b[4];
	int i, j;
	int hc, bc;
	
	while (scanf("%d", &a[0]) != EOF){
		hc = bc = 0;
		for (i = 1; i < 4; i++){
			scanf("%d", &a[i]);
		}
	
		for (i = 0; i < 4; i++){
			scanf("%d", &b[i]);
		}
	
		for (i = 0; i < 4; i++){
			for (j = 0; j < 4; j++){
				if (a[i] == b[j]){
					if (i == j){
						hc++;
					}
					else {
						bc++;
					}
				}
			}
		}
		printf("%d %d\n", hc, bc);
	}
	return (0);
}

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

//F

long long l,a,b,mod,d[20]={0},c;
int i;

long long powmod(long long x, long long y){
	if(y==0) return 1;
	else if(y%2==0) return powmod((x*x)%mod,y/2);
	else return (powmod(x,y-1)*x)%mod;
}

long long mypow(long long x, long long y){
	if(y==0) return 1;
	else if(y%2==0) return mypow((x*x),y/2);
	else return (mypow(x,y-1)*x);
}

array<long long,9> matprod(array<long long,9> p,array<long long,9> q){
	array<long long,9> r;
	r[0]=(p[0]*q[0]%mod+p[1]*q[3]%mod+p[2]*q[6]%mod)%mod;
	r[1]=(p[0]*q[1]%mod+p[1]*q[4]%mod+p[2]*q[7]%mod)%mod;
	r[2]=(p[0]*q[2]%mod+p[1]*q[5]%mod+p[2]*q[8]%mod)%mod;
	r[3]=(p[3]*q[0]%mod+p[4]*q[3]%mod+p[5]*q[6]%mod)%mod;
	r[4]=(p[3]*q[1]%mod+p[4]*q[4]%mod+p[5]*q[7]%mod)%mod;
	r[5]=(p[3]*q[2]%mod+p[4]*q[5]%mod+p[5]*q[8]%mod)%mod;
	r[6]=(p[6]*q[0]%mod+p[7]*q[3]%mod+p[8]*q[6]%mod)%mod;
	r[7]=(p[6]*q[1]%mod+p[7]*q[4]%mod+p[8]*q[7]%mod)%mod;
	r[8]=(p[6]*q[2]%mod+p[7]*q[5]%mod+p[8]*q[8]%mod)%mod;
	return r;
}

array<long long,9> matpow(array<long long,9> p,long long x){
	if(x==0) return {1,0,0,0,1,0,0,0,1};
	if(x%2==0) return matpow(matprod(p,p),x/2);
	else return matprod(matpow(p,x-1),p);
}

int main() {
	// your code goes here
	cin >> l >> a >> b >> mod;
	for(i=1;i<=18;i++){
		if(mypow(10,i)<a) d[i]=0;
		else{
			d[i]=((mypow(10,i)-1-a)-(mypow(10,i)-1-a)%b)/b+1;
		}
		d[i]=min(d[i],l);
	}
	array<long long,9> ans={1,0,0,0,1,0,0,0,1},mx;
	for(i=1;i<=18;i++){
		c=d[i]-min(d[i],d[i-1]);
		mx={powmod(10,i),0,0,1,1,0,0,b%mod,1};
		ans=matprod(ans,matpow(mx,c));
	}
	mx={0,a%mod,1,0,0,0,0,0,0};
	ans=matprod(mx,ans);
	cout << ans[0] << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include<algorithm>
#include<string>
#include <cmath>
#include <vector>
#include <map>
#include <cstdio>
#include <iomanip>
#pragma region Macros
#define int long long
#define double long double
constexpr int MOD = 1000000007;
constexpr double PI = 3.14159265358979323846;
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<=n;i++)
#define LAST(x) x[x.size()-1]
#define ALL(x) (x).begin(),(x).end()
#define swap(a,b) (a += b,b = a - b,a -= b)
#define CEIL(a,b) ((a+b-1)/b)
int FACT(int a) {
	if (a == 0)
		return 1;
	else
		return a * FACT(a - 1);
}
int nPr(int n, int r) {
	int s = n - r + 1;
	int sum = 1;
	for (int i = s; i <= n; i++)
		sum *= i;
	return sum;
}
//int nCr(int n, int r)
int nCr2(int n, int r) {
	return FACT(n) / (FACT(r) * FACT(n - r));
}
int GCD(int a, int b) // assuming a,b >= 1
{
	if (a < b)
		swap(a, b);
	if (b == 0)
		return a;
	if (a % b == 0)
		return b;
	return GCD(b, a % b);
}
int LCM(int a, int b) // assuming a,b >= 1
{
	return  a * b / GCD(a, b);
}
double LOG(int a, int b) {
	return log(b) / log(a);
}
inline bool BETWEEN(int x, int min, int max) {
	if (min <= x && x <= max)
		return true;
	else
		return false;
}
inline bool PRIMEOR (int x) {
	if (x ==1)
		return false;
	if (x == 2)
		return true;
	if (x%2==0)
		return false;
	double sqrtx = sqrt(x);
	for (int i = 3; i <= sqrtx; i += 2) {
		if (x % i == 0)
			return false;
	}
	return true;
}

using namespace std;
#pragma endregion
signed main() {
	int n,sum=0,x,y;
	cin >> n;
	rep(i, n) {
		cin >> x >> y;
		sum += y - x + 1;
	}
	cout << sum;
}

Measured memory_bytes: 256
object Main extends App {
  val scanner = new java.util.Scanner(System.in)

  val a = scanner.nextInt()
  val b = scanner.nextInt()
  val s = scanner.next()

  if(1 <= a && b <= 5 &&
    s.length == a + b + 1 &&
    s.zipWithIndex.forall {
      case (c, index) =>
        if(index == a)
          c == '-'
        else
          ('0' to '9').contains(c)
    })
    println("Yes")
  else
    println("No")
}


Measured memory_bytes: 29496
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
const int INF = 1001001001;
const int MOD = 1000000007;

template <typename T>
void print(const T &v);

int main()
{
    int n;
    cin >> n;
    vector<int> xs(n), ys(n), hs(n);
    for (int i = 0; i < n; i++)
    {
        cin >> xs[i] >> ys[i] >> hs[i];
    }
    if (n == 5)
    {
        map<int, int> mp;
        for (int i = 0; i < 5; i++)
        {
            mp[hs[i]]++;
        }
        if (mp[0] == 4 && mp[1] == 1)
        {
            int xabs = 0, yabs = 0;
            for (int i = 0; i < 5; i++)
            {
                xabs += xs[i];
                yabs += ys[i];
            }
            cout << xabs / 5 << ' ' << yabs / 5 << ' ' << 1 << endl;
            return 0;
        }
    }
    for (int x = 0; x <= 100; x++)
    {
        for (int y = 0; y <= 100; y++)
        {
            bool flag = true;
            int before = -1;
            for (int i = 0; i < n; i++)
            {
                if (hs[i] == 0)
                {
                    continue;
                }
                int h = abs(x - xs[i]) + abs(y - ys[i]) + hs[i];
                if (before != -1 && before != h)
                {
                    flag = false;
                    break;
                }
                before = h;
            }
            if (flag)
            {
                cout << x << ' ' << y << ' ' << before << endl;
                return 0;
            }
        }
    }
}

// Use For Debug
template <typename T>
void print(T const &v)
{
    for (int i = 0; i < v.size(); i++)
    {
        if (i)
            cout << " ";
        cout << v[i];
    }
    cout << endl;
}


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

using namespace std;
using ll = long long;
const ll mod = 1000000007;


int main()
{
    set<char> st;
    string s; cin >> s;
    for(auto i : s)st.insert(i);

    if(st.size() & 1){
        cout << "No" << endl;
    }else{
        if((st.count('N') && st.count('S')) || (st.count('W') && st.count('E'))){
            cout << "Yes" << endl;
        }else{
            cout << "No" << endl;
        }
    }
}

Measured memory_bytes: 256
#include<stdio.h>
int main(){
      int H,N;
      scanf("%d %d",&H,&N);
      int a[N];
      for(int i=0;i<N;i++){
         scanf("%d",&a[i]);
      }
      for(int i=0;i<N;i++){
         H=H-a[i];
      }
      if(H<=0){
         printf("Yes");
      }else{
         printf("No");
      }
      return 0;
}


Measured memory_bytes: 2016
#include<bits/stdc++.h>
#define mp make_pair
using namespace std;
typedef pair<int,int> pii;
typedef long long LL;
//-------------------------------------------------------------------LYYY↓
namespace LYYY{
	int read()
	{
		int s=0;char c=getchar();int f=1;
		while(c<48||c>57)
		{
			if(c==45) f=-1;
			c=getchar();
		}
		while(c>=48&&c<=57) s=(s<<3)+(s<<1)+(c^48),c=getchar();
		return s*f;
	}
	LL readl()
	{
		LL s=0;char c=getchar();int f=1;
		while(c<48||c>57)
		{
			if(c==45) f=-1;
			c=getchar();
		}
		while(c>=48&&c<=57) s=(s<<3)+(s<<1)+(c^48),c=getchar();
		return s*f;
	}
	void write(int x)
	{
		if(x>=10) write(x/10);
		putchar(x%10+48);
	}
	void W(int x)
	{
		if(x<0) x=-x,putchar(45);
		write(x);
	}
	void writel(LL x)
	{
		if(x>=10) write(x/10);
		putchar(x%10+48);
	}
	void Wl(LL x)
	{
		if(x<0) x=-x,putchar(45);
		write(x);
	}
}using namespace LYYY;
//-------------------------------------------------------------------bianliang↓
const int maxn=222;
const int maxm=88888;
int fir[maxn],tot,nxt[maxm],to[maxm],vis[maxn],col[maxn],Q[maxn];
char ss[maxn][maxn];
//-------------------------------------------------------------------hanshu↓
void add_edge(int x,int y)
{
	nxt[++tot]=fir[x],to[fir[x]=tot]=y;
}
void dfs(int x,int cc)
{
	vis[x]=cc;
	for(int i=fir[x],v=to[i];i;i=nxt[i],v=to[i])if(!vis[v]) dfs(v,cc);
}
int bfs(int x)
{
	col[x]=1;
	int l=1,r=0;
	Q[++r]=x;
	while(l<=r)
	{
		int q=Q[l++];
		for(int i=fir[q],v=to[i];i;i=nxt[i],v=to[i])
		{
			if(!col[v]) col[v]=col[q]+1,Q[++r]=v;
			else if(col[v]!=col[q]-1&&col[v]!=col[q]+1) return -1;
		}
	}
	return col[Q[r]];
}
//-------------------------------------------------------------------main()↓
int main()
{
	int N=read();
	for(int i=1;i<=N;++i)
	{
		scanf("%s",ss[i]+1);
		for(int j=1;j<=N;++j)if(ss[i][j]^48) add_edge(i,j),add_edge(j,i);
	}
	int cnt=0,Ans=0;
	for(int i=1;i<=N;++i)if(!vis[i])
	{
		dfs(i,++cnt);
		int ans=bfs(i);
		if(ans==-1)
		{
			puts("-1");
			return 0;
		}
		for(int j=i+1;j<=N;++j)if(vis[i]==cnt)
		{
			memset(col,0,sizeof(col));
			ans=max(ans,bfs(j));
		}
		Ans+=ans;
	}
	printf("%d",Ans);
}

Measured memory_bytes: 896