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

#pragma region Macro
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define SORT(v) sort(v.begin(), v.end())
#define pb(a) push_back(a)
#define eb(a) emplace_back(a)
#define vi vector<int>
#define vvi vector<vector<int>>
#define chmax(x,y) (x = max(x,y))
#define chmin(x,y) (x = min(x,y))

using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#pragma endregion

void solve(){
	#define int ll
	// ここに処理を記述
	// コンパイル時はエイリアス「gpp」--> c++17でコンパイル
	
	int n, k;
	cin >> n >> k;

	vi p(n);
	rep(i,n){
		cin >> p[i];
	}

	sort(p.begin(), p.end());
	int ans = 0;
	rep(i,k){
		ans += p[i];
	}
	cout << ans << endl;
}

signed main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	
	solve();
	return 0;
}

Measured memory_bytes: 3660
#include <iostream>

using namespace std;

int main(void){
	char buf;
	int a,b,c;
	int rec=0,loz=0;
	while(true){
		cin >> a >> buf >> b >> buf >> c;
		if(cin.eof())
			break;
		if(c*c== (a*a+b*b))
			rec++;
		if(a==b)
			loz++;
	}
	cout << rec << endl << loz <<endl;
	return 0;
}

Measured memory_bytes: 1160
#include<bits/stdc++.h>
using namespace std;
#define re register
#define int long long
inline int read(){
	re int t=0;
	re char v=getchar();
	while(v<'0'||v>'9')v=getchar();
	while(v>='0'&&v<='9'){
		t=(t<<3)+(t<<1)+(v^48);
		v=getchar();
	}
	return t;
}
int a,b,c,d,n,ans;
bool v[200005];
char s[200005];
signed main(){
n=read();
d=read();
scanf("%lld%lld%lld",&a,&b,&c);
scanf("%s",s+1);
for(re int i=1;i<=n;++i){
	if(i<=d){
		if(s[i]=='s')ans+=a;
		if(s[i]=='p')ans+=b;
		if(s[i]=='r')ans+=c;
	}
	else if((s[i]!=s[i-d])||v[i-d]){
		if(s[i]=='s')ans+=a;
		if(s[i]=='p')ans+=b;
		if(s[i]=='r')ans+=c;
	}
	else v[i]=1;
}
printf("%lld",ans);
}


Measured memory_bytes: 512
n,m = map(int,input().split())

a = list(map(int,input().split()))
ninki = []
for i in range(n):
    if a[i] >= (sum(a) / (4 * m)):
        ninki.append(a[i])
if len(ninki) >= m:
    print("Yes")
else:
    print("No")

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

struct Edge {
    int from, to;
    int cost;
    Edge(int _to, int _cost) :
        from(-1), to(_to), cost(_cost) {}
    Edge(int _from, int _to, int _cost) :
        from(_from), to(_to), cost(_cost) {}
};

class UnionFind {
public:
    vector<int> par, rank;
    UnionFind(int n) {
        par.resize(n), rank.resize(n);
        for (int i = 0; i < n; i++) par[i] = i;
    }
    int root(int a) {
        if (par[a] == a) return a;
        else return par[a] = root(par[a]);
    }
    bool isConnect(int a, int b) { return root(a) == root(b); }
    void connect(int a, int b) {
        a = root(a);
        b = root(b);
        if (a == b) return;
        if (rank[a] < rank[b]) {
            par[a] = b;
        } else {
            par[b] = a;
            if (rank[a] == rank[b]) rank[a]++;
        }
    }
};

template<class T = int>
T kruskal(vector<Edge> &edges, int V) {
    sort(edges.begin(), edges.end(), [](const Edge &a, const Edge &b) {
        return a.cost < b.cost;
    });
    UnionFind uf(V);
    T res = 0;
    for(auto &e : edges) {
        if(uf.isConnect(e.from, e.to)) continue;
        uf.connect(e.from, e.to);
        res += e.cost;
    }
    return res;
}

void solve() {
    int V, E;
    cin >> V >> E;
    vector<Edge> edges;
    for(int i = 0; i < E; ++i) {
        int a, b, c;
        cin >> a >> b >> c;
        edges.emplace_back(a, b, c);
    }
    cout << kruskal(edges, V) << '\n';
}

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



Measured memory_bytes: 4548
#include<bits/stdc++.h>
using namespace std;
int n,k,a[1001];
inline int cmp(int a,int b){
	return a>b;
}
int main(){
	cin>>n>>k;
	for(int i=1;i<=n;i++){
		cin>>a[i];
	}
	sort(a+1,a+n+1,cmp);
	int ans=0;
	for(int i=1;i<=k;i++){
		ans+=a[i];
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.Scanner;

public class Main {
	static ArrayList<Long> b = new ArrayList<>();
	
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		long[] a = new long[n];
		for (int i = 0; i < n; i++) {
			a[i] = scan.nextInt();
		}
		if (n % 2 == 0) {
			epush(a, n);			
		} else {
			opush(a, n);
		}
		for (int i = 0; i < n; i++) {
			System.out.print(b.get(i));
			System.out.print(" ");
		}
		System.out.println("");
	}
	public static void epush(long a[], int n) {
		for (int i = n-1; i >= 0; i--) {
			if (i % 2 == 1) {
				b.add(a[i]);
			}
		}
		for (int i = 0; i < n; i++) {
			if (i % 2 == 0) {
				b.add(a[i]);
			}
		}
		return;
	}
	public static void opush(long a[], int n) {
		for (int i = n-1; i >= 0; i--) {
			if (i % 2 == 0) {
				b.add(a[i]);
			}
		}
		for (int i = 0; i < n; i++) {
			if (i % 2 == 1) {
				b.add(a[i]);
			}
		}
		return;
	}
}


Measured memory_bytes: 97176
n = int(input())
h = list(map(int, input().split()))
maxNum = 0
cntNum = 0

for i in range(n - 1):
    if h[i] >= h[i + 1]:
        cntNum += 1
    else:
        if cntNum > maxNum:
            maxNum = cntNum
        cntNum = 0

if cntNum > maxNum:
    maxNum = cntNum

print(maxNum)


Measured memory_bytes: 14252
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <functional>
#include <vector>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <cassert>
#include <atcoder/all>
#define InfL 2000000000
#define InfLL 4000000000000000000LL
#define mod 1000000007
#define rep(i,n) for(int i=0;i<n;i++)
#define rrep(i,n) for(int i=(n-1);i>=0;i--)
using namespace std;
using namespace atcoder;
typedef long long ll;
typedef double db;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<bool> vb;
typedef vector<db> vd;

int main() {
	string S;
	cin >> S;
	vi A = suffix_array(S);
	vi B = lcp_array(S, A);
	int N = S.length();
	ll ans = (ll)(N + 1) * (ll)N / 2LL;
	rep(i, N - 1)
		ans -= (ll)B[i];
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 15672
#include<iostream>
#include<sstream>
#include<iomanip>
#include<bitset>
#include<map>
#include<string>
#include<vector>
#include<cmath>
#include<algorithm>
#define lli long long int
#define uli unsigned long long int
#define inf 999999999999999999
#define rep(i,n,m) for(lli i=(lli)(n);i<(lli)(m);++i)
#define reep(i,n,m) for(int i=(int)(n);i<=(int)(m);++i)
#define per(i,m,n) for(lli i=(int)(m)-1;i>=(int)(n);--i)
#define st(n) sort(n.begin(), n.end())
#define rev(n) reverse(n.begin(),n.end())
#define ou(S) cout << S << endl
#define pb(n) push_back(n)
#define ue(N) N.erase(unique(N.begin(),N.end()),N.end());
#define nou(S) cout << S
#define hou(S) cout << setprecision(30) << S << endl
#define vec(K,L,N,S) vector<L> K(N,S)
#define dv(K,L,N,M,S) vector<vector<L>> K(N,vector<L>(M,S))
#define tv(K,L,N,M,R,S) vector<vector<vector<L>>> K(N,vector<vector<L>>(M,vector<L>(R,S)))
#define pint pair<lli,lli>
#define paf(L,R) pair<L,R>
#define mod 1000000007
#define mmax 5100000
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
using namespace std;
int main(){
  int n,sum=0,x,y,val=0;
  cin>>n;
  vector<int> v(n),c(n);
  rep(i,0,n)cin>>v.at(i);
  rep(i,0,n)cin>>c.at(i);
  rep(i,0,n){
    if(v.at(i)>c.at(i))val+=v.at(i)-c.at(i);
  }
  ou(val);
}

Measured memory_bytes: 256
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = Integer.parseInt(sc.nextLine());
		Set<String> set = new HashSet<>();
		for (int i = 0; i < n; i++) {
			set.add(sc.nextLine());
		}
		sc.close();
		System.out.println(set.size());
	}

}


Measured memory_bytes: 79696
// ALDS1-3-C.cpp : このファイルには 'main' 関数が含まれています。プログラム実行の開始と終了がそこで行われます。
//

#include <iostream>
#include<stdio.h>
#include <list>

using namespace std;
int main()
{
	list<int>L;
	int N;
	cin >> N; // コマンドの数
	char s[12];
	int key;
	for (int i = 0; i < N; i++)
	{
		scanf("%s", s);
		//cout << s << endl;
		if (s[0] == 'i')
		{
			scanf("%d", &key);
			L.push_front(key);
		}
		if (s[0] == 'd')
		{
			if (s[6] == 'L') {
				L.pop_back();
			}
			else if (s[6] == 'F') {
				L.pop_front();
			}
			else {
				// 該当する要素を先頭から一つだけ削除する。
				scanf("%d", &key);
				for (list<int>::iterator it = L.begin(); it != L.end(); it++)
				{
					if (*it == key) {
						L.erase(it);
						break;
					}
				}
			}
		}
	}
	list<int>::iterator it2 = L.begin();
	int len = L.size();
	while (len>1)
	{
		cout << *it2 << " ";
		it2++;
		len--;
	}
	cout << *it2 << endl;
}



Measured memory_bytes: 34404
#include <iostream>
#include <vector>
#define repeat(i,n) for (int i = 0; (i) < (n); ++(i))
typedef long long ll;
using namespace std;
template <class T> void setmin(T & a, T const & b) { if (b < a) a = b; }
template <typename T, typename X> auto vectors(T a, X x) { return vector<T>(x, a); }
template <typename T, typename X, typename Y, typename... Zs> auto vectors(T a, X x, Y y, Zs... zs) { auto cont = vectors(a, y, zs...); return vector<decltype(cont)>(x, cont); }
const int inf = 1e9+7;
int main() {
    int h, w; cin >> h >> w;
    vector<vector<int> > xss = vectors(int(), w, h); // column-major
    repeat (y,h) repeat (x,w) {
        char c; cin >> c;
        xss[x][y] = c - 'a';
    }
    int ans = 0;
    repeat (x,w-1) {
        vector<int> const & xs1 = xss[x  ];
        vector<int> const & xs2 = xss[x+1];
        vector<vector<int> > delta = vectors(0, h+1, h+1);
        repeat (y1, h+1) repeat (y, h-y1) delta[y1][0] += xs1[y] == xs2[y1+y];
        repeat (y2, h+1) repeat (y, h-y2) delta[0][y2] += xs1[y2+y] == xs2[y];
        delta[0][0] /= 2;
        repeat (y1, h) repeat (y2, h) delta[y1+1][y2+1] = delta[y1][y2] - (xs1[h-y1-1] == xs2[h-y2-1]);
        vector<vector<int> > dp = vectors(inf, h+1, h+1);
        dp[0][0] = 0;
        repeat (y1, h+1) repeat (y2, h+1) {
            if (y1) setmin(dp[y1][y2], dp[y1-1][y2] + delta[y1-1][y2]);
            if (y2) setmin(dp[y1][y2], dp[y1][y2-1] + delta[y1][y2-1]);
        }
        ans += dp[h][h];
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 1424
#include <algorithm>
#include <cassert>
#include <iostream>
#include <tuple>
#include <vector>

int main() {
  // Input
  int N;
  std::cin >> N;
  std::vector<std::string> S(N);
  std::vector<int> P(N);
  for (int i = 0; i < N; ++i)
    std::cin >> S[i] >> P[i];

  // Main
  std::vector<std::tuple<std::string, int, int>> work(N);
  for (int i = 0; i < N; ++i)
    work[i] = std::make_tuple(S[i], -P[i], i + 1);

  std::sort(work.begin(), work.end());

  // Output
  for (int i = 0; i < N; ++i)
    std::cout << std::get<2>(work[i]) << std::endl;

  return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<ll, P>IP;
typedef vector<ll> V;
typedef vector<V> V2;
typedef vector<vector<P> > G;
void g_dir(G &graph, ll a, ll b, ll w = 1){graph[a].push_back(P(b, w));}
void g_undir(G &graph, ll a, ll b, ll w = 1){g_dir(graph, a, b, w);g_dir(graph, b, a, w);}
#define rep(i, n) for(ll (i) = 0; (i) < (n); (i)++)
#define rep1(i, n) for(ll (i) = 1; (i) <= (n); (i)++)
#define rrep(i, n) for(ll (i) = (n) - 1; (i) >= 0; (i)--)
#define rrep1(i, n) for(ll (i) = (n); (i) >= 1; (i)--)
template<class T> void chmax(T &a, const T &b){if(a < b){a = b;}}
template<class T> void chmin(T &a, const T &b){if(a > b){a = b;}}
const ll INF = 1145141919;
const ll MOD = 1000000007;
const ll NUM = 101010;

int main(){   

    rep(i, 3){
        char c;
        cin >> c;
        if(c == '7'){
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 3644
#include <iostream>
using namespace std;
void arraycout(int *arrayy,int n){
    for(int u=0;u<n;u++){//出力
        if(u==n-1){
            cout<<arrayy[u]<<endl;
        }else{
            cout<<arrayy[u]<<' ';
        }
    }
    
}


void insertionSort(int* sou,int n){//挿入ソート
    for(int i=0;i<n;i++){
        int v=sou[i];
        int j=i-1;
        while(j>=0&&v<sou[j]){
            sou[j+1]=sou[j];
            j--;
        }
        sou[j+1]=v;
        arraycout(sou,n);
    }
}
int Bubble1(int* sou,int n){
    int flag=1;
    int ans=0;
    while(flag){
        flag=0;
        for(int i=n-1;i>0;i--){
            if(sou[i]<sou[i-1]){
                flag=1;
                swap(sou[i],sou[i-1]);
                ans++;
            }
        }
    }
    return ans;
    
}
int Bubble(int* sou,int n){
    int ans=0;
    for(int i=0;i<n;i++){
        for(int j=n-1;j>i;j--){
            if(sou[j]<sou[j-1]){
                swap(sou[j],sou[j-1]);
                ans++;
            }
        }
    }
    return ans;
}
int main(){
    
    int n;
    cin>>n;
    int sou[n];
    for(int i=0;i<n;i++){
        cin>>sou[i];
    }
    int ans=Bubble(sou,n);
    arraycout(sou,n);
    cout<<ans<<endl;
   // insertionSort(sou,n);
    // arraycout(sou,n);
    
    return 0;
}



Measured memory_bytes: 3136
#include<iostream>
#include<vector>
#include <cmath>
#include <map>
#include <cctype>
#include <algorithm>
#include <string>
using namespace std;
int main(void){
    int N ;
    cin >> N ;
    if(N % 2 == 0){
        cout << N / 2 << endl;
    }else{
        cout << N / 2 + 1 << endl;
    }
    return 0;
}

Measured memory_bytes: 256
s=input()
count = 0
for i in range(len(s)):
  if s[i].isupper():
    count+=1
if count != 2:
  print('WA')
  exit()
elif s[2:-1].count('C') != 1 or s[0]!='A' or not s[1].islower():
  print('WA')
else:
  print('AC')

Measured memory_bytes: 3060
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cassert>
#include <climits>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <fstream>

using namespace std;
#define SZ(x) (int)(x).size()
#define REP(i,n) for(int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REPR(i,n) for(int i=(n)-1;i>=0;i--)
#define ALL(s) (s).begin(), (s).end()
#define so(V) sort(ALL(V))
#define rev(V) reverse(ALL(V))
#define uni(v) v.erase( unique(ALL(v)) , v.end());

typedef long long unsigned int llu;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
typedef vector<bool> vb;
const double EPS = 1e-9;
const int MOD = 1e9 + 7;
const int INF = (1 << 29);
const ll LINF = 1e18;
const double PI = acos(-1);

template<typename T>vector<T> make_v(size_t a) { return vector<T>(a); }
template<typename T, typename... Ts>auto make_v(size_t a, Ts... ts) { return vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...)); }
template<typename T, typename U, typename... V>
typename enable_if<is_same<T, U>::value != 0>::type
fill_v(U& u, const V... v) { u = U(v...); }
template<typename T, typename U, typename... V>
typename enable_if<is_same<T, U>::value == 0>::type
fill_v(U& u, const V... v) { for (auto& e : u) fill_v<T>(e, v...); }
template<class T> bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> bool chmin(T& a, const T& b) { if (a > b) { a = b; return 1; } return 0; }

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll N;
	cin >> N;
	ll ans = N * (N - 1) / 2;
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#define ll long long

int main()
{
  int N, L;
  scanf("%d%d", &N, &L);
  ll w[N];
  for(int i=0; i<N; i++) scanf("%lld", &w[i]);

  int ind = -1;

  for(int i=0; i<N-1; i++)
   if(w[i] + w[i+1] >= L && ind == -1) //servono due nodi attaccati ancora sganciabili
    ind = i;

  if(ind == -1)
   printf("Impossible\n");
  else
  {
    printf("Possible\n");
    for(int i=0; i<N-1; i++)
     if(i != ind)
      printf("%d\n", ((i+i+1)/2+1));
     else
      break;

    for(int i=N-2; i>=0; i--)
     if(i != ind)
      printf("%d\n", ((i+i+1)/2+1));
     else
      break;

    printf("%d\n", ((ind+ind+1)/2+1));
  }

  return 0;
}

Measured memory_bytes: 1536
#include "bits/stdc++.h"
using namespace std;

void solve() {
    int N, Q;
    string S;
    cin >> N >> Q >> S;
    vector<int> sum(N);
    for (int i = 1; i < N; i++) {
        sum.at(i) = sum.at(i - 1);
        if (S.at(i-1) == 'A' && S.at(i) == 'C') {
            sum.at(i) = sum.at(i - 1) + 1;
        }
    }
    int l, r;
    for (int i = 0; i < Q; i++) {
        cin >> l >> r;
        cout << sum.at(r - 1) - sum.at(l - 1) << endl;
    }
    return;
}

int main() {
    solve();
}

Measured memory_bytes: 1408
#include "bits/stdc++.h"
using namespace std;
#define MOD 1000000007
#define FOR(i,a,b) for(long long i=(a);i<(b);i++)
#define REP(i,n)  FOR(i,0,n)
#define ITR(itr,mp) for(auto itr = (mp).begin(); itr != (mp).end(); ++itr)
#define dump(x)  cout << #x << " = " << (x) << endl;
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
typedef long long ll;
typedef pair<ll,ll> P;
typedef vector<vector<P>> Graph;


int main(){

  string s;
  cin >> s;
  
  for(int i = 0; i< s.size(); i+=2)
    cout << s[i];
  
  cout << endl;


 return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
using P = pair<ll,ll>;
constexpr ll mod = 1e9+7;
#define ALL(x) (x).begin(),(x).end()
#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)
#define REPS(i,n) for(ll (i)=1;(i)<=(n);(i)++)
#define RREP(i,n) for(ll (i)=(n-1);(i)>=0;(i)--)
#define RREPS(i,n) for(ll (i)=(n);(i)>0;(i)--)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define F first
#define S second
#define UNIQUE(v) v.erase(unique(ALL(v)),v.end());

template<class T> inline void chmin(T& a, T b){
    if (a > b){
        a = b;
    }
}

template<class T> inline void chmax(T& a, T b){
    if (a < b){
        a = b;
    }
}

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout<<fixed<<setprecision(12);
    ll K;
    cin >> K;
    cout << (K/2)*((K+1)/2) << "\n";
}

Measured memory_bytes: 3648
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>
#include <math.h>

int main(void){
    int sx,sy,tx,ty;
    scanf("%d%d%d%d",&sx,&sy,&tx,&ty);
    
    for (int i=0; i<abs(sy-ty); i++){
        printf("U");
    }
     for (int i=0; i<abs(sx-tx); i++){
        printf("R");
    }
    
    for (int i=0; i<abs(sy-ty); i++){
        printf("D");
    }
    for (int i=0; i<abs(sx-tx); i++){
        printf("L");
    }

    printf("L");
    for (int i=0; i<abs(sy-ty)+1; i++){
        printf("U");
    }
    for (int i=0; i<abs(sx-tx)+1; i++){
        printf("R");
    }
    printf("D");
    
    
    printf("R");
    for (int i=0; i<abs(sy-ty)+1; i++){
        printf("D");
    }
    for (int i=0; i<abs(sx-tx)+1; i++){
        printf("L");
    } 
    printf("U");
    printf("\n");
	return 0 ;
}

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

using namespace std;

const int dx[] = {0, 1, 1, 0, -1, -1};
const int dy[] = {-1, 0, 1, 1, 0, -1};

using Point = pair<int, int>;

int main() {
  int T;
  cin >> T;
  cin.ignore();  
  while(T--) {
    string s, t, sp;    
    //cin >> s >> t >> sp;
    getline(cin, s);
    getline(cin, t);
    getline(cin, sp);
    if(s.size() != t.size()) {
      cout << "false" << endl;
      continue;
    }
    int x = 0, y = 0;
    set<Point> vis;
    vis.insert(Point(0, 0));
    for(char c : s) {
      int k = c-'a';
      x += dx[k], y += dy[k];
      vis.insert(Point(x, y));
    }
    for(int i = 0; i < 6; i++) {
      for(Point p : vis) {
	set<Point> st;
	int x = p.first, y = p.second;
	st.insert(Point(x, y));
	for(char c : t) {
	  int k = c-'a';
	  x += dx[(k+i)%6], y += dy[(k+i)%6];
	  if(!vis.count(Point(x, y))) {
	    break;
	  } else {
	    st.insert(Point(x, y));
	  }
	}
	if(st == vis) {
	  cout << "true" << endl;
	  goto end;
	}
      }
    }
    cout << "false" << endl;
  end: ;
  }
  return 0;
}

Measured memory_bytes: 3172
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n - 1; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i <= n; i++)
#define FORR(i, m, n) for(int i = m; i >= n; i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
 
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<ll, ll>;

int main(){
	ll s;
    cin >> s;
    map<ll, ll> mp;
    ll ans = 0;
    while(1){
        ans++;
        mp[s]++;
        if(mp[s] == 2){
            cout << ans << endl;
            return 0;
        }
        if(s % 2) s = 3 * s + 1;
        else s /= 2;
    }
}

Measured memory_bytes: 256
from collections import defaultdict

n = int(input())
z = [list(map(int, input().split())) for _ in range(n)]
if n == 1:
    ans = 1
else:
    d = defaultdict(int)
    for i in range(n):
        xi, yi = z[i]
        for j in range(n):
            if i == j:
                continue
            xj, yj = z[j]
            d[(xi - xj, yi - yj)] += 1
    ans = n - max(d.values())
print(ans)


Measured memory_bytes: 3828
#include<iostream>
#include<string>
#include<vector>
#include<stdio.h>
#include<algorithm>
#include<math.h>
#include<numeric>
#include<iomanip>
#include<deque>
#include<tuple>
#include<queue>
#include<map>
#include <cstdint>
#include <boost/multiprecision/cpp_int.hpp>


#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define vi vector<int>
#define all(x) (x).begin(),(x).end()
#define Endl endl
#define F first
#define S second

namespace mp = boost::multiprecision;

using cpp_int = mp::cpp_int;
using ll = long long;
using namespace std;

ll ans = 0;
void dfs(int n,  int count, vector<int>a,
	vector<vector<int>>ab) {
	if (count == a.size()) {
		ans++;
	}
	else {
		for (int i = 1; i < a.size(); i++) {
			if (ab[n][i] == 1 && a[i] == 0) {
				a[i]++;
				count++;
				dfs(i,count, a, ab);
				count--;
				a[i] = 0;
			}
		}
	}
}
int main() {
	int n, m;
	cin >> n >> m;
	vector<vector<int>>map(n, vector<int>(n,0));
	rep(i, m) {
		int a, b;
		cin >> a >> b;
		a--; b--;
		map[a][b]++;
		map[b][a]++;
	}
	int count = 1;
	vector<int>path(n,0);
	path[0] = 1;
	dfs(0, count, path, map);
	cout << ans << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<math.h>
#include<vector>
#include<list>
using namespace std;
int main(void){
	int i,j,N,W;
	cin >> N;
	std::list<char> S;
	char tmp;
	for(i=0;i<N;i++){
		cin >> tmp;
		//cout << tmp << endl;
		S.push_back(tmp);
	}
	int lnum=0;//(の数、
	std::list<char>::iterator now= S.begin();
	while(now!=S.end()){
		if(*now=='('){
			lnum +=1;
			++now;
		}else if(*now==')'){
			if(lnum<=0){
				S.push_front('(');
				lnum =0;
				++now;
			}else{
				lnum -=1;
				++now;
			}
		}
	}
	if(*now=='('){
			lnum +=1;
			++now;
	}else if(*now==')'){
			if(lnum<=0){
				S.push_front('(');
				lnum =0;
				++now;
			}else{
				lnum -=1;
				++now;
			}
	}
	while(lnum>=1){
		lnum -=1;
		S.push_back(')');
	}
	for(now = S.begin();now!=S.end();++now){
		cout<<*now;
	}
	return 0;
}

Measured memory_bytes: 256
#D
def main():
    mod=1000000007
    x,y=map(int,input().split())
    k=min(x,y//2)
    l=min(x//2,y)
    n=k+l
    
    Fact=[1]
    for i in range(1,n+1):
        Fact.append(Fact[i-1]*i%mod)
    Finv=[0]*(n+1) #階乗の逆元
    Finv[-1]=pow(Fact[-1],mod-2,mod)
    for i in range(n-1,-1,-1):
        Finv[i]=Finv[i+1]*(i+1)%mod
    def comb(n,r):
        if n<r:
            return 0
        return Fact[n]*Finv[r]*Finv[n-r]%mod
    
    ans=0
    for a in range(k+1):
        if (x-a)%2!=0:
            continue
        if (x-a)//2==y-2*a:
            b=(x-a)//2
            ans+=comb(a+b,a)
            ans%=mod
    print(ans)
    
if __name__=='__main__':
    main()

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

int main() {
  string a;
  cin >> a;
  set<char> s;
  for(int i=0; i<a.size(); i++) s.insert(a[i]);
  if(s.size()==26) cout << "None" << endl;
  else {
    string ans;
    sort(a.begin(), a.end());
    for(int i=0; i<a.size()-1; i++) {
      if(a[0]!='a') {
        cout << "a" << endl;
        break;
      }
      else if(a[i]!=a[i+1] && a[i+1]!=a[i]+1) {
        ans = a[i]+1;
        break;
      }
      if(i==a.size()-2) {
        ans = a[i+1]+1;
        break;
      }
    }
    cout << ans << endl;
  }
  return 0;
}

Measured memory_bytes: 3732
N=int(input())
A=[]
B=[]
x=[]
c=0
for i in range(N):
    y=list(map(int,input().split()))
    A.append(y[0])
    B.append(y[1])
for i in range(N-1,-1,-1):
  x=A[i]
  y=B[i]
  if (x+c)%y!=0:
    c+=y-(x+c)%y
print(c)

Measured memory_bytes: 16896
#include<iostream>
using namespace std;
int main(){
	int a,b;
	cin>>a>>b;
	int num=a;
	int x=1;
	if(b==1){
		cout<<"0";
		
	}
	else{
		while(num<b){
		x++;
		num+=a-1;
	}
	cout<<x;
	}
} 

Measured memory_bytes: 256
def main():
    N = int(input())
    parts = [[int(a), 0] for a in input().split()]
    parts += [[int(b), 1] for b in input().split()]
    parts += [[int(c), 2] for c in input().split()]
    parts = sorted(parts, key = lambda x: x[0], reverse = True)
    countC = 0
    countBC = 0
    ans = 0
    for i in range(len(parts)):
        if parts[i][1] == 0:
            ans += countBC
        elif parts[i][1] == 1:
            countBC += countC
        else:
            countC += 1
    return ans 

if __name__ == '__main__':
    print(main())

Measured memory_bytes: 53388
#include"stdio.h"
#include"stdlib.h"

int main(void)
{
    int a,b,n=0,i;

    while(1)
    {
    scanf("%d %d",&a,&b);
    if(a==0&&b==0)break;
    i=b;

    for(int j = 0; j < a; j++)
        {
            if(i%2==0)
            {
                if(j%2==0)
                {
                    for(int v=0;v<b/2;v++)
                    {
                    printf("#.");
                    } 
                }

                if(j%2==1)
                {
                    for(int v=0;v<b/2;v++)
                    {
                    printf(".#");
                    } 
                }
                printf("\n");

            }

            if(i%2==1)
            {
                if(j%2==0)
                {
                    printf("#");
                    for(int v=0;v<b/2;v++)
                    {
                    printf(".#");
                    } 
                }

                if(j%2==1)
                {
                    printf(".");
                    for(int v=0;v<b/2;v++)
                    {
                    printf("#.");
                    } 
                }
                printf("\n");
            }
            
        }
        printf("\n");


    }

}

    

    



Measured memory_bytes: 2664
/*
"Won't stop untill I'm Phenomenal"
- Phenomenal, EMINEM
*/
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define ff first
#define Shazam ios_base::sync_with_stdio(false);   cin.tie(NULL); cout.tie(NULL);
#define ss second
#define all(c) c.begin(),c.end()
#define endl "\n"
#define test() int t; cin>>t; while(t--)
#define fl(i,a,b) for(int i = a ; i <b ;i++)
#define get(a) fl(i,0,a.size())  cin>>a[i];
#define pra(a) fl(i,0,a.size()) cout<<a[i]<<" ";	cout<<endl;
#define pr(a,n) fl(i,0,n) cout<<a[i]<<" ";	cout<<endl;
const ll INF = 2e18;
const int inf = 2e9;
const int mod1 = 1e9 + 7;



int main(){
    Shazam;
    int n; cin>>n;
    string s; cin>>s;
    vector<int> cnt(n);
    for(int i =0 ; i < n; i++){
        cnt[i] = (s[i]=='R');
        if(i){
            cnt[i]+=cnt[i-1];
        }
    }
    int ans = n+1;
    for(int i = 0 ; i < n; i++){
        ans = min(ans, max(i+1 - cnt[i],  cnt[n-1]-cnt[i] ));
    }
    if(*max_element(all(cnt)) == 0){
        ans = 0;
    } 
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 4400
#include <iostream>
#include <numeric>
#include <cmath>
#include <limits>
#include <stdio.h>
#include <iomanip>
#include <cstdlib>
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
using namespace std;
using ll = long long;
#define rep(i, n) for (long long i = 0; i < (long long)(n); i++)
ll Max(ll(a), ll(b), ll(c)) {
	return max(max(a, b), c);
}
ll Min(ll(a), ll(b), ll(c)) {
	return min(min(a, b), c);
}



using Graph = vector<vector<int>>;


int main() {
	ll N,an=0,c=0,s=0;
	string S;
	cin >> N >> S;
	for (ll i = 0; i < N - 1; i++) {
		c = 0;
		s = 0;
		rep(d, 26) {
			
			char k = 'a' + d;
			for (ll j = 0; j <= i; j++) {
				if (S.at(j) == char(k)) {
					
					for (ll t = i + 1; t < N; t++) {
						if (S.at(t) == k) {
							s++;
							c = 1;
							
							break;
						}
					}
					
				}
				if (c == 1) {
					c = 0;
					break;
				}
			}
		}
	
		an = max(an, s);
	}
	cout << an << endl;
}

Measured memory_bytes: 256
#include<algorithm>
#include<complex>
#include<ctype.h>
#include<iomanip>
#include<iostream>
#include<map>
#include<math.h>
#include<numeric>
#include<queue>
#include<set>
#include<stack>
#include<stdio.h>
#include<string>
#include<string>
#include<vector>

using namespace std;
typedef long long ll;

#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define ALL(v) (v).begin(), (v).end()
#define p(s) cout<<(s)<<endl
#define p2(s, t) cout << (s) << " " << (t) << endl
#define br() p("")
#define pn(s) cout << (#s) << " " << (s) << endl
#define p_yes() p("Yes")
#define p_no() p("No")

template < typename T >
void vprint(T &V){
	for(auto v : V){
    	cout << v << " ";
	}
	cout << endl;
}

const ll mod = 1e9 + 7;
const ll inf = 1e18;

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

    // input
    ll N;
    cin >> N;

    FOR(h, 1, 3501){
        FOR(n, 1, 3501){
            ll a = N*h*n;
            ll b = 4*h*n-N*n-N*h;
            if(b>0 && a%b==0){
                ll w = a/b;
                cout << h << " " << n << " " << w << endl;
                return 0;
            }   
        }
    }
    
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(void){
    int n,x[100],y[100],i,t;
    double d1=0,d2=0,d3=0,di=0;
    scanf("%d",&n);
    for(i=0;i<n;i++){
        scanf("%d",&x[i]);
    }
    for(i=0;i<n;i++){
        scanf("%d",&y[i]);
    }
    for(i=0;i<n;i++){
        t=x[i]-y[i];
        if(t<0)
            t=-t;
        d1+=t;
        d2+=t*t;
        d3+=t*t*t;
        if(di<t) di=t;
    }
    d2=pow(d2,1./2);
    d3=pow(d3,1./3);
    printf("%.6f\n%.6f\n%.6f\n%.6f\n",d1,d2,d3,di);
    return 0;
}


Measured memory_bytes: 2112
#include<bits/stdc++.h>
using namespace std;
class pr{
public:
  int a,b,c;
  pr()
  {
    a=b=c=0;
  }
  pr(int x,int y,int z):a(x),b(y),c(z) { }
};
pr maxm(pr a,pr b)
{
  pr c;
  if(a.a>b.a)
  c=a;
  else c=b;
  return c;
}
bool notz(pr y)
{
  if(y.b==0||y.c==0)
  return false;
  return true;
}
int main()
{
  string a,b;
  cin>>a>>b;
  int l=a.length();
  int m=b.length();
  vector<vector<pr>> v(l+1,vector<pr>(m+1));
  for(int i=1;i<=l;i++)
  {
    for(int j=1;j<=m;j++)
    {
      if(a[i-1]==b[j-1])
      {
        v[i][j].a=v[i-1][j-1].a+1;
        v[i][j].b=i-1;//row no of prev cell
        v[i][j].c=j-1;///col no of prev cell
      }
      else
      {
        v[i][j]=maxm(v[i-1][j],v[i][j-1]);
      }
    }
  }
  string s;
  pr ans=v[l][m];
  int lth=ans.a,cnt=0;
  //cout<<ans.a<<" "<<ans.b<<" "<<ans.c<<endl;
  while(notz(ans)&&cnt<lth)
  {
    s+=a[ans.b];
    cnt++;
    ans=v[ans.b][ans.c];
  }
  if(cnt<lth)
  s+=a[ans.b];
  reverse(s.begin(),s.end());
  cout<<s<<endl;
  return 0;
}


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

#define maxn 3111
#define rep(i,a,b) for(int i=a;i<=b;++i)

typedef long long ll;
ll f[maxn*2][maxn*2];
ll mod=1000000007;
ll ans;
int n,m,k;

ll upd(ll &x,ll y)
{
	x+=y;
	x>=mod?x-=mod:(1);
}

int main()
{
	cin>>n>>m>>k;
	f[0][0]=1;
	rep(i,1,n+m)
	{
		rep(j,0,n+m)
		{
			upd(f[i][j],f[i-1][j]);
			upd(f[i][j+k],mod-f[i-1][j]);
		}
		rep(j,1,n+m)
			upd(f[i][j],f[i][j-1]);
	}
	int nn=n%(k-1);
	rep(i,1,n+m)
	{
		rep(j,0,n+m)
		{
			if (!f[i][j]) continue;
			int p=j,q=i*(k-1)-j;
			if (q<0) break;
			if (p<=n && q<m && (p%(k-1)==nn))
			{
				upd(ans,f[i][j]);
				upd(ans,mod-f[i-1][j]);
			}
		}
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 194688
// --------------------<optimizations>--------------------
#pragma GCC optimize("O3")

//(UNCOMMENT WHEN HAVING LOTS OF RECURSIONS)\
#pragma comment(linker, "/stack:200000000")
//(UNCOMMENT WHEN TRYING TO BRUTEFORCE WITH A LOT OF LOOPS)\
#pragma GCC optimize("unroll-loops")

// -------------------</optimizations>--------------------
#include<bits/stdc++.h>
using namespace std;
//#define int long long
//#define d long double
#define pii pair<int,int>
#define pb push_back
#define cases int tc;cin>>tc;while(tc--)
#define N 200003
#define M 103
#define inf 1e18
#define Arena ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
//int mod=1e9+7;
//int mod=998244353;
set<int> g[M];
map<pii,bool> vis;
vector<pii> ans;

void dfs(int i,int p)
{
    if(i!=p)
        ans.pb({p,i}), vis[{p,i}]=vis[{i,p}]=1;
    
    for(auto j:g[i])
    {
        if(vis[{j,i}]==0)
            dfs(j,i);
    }
}   

signed main()
{
    Arena
    
    int n,k;
    cin>>n>>k;

    int i,j;
    for(i=1;i<=n-1;++i)
    {
        for(j=i+1;j<=n;++j)
            g[i].insert(j),g[j].insert(i);
    }
    
    i=n;
    while(k and i>=3)
    {
        j=i-1;
        while(k and j>1)
        {
            g[j].erase(i);
            g[i].erase(j);
            --k;
            --j;
        }   
        --i;
    }   
    if(k)
        return cout<<-1, 0;
    
    dfs(1,1);
    cout<<ans.size()<<'\n';
    for(auto it:ans)
        cout<<it.first<<' '<<it.second<<'\n';
    
    return 0;
}


Measured memory_bytes: 2176
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
#define rrep(i,n) for(int i=1;i<(n);++i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define maxs(a, b) a = max(a, b)
#define mins(a, b) a = min(a, b)
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const ll linf = (1LL << 61);
const int inf = 1001001001;
const int mod = 1000000007;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	double a, b;
	int h, m;
	cin >> a >> b >> h >> m;
	double pi = acos(-1);
	int t = (h % 12) * 60 + m;
	double o = (double)t / (60.0 * 12);
	double i = m / 60.0;
	double c = abs(o - i);
	if (c > 0.5) c = 1 - c;
	double ans = 360 * c;
	double res = ans * pi / 180.0;
	double j_ans = sqrt(a * a + b * b - 2.0 * a * b * cos(res));
	cout << fixed << setprecision(15) << j_ans << endl;
	return 0;
}

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

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

#define rep(i, n) for (int i = 1; i <= (n); ++i)
#define rag(con) std::begin(con), std::end(con)

int main()
{
    int n;

    std::cin >> n;

    std::vector<ll> dat(n);

    std::vector<std::vector<ll>> s(n + 1), t;

    rep(i, n)
    {
        s[i].resize((n - 2) / i + 1);
    }
    t = s;

    rep(i, n)
    {
        std::cin >> dat[i - 1];
    }

    rep(i, n)
    {
        rep(j, (n - 2) / i)
        {
            s[i][j] = s[i][j - 1] + dat[j * i];
            t[i][j] = t[i][j - 1] + dat[n - 1 - j * i];
        }
    }

    ll ans = 0;

    rep(i, n)
    {
        for (int j = 1; j <= (n - 2) / i; ++j)
        {
            int a = n - 1 - i * j;
            if (a <= i)
                break;
            if (a % i > 0 || 2 * (i * j + 1) <= n)
                ans = std::max(ans, s[i][j] + t[i][j]);
        }
    }

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

    return 0;
}

Measured memory_bytes: 31228
import math
K = int(input())
gcd: int = 0
a: int = 0
b: int = 0
c: int = 0
for a in range(1, K+1):
    for b in range(1, K+1):
        for c in (range(1, K+1)):
            tmp = math.gcd(a, b)
            gcd += math.gcd(tmp, c)
    
print(gcd)


Measured memory_bytes: 67744
#include<stdio.h>
#define WHITE 0    //non-visited
#define GRAY 1     //visited
#define BLACK 2    //finished
#define N 101
#define NIL 100000

typedef struct{
  int id;
  int k;
  int v[N];
  int color;
}V;

int n=0, head=0, tail=0;
int d[N],Q[N];
V S[N];

void Enqueue(int);
int Dequeue(void);

void BFS(int s){
  int i,j,v;
  for(i=1 ; i<=n ; i++) {
    S[i].color = WHITE;
    d[i] = NIL;
  }
  S[s].color = GRAY;
  d[s] = 0;
  
  Enqueue(s);
  
  while(head != tail){
    i = Dequeue();
    for(j=1 ; j<=S[i].k ; j++){
      v = S[i].v[j];
      if(S[v].color == WHITE){
	S[v].color = GRAY;
	d[v] = d[i]+1;
	Enqueue(v);
      }
    }
      S[i].color = BLACK;
  }
}

  /*void DFS_Visit(int u){
  color[u] = GRAY;
  d[u] = ++time;
  int i;
  for(i=1 ; i<=n ; n++) if(color[i] == WHITE) DFS_Visit(i);
  color[u] = BLACK;
  f[u] = ++time;
  }*/

  void Enqueue(int x){
    Q[tail] = x;
    tail++;
  }

  int Dequeue(){
    int x = Q[head];
    head++;
    return x;
  }

int main(){
  int i,j;

  scanf("%d",&n);

  for(i=1 ; i<=n ; i++){
    scanf("%d%d",&S[i].id,&S[i].k);
    for(j=1 ; j<=S[i].k ; j++){
      scanf("%d",&S[i].v[j]);
    }
  }

  BFS(S[1].id);

  for(i=1 ; i<=n ; i++){
    printf("%d ",S[i].id);
    if(d[i] == NIL) printf("-1\n");
    else printf("%d\n",d[i]);
  }

  return 0;
}

Measured memory_bytes: 636
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int M=100005;
int x1,x2,y11,y2,xc,yc,xd,yd;



int main()
{

    ios_base::sync_with_stdio(false);
    cin>>x1>>y11>>x2>>y2;
    xc = x1 + (y11 - y2);
    yc = y11 - (x1 - x2);
    xd=  x2 + (y11 - y2);
    yd = y2 - (x1 - x2);
    cout<<xd<<" "<<yd<<" "<<xc<<" "<<yc<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <utility>
#include <map>
#include <vector>
#include <algorithm>
#include <queue>
#include <math.h>
#include <stack>
#include <set>
#include <deque>
#include <cmath>
#include <cassert>

using namespace std;
typedef long long ll;
ll mod = 1e9+7;
//ll mod = 998244353;
#define rep(i,n) for(int i = 0; i < (n); ++i)

int main() {
    int n;
    cin >> n;
    if (n % 1000 == 0) {
        cout << 0 << endl;
    }
    else {
        cout << 1000 * ((n / 1000) + 1) - n << endl;
    }
    return 0;
}


Measured memory_bytes: 3604
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Text;
using System.Globalization;
using System.Diagnostics;



class Myon
{
    public Myon() { }
    public static int Main()
    {
        new Myon().calc();
        return 0;
    }
    

    Scanner cin;

    void calc()
    {
        cin = new Scanner();
        int N = cin.nextInt() - 1;
        int M = cin.nextInt() - 1;
        Console.WriteLine(N * M);
    }




}



class Scanner
{
    string[] s;
    int i;

    char[] cs = new char[] { ' ' };

    public Scanner()
    {
        s = new string[0];
        i = 0;
    }

    public string next()
    {
        if (i < s.Length) return s[i++];
        string st = Console.ReadLine();
        while (st == "") st = Console.ReadLine();
        s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        if (s.Length == 0) return next();
        i = 0;
        return s[i++];
    }

    public int nextInt()
    {
        return int.Parse(next());
    }
    public int[] ArrayInt(int N, int add = 0)
    {
        int[] Array = new int[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextInt() + add;
        }
        return Array;
    }

    public long nextLong()
    {
        return long.Parse(next());
    }

    public long[] ArrayLong(int N, long add = 0)
    {
        long[] Array = new long[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextLong() + add;
        }
        return Array;
    }

    public double nextDouble()
    {
        return double.Parse(next());
    }


    public double[] ArrayDouble(int N, double add = 0)
    {
        double[] Array = new double[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextDouble() + add;
        }
        return Array;
    }
}

Measured memory_bytes: 13140
package main

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

var sc = bufio.NewScanner(os.Stdin)

func main() {
	scanInit()

	a := nextInt()
	b := nextInt()
	c := nextInt()

	for i := 1; i < 10000; i++ {
		v := i*b + c
		if v%a == 0 {
			fmt.Println("YES")
			return
		}
	}

	fmt.Println("NO")
	return

}

// ---- readfunc
func scanInit() {
	const cap = 200 * 1024 // default=64*1024
	var buf = make([]byte, cap)
	sc.Buffer(buf, cap)
	sc.Split(bufio.ScanWords)
	return
}
func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}
func nextStr() string {
	sc.Scan()
	return sc.Text()
}


Measured memory_bytes: 1780
import java.util.*;

public class Main {

    public static void main(String[] args) {

        Scanner scan = new Scanner(System.in);

        int A = scan.nextInt();
        int B = scan.nextInt();
        int ans = 0;

        if(B < A){

            ans += A;
            A--;

        }else{

            ans += B;
            B--;
        }

        if(B < A){

            ans += A;
            A--;

        }else{

            ans += B;
            B--;
        }


        System.out.println(ans);
    }
}

Measured memory_bytes: 21972
def prime(x):
    y = list(range(1, x + 1))
    y[0] = 0
    x_sqrt = x ** 0.5
    for i in y:
        if i > x_sqrt:
            break
        elif i == 0:
            continue
        for not_prime in range(2 * i, x + 1, i):
            y[not_prime - 1] = 0
    return [i for i in y if i > 0]

n = int(input())
MOD = 10 ** 9 + 7
primes = prime(n)
m = [0 for _ in range(len(primes))]
for i, p in enumerate(primes):
    for j in range(1, n + 1):
        while(j % p == 0):
            m[i] += 1
            j = j // p
ans = 1
for i in m:
    ans *= (i + 1)
    ans = ans % MOD
print(ans)


Measured memory_bytes: 3064
#include<iostream>
#include<algorithm>
#include<cmath>
#include<map>
#include<stdio.h>
#include<vector>
#define int long long
using namespace std;
#define rep(s,i,n) for(int i=s;i<n;i++)
#define c(n) cout<<n<<endl;
pair<int,int>a[214514];
signed main(){
	int n;
	cin>>n;
	rep(0,i,n){
		cin>>a[i].second;
		cin>>a[i].first;
	}
	sort(a,a+n);
	int sum=0;
	rep(0,i,n){
		sum+=a[i].second;
		if(sum>a[i].first){
			c("No")
			return 0;
		}	
	}
	c("Yes")
}		

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

int main(){
	int k, t;
	scanf("%d%d", &k, &t);
	int mx = 0, sum = 0;
	f(i, 0, t){
		int z;
		scanf("%d", &z);
		mx = max(z, mx);
		sum += z;
	}
	printf("%d\n", max(0, mx - (sum - mx) - 1));
}


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

int main(){
  int H,W,A,B;
  cin>>H>>W>>A>>B;
  int D[W][H];
  for(int i=0;i<H;i++){
    for(int j=0;j<W;j++){
      if((j<=A-1 && i<=B-1)||(j>=A && i>=B)){
        D[j][i]=0;
      }
      else D[j][i]=1;
    }
  }
  for(int i=0;i<H;i++){
    for(int j=0;j<W;j++){
      cout<<D[j][i];
    }
    cout<<endl;
  }  
  cout<<endl;  
  return 0;
}

  

Measured memory_bytes: 5120
# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict
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

sys.setrecursionlimit(10000)


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()


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):
    ans = 0
    A_ = [(a, i) for i, a in enumerate(A)]
    A_.sort()

    A.sort()
    p = A[0]
    for a in A:
        ans += abs(a-p)
        p = a
    return ans


def main():
    A = read_int_n()
    print(slv(A))


if __name__ == '__main__':
    main()


Measured memory_bytes: 7748
import fractions
A, B, C, D = map(int, input().split())

l=C*D//fractions.gcd(C,D)
underB = B- (B//C+B//D-B//l)
underA = (A-1)- ((A-1)//C+(A-1)//D-(A-1)//l)
#print(underB, underA)
print(underB-underA)

Measured memory_bytes: 5048
#pragma GCC optimize ("Ofast")
#include "bits/stdc++.h"
#include "ext/pb_ds/assoc_container.hpp"
#include "ext/pb_ds/tree_policy.hpp"
using namespace __gnu_pbds;
using namespace std;
typedef long long int ll;
#define int long long int
#define pb push_back
#define fi first
#define se second
#define deb cerr << "Line no." << __LINE__
#define fr(i, a, b) for(int i = a; i <= b; i++)
#define all(x) x.begin(), x.end()
#define IO ios :: sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define pii pair<int,int>
#define sz(x) (int)x.size()
const int mod = 1e9 + 7;
const int mod1 = 998244353;
typedef long double f80;
#ifndef LOCAL
#define endl '\n'
#endif

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

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int rand(int l, int r){
	uniform_int_distribution<int> uid(l, r);
	return uid(rng);
}
int pwr(int a,int b){
	int ans = 1;
	while(b){
		if(b & 1) ans = (ans * a) % mod;
		a = (a * a) % mod;
		b >>= 1;
	}
	return ans;
}
const int N = 3005;
const int NN = 3e5 + 5;
int fact[NN], ifact[NN];
pair<int,int> p[N];
int dp[N];
int n;
int ncr(int n,int k){
	if(n < k || k < 0) return 0;
	int ans = (fact[n] * ifact[n - k]) % mod;
	return (ans * ifact[k]) % mod;
}
int go(int i){
	if(dp[i] != -1) return dp[i];
	dp[i] = ncr(p[i].fi - 1 + p[i].se - 1, p[i].fi - 1);
	fr(j, 1, n){
		if(j == i || j == n - 1) continue;
		if(p[j].fi <= p[i].fi && p[j].se <= p[i].se){
			dp[i] -= (go(j) * ncr(p[i].fi - p[j].fi + p[i].se - p[j].se, p[i].fi - p[j].fi)) % mod;
		}
	}
	dp[i] = (dp[i] % mod + mod) % mod;
	return dp[i];
}
void solve(){
	fact[0] = 1;
	fr(i, 1, NN - 1){
		fact[i] = (i * fact[i - 1]) % mod;
	}
	ifact[NN - 1] = pwr(fact[NN - 1], mod - 2);
	for(int i = NN - 2; i >= 0; i--){
		ifact[i] = (ifact[i + 1] * (i + 1)) % mod;
	}
	int h, w;
	cin >> h >> w >> n;
	fr(i, 1, n){
		cin >> p[i].fi >> p[i].se;
	}
	p[n + 1] = {1, 1};
	p[n + 2] = {h, w};
	n += 2;
	fill(dp + 1, dp + n + 1, -1);
	dp[n - 1] = 1;
	cout << go(n) << endl;
}
signed main(){
  	IO;
  	#ifdef LOCAL
		freopen("inp.txt","r", stdin);
		// freopen("out.txt", "w", stdout);
	#endif
 	clock_t clk = clock();
  	int t = 1;
  	// cin >> t;
  	fr(tt, 1, t){
    	solve();
  	}
  	cerr << endl << (double)(clock() - clk) / CLOCKS_PER_SEC;
  	return 0;
}

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

bool is_prime(int k)
{
	for(int j=2;j*j<=k;j++){
		if(k%j==0) {
			return false;
		}
	}
    return true;
}

int main()
{
    ll N;
    cin>>N;
    long double A[N+1];
    for(int i=1;i<=N;i++){
    	cin>>A[i];
    	A[i]=A[i]-i;
    }
    sort(A+1,A+N+1);
    ll b;
    if(N%2==0) b=round((A[N/2]+A[N/2+1])/2);
    else b=A[(N+1)/2];
    // cout<<b<<endl;

    ll ans=0;
    for(int i=1;i<=N;i++){
    	  ans+=abs(A[i]-b);
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3328