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

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int,int> pii;
typedef pair<double, double> pdd;
typedef pair<ll, ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;
typedef vector<pdd> vdd;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define mem(a,b) memset(a, b, sizeof(a) )
#define all(x) (x).begin(),(x).end()
#define INF 1000000000000
#define MOD 1000000007
#define PB push_back
#define MP make_pair
#define F first
#define S second

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)); }

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

int ctoi(char c) {
	if (c >= '0' && c <= '9') {
		return c - '0';
	}
	return 0;
}

int main(){
	int h,w,n;cin>>h>>w>>n;
	vi a(n);
	rep(i,n)cin>>a[i];
	vvi b(h,vi(w));
	int m=1,cnt=0;
	rep(i,h){
		if(i%2==0){
			rep(j,w){
				b[i][j]=m;
				cnt++;
				if(cnt==a[m-1]){
					m++;
					cnt=0;
				}
			}
		}
		else{
			for(int j=w-1;j>=0;--j){
				b[i][j]=m;
				cnt++;
				if(cnt==a[m-1]){
					m++;
					cnt=0;
				}
			}
		}
	}
	rep(i,h){
		rep(j,w){
			if(j!=w-1)cout<<b[i][j]<<" ";
			else cout<<b[i][j]<<endl;
		}
	}
}

Measured memory_bytes: 384
//#include<bits\stdc++.h>
#include<iostream>
#include<iomanip>
#include<cstdio>
#include<cstring>
#include<string>
#include<ctime>
#include<cmath>
#include<cctype>
#include<cstdlib>
#include<queue>
#include<deque>
#include<stack>
#include<vector>
#include<algorithm>
#include<utility>
#include<bitset>
#include<set>
#include<map>
#define ll long long
#define db double
#define INF 10000000000000010ll
#define ldb long double
#define pb push_back
#define put_(x) printf("%d ",x);
#define get(x) x=read()
#define gt(x) scanf("%d",&x)
#define gi(x) scanf("%lf",&x)
#define put(x) printf("%d\n",x)
#define putl(x) printf("%lld\n",x)
#define gc(a) scanf("%s",a+1)
#define rep(p,n,i) for(RE int i=p;i<=n;++i)
#define go(x) for(int i=lin[x],tn=ver[i];i;tn=ver[i=nex[i]])
#define fep(n,p,i) for(RE int i=n;i>=p;--i)
#define vep(p,n,i) for(RE int i=p;i<n;++i)
#define pii pair<int,int>
#define mk make_pair
#define RE register
#define P 1000000007
#define gf(x) scanf("%lf",&x)
#define pf(x) ((x)*(x))
#define uint unsigned long long
#define ui unsigned
#define EPS 1e-8
#define sq sqrt
#define S second
#define F first
#define mod 998244353
using namespace std;
char buf[1<<15],*fs,*ft;
inline char getc()
{
    return (fs==ft&&(ft=(fs=buf)+fread(buf,1,1<<15,stdin),fs==ft))?0:*fs++;
}
inline int read()
{
    RE int x=0,f=1;RE char ch=getc();
    while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getc();}
    while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getc();}
    return x*f;
}
const int MAXN=200010;
int n;
int a[MAXN];
priority_queue<pii>q;
int main()
{
	//freopen("1.in","r",stdin);
	get(n);ll ans=0;
	rep(1,n,i)get(a[i]);
	sort(a+1,a+1+n);
	q.push(mk(a[n],a[n]));
	fep(n-1,1,i)
	{
		pii w=q.top();
		q.pop();
		ans+=w.F;
		q.push(mk(a[i],w.F));
		q.push(mk(a[i],w.S));
	}
	putl(ans);
	return 0;
}


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

int main()
{
	int n;
	cin>>n;
	if(n%10 == 3) cout<<"bon"<<endl;
	else if(n%10 == 0 || n%10 == 1 || n%10 == 6 || n%10 == 8)
	    cout<<"pon"<<endl;
	else cout<<"hon"<<endl;
	
	return 0;
}

Measured memory_bytes: 3596
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define FOR(var, begin, end) for (int var = (begin); var <= (end); var++)
#define RFOR(var, begin, end) for (int var = (begin); var >= (end); var--)
#define REP(var, length) FOR(var, 0, length - 1)
#define RREP(var, length) RFOR(var, length - 1, 0)
#define EACH(value, var) for (auto value : var)
#define SORT(var) sort(var.begin(), var.end())
#define REVERSE(var) reverse(var.begin(), var.end())
#define RSORT(var) SORT(var); REVERSE(var)

const ll MOD = 1e9 + 7;

void solve(istream& cin, ostream& cout) {
  int n, a, b, c, d;
  string s;
  cin >> n >> a >> b >> c >> d;
  a--;
  b--;
  c--;
  d--;
  cin >> s;
  int cnt = 0;
  vector<int> x(n);
  vector<int> r(n);
  RREP(i, n) {
    if (s[i] == '.') {
      cnt++;
    } else {
      cnt = 0;
    }
    x[i] = cnt;
  }
  cnt = 0;
  RREP(i, n) {
    if (s[i] == '#') {
      cnt++;
    } else {
      cnt = 0;
    }
    r[i] = cnt;
  }
  if (c < d) {
    FOR(i, a + 1, d - 1) {
      if (r[i] > 1) {
        cout << "No" << endl;
        return;
      }
    }
    cout << "Yes" << endl;
  } else {
    FOR(i, a + 1, c - 1) {
      if (r[i] > 1) {
        cout << "No" << endl;
        return;
      }
    }
    FOR(i, b - 1, d - 1) {
      if (x[i] >= 3) {
        cout << "Yes" << endl;
        return;
      }
    }
    cout << "No" << endl;
  }
}

#ifndef TEST
int main() {
  solve(cin, cout);
}
#endif


Measured memory_bytes: 2052
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1e18

int main() {
    int N;
    cin >> N;
    vector<int> v(N, 0);
    for (int i = 0; i < N - 1; i++) {
        int a;
        cin >> a;
        a--;
        v[a]++;
    }
    for (int i = 0; i < N; i++) cout << v[i] << endl;
    return 0;
}

Measured memory_bytes: 3976
#ifdef LOCAL
#include <cstdio>
#include <vector>
#include <algorithm>
#include <iostream>
#include <cstring>
#else
#include <bits/stdc++.h>
#endif
using namespace std ;

typedef long long ll ;
#define rep(i , n ) for ( int i =0; i < n ; i++)
#define _sort(arg) sort(begin(arg), end(arg))
#define MOD 1000000007
#define pb push_back
#define DEBUG(x) cout << #x << ": " << x << endl;

/*
__attribute__((constructor))
void initial()
{
	cin.tie(NULL);
	ios::sync_with_stdio(false);
}
*/
void swap(int &a, int &b)
{
	a = a ^ b;
	b = a ^ b;
	a = a ^ b;
}

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

	int N;
	
	cin >> N;

	int p[N];

	rep(i, N)
	{
		cin >> p[i];
		p[i]--;
	}

	int ans = 0;

	rep(i, N)
	{
		if (p[i] == i)
		{
			if (i < N-1)
			{
				swap(p[i+1], p[i]);
			}
			else 
			{
				swap(p[i-1], p[i]);
			}
			ans++;
		}

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


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

#define int long long

int n,arr[200005],ps[200005];

void main2(){
  int sum2=0,ans;
  for(int x=0;x<n;x++){
    if((x%2)==1)sum2+=arr[x];
  }
  ans=sum2;
  for(int x=0;x<n;x+=2){
    sum2+=arr[x]-arr[x+1];
    ans=max(ans,sum2);
  }
  cout<<ans<<'\n';
}

int32_t main(){
    ios_base::sync_with_stdio(false);cin.tie(0);
    int sum=0,ans=LLONG_MIN,maxi=LLONG_MIN;
    cin>>n;
    for(int x=0;x<n;x++){
      cin>>arr[x];
    }
    if((n%2)==0){
      main2();
      return 0;
    }
    for(int x=0;x<n;x+=2){
      if((x%2)==0){//odd elements...
        sum+=arr[x];
      }
    }
    ps[0]=0;
    for(int x=0;x<n;x++){
      ps[x+1]=ps[x];
      if((x%2)==1){//even elements...
        ps[x+1]+=arr[x]-arr[x+1];
      }
    }
    for(int x=n;x>=1;x-=2){//try removing every element...
      maxi=max(maxi,ps[x]);
      ans=max(ans,sum+maxi-ps[x]-arr[x-1]);
    }
    cout<<ans<<'\n';
    return 0;
}
/*

*/


Measured memory_bytes: 6664
K=int(input())
lunlun=[1,2,3,4,5,6,7,8,9]
flag=1
i=0
if K<10:
  pass
else:
  while flag==1 :
    if len(lunlun)>=K:
        flag=0
        break
    else:
      x=lunlun[i]
      if x % 10 != 0:
        lunlun.append(x*10+x%10-1)
    
      lunlun.append(x*10+x%10)
    
      if x % 10 != 9:
        lunlun.append(x*10+x%10+1) 
	
    i+=1
        
print(lunlun[K-1])


Measured memory_bytes: 7196
import sys

sys.setrecursionlimit(10 ** 8)

input = sys.stdin.readline

MOD = 10 ** 9 + 7


def main():
    N, K = [int(x) for x in input().split()]

    ans = 0
    b = ((N + 1) * (N + 2)) // 2 - (N + 1)
    for i in range(K, N + 2):
        a = (i * (i + 1)) // 2 - i
        aa = ((N + 1 - i) * (N - i + 1 + 1)) // 2 - (N - i + 1)
        ans += (b - aa) - a + 1
        ans = ans % MOD

    print(ans)


if __name__ == '__main__':
    main()


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

int main() {
    int N;
    cin >> N;
    vector<int> P(N);
    for (int i = 0; i < N; i++) {
        cin >> P[i];
        P[i]--;
    }

    vector<int> cnt(N + 1);
    for (int i = 0; i < N; i++) {
        if (P[i] == i) cnt[i]++;
    }

    int res = 0;
    for (int i = 0; i < N; i++) {
        if (cnt[i]) res++;
        if (cnt[i] && cnt[i + 1]) i++;
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 1024
#include<iostream>
#include<cstring>
#include<map>
#include<algorithm>
using namespace std;
map<int,int>Map;
int a[100005];
int main()
{
    int n;
    cin>>n;
    for(int i=1;i<=n;i++)
    {
        int k;
        scanf("%d",&a[i]);
    }
    sort(a+1,a+1+n);
    int ans=0;
    for(int i=1;i<=n;)
    {
        int tmp=a[i],sum=0;
        while(tmp==a[i])
        {
            sum++;
            i++;
        }
        if(tmp==sum)
        {
            continue;
        }
        else if(tmp>sum) ans+=sum;
        else ans+=(sum-tmp);
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 640
#include <iostream>
#include <vector>
#include <array>
#include <list>
#include <queue>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <string>
#include <sstream>
#include <algorithm>
#include <random>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <cmath>
#include <cassert>
#include <climits>
#include <bitset>
#include <functional>

#define FOR_LT(i, beg, end) for (int i = beg; i < end; i++)
#define FOR_LE(i, beg, end) for (int i = beg; i <= end; i++)
#define FOR_DW(i, beg, end) for (int i = beg; end <= i; i--)

using namespace std;

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

	int n; cin >> n;
	string s; cin >> s;

	char c = ' ';
	int ans = 0;
	FOR_LT(i, 0, n) {
		if (c != s[i]) {
			ans++;
		}
		c = s[i];
	}

	cout << ans << endl;

	return 0;
}

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

// Loops
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for (int i = int(a); i < int(b); ++i)
#define _rrep(i, n) rrepi(i, n, 0)
#define rrepi(i, a, b) for (int i = int(a) - 1; i >= int(b); --i)

#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
#define rrep(...) _overload3(__VA_ARGS__, rrepi, _rrep, )(__VA_ARGS__)
#define each(xi, x) for (auto &&xi : x)
// Note: we can use rep(i,N) or rep(i,from,to)

// typedef
template <class T> using vec = vector<T>;
using ll = long long;
using vi = vec<ll>;
using vvi = vec<vi>;
using vvvi = vec<vvi>;
using pii = pair<ll, ll>;

// Constants

// Shorter repr for frequently used terms
#define pb push_back
#define mp make_pair

// Algorithms
#define all(x) (x).begin(), (x).end()
#define uniq(v) v.erase(unique(all(v)), v.end())
#define perm(c)                                                                \
  sort(all(c));                                                                \
  for (bool c##p = 1; c##p; c##p = next_permutation(all(c)))

template <class T> pair<T, size_t> max(vector<T> &x) {
  auto it = max_element(all(x));
  return mp(*it, it - x.begin());
}
template <class T> pair<T, size_t> min(vector<T> &x) {
  auto it = min_element(all(x));
  return mp(*it, it - x.begin());
}

template <class T> inline bool chmax(T &maxval, const T &newval) {
  if (maxval < newval) {
    maxval = newval;
    return 1;
  }
  return 0;
}
template <class T> inline bool chmin(T &minval, const T &newval) {
  if (minval > newval) {
    minval = newval;
    return 1;
  }
  return 0;
}

// Utilities
// Grid world utilities
int dx[4] = {0, 1, 0, -1};
int dy[4] = {1, 0, -1, 0};
#define inside(H, W, y, x) 0 <= (x) && (x) < (W) && 0 <= (y) && (y) < (H)

// Debug
#ifdef LOCAL
#include "dump.hpp"
#define debug(x) cerr << #x << ": " << x << '\n'
#else
#define dump(...)
#define debug(x)
#endif

// Paste snippets here!!

//

void solve(long long N, std::string S) {
  ll ret = 0;
  rep(i,N-2){
    if(S[i]=='A' && S[i+1]=='B' && S[i+2]=='C') ret++;
  }
  cout << ret << endl;
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false); // Magic for faster cin
  long long N;
  std::cin >> N;
  std::string S;
  std::cin >> S;
  solve(N, S);
  return 0;
}


Measured memory_bytes: 3552
#include<bits/stdc++.h>
#define ll          long long
#define pb          push_back
#define mp          make_pair
#define pii         pair<int,int>
#define vi          vector<int>
#define all(a)      (a).begin(),(a).end()
#define sz(x)       (int)x.size()
#define hell        1000000007
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define ios         ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
ll dp[100005][3];
ll a[100005],b[100005],c[100005];
int n,k;
ll func(int i,int j){
    if(i>=n){
        return 0;
    }

    if(dp[i][j]!=-1)
        return dp[i][j];

    ll ans=1e9;

    if(j==0){
        ans=max(func(i+1,1),func(i+1,2))+a[i];
    }
    else if(j==1){
        ans=max(func(i+1,2),func(i+1,0))+b[i];
    }
    else{
        ans=max(func(i+1,1),func(i+1,0))+c[i];
    }
    return dp[i][j]=ans;
}
int main(){
    cin>>n;

    memset(dp,-1,sizeof dp);
    for(int i=0;i<n;i++)
        cin>>a[i]>>b[i]>>c[i];

    cout<<max(func(0,0),max(func(0,1),func(0,2)));
}

Measured memory_bytes: 9600
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Created: Jul, 13, 2020 04:49:37 by Nobody
# $Author$
# $Date$
# $URL$
__giturl__ = "$URL$"


from sys import stdin
input = stdin.readline


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

  D = sorted(D)
  l = D[len(D)//2-1]
  r = D[len(D)//2]

  print(r-(l+1)+1)


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


Measured memory_bytes: 83928
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG //これつけるとA[N]でもいいらしい
//for文のマクロ
#define rep(i, n) for (int i = 1; i <= (int)(n); i++)
#define mp(a,b) make_pair(a,b)
#define big 1000000007
#define all(a) sort((a).begin(),(a).end()) //ソートのマクロ
#define Re(a) reverse((a).begin(),(a).end())
#define YN(a) if(a){cout<<"Yes"<<endl;}else cout<<"No"<<endl;//条件によってYes、Noを出力する
const int MOD=1000000007;
#define ld long double
const double pi = 3.141592653589793;
bool is_heiho(ld k){
    int m = int(sqrt(k));
    if (abs(m*m-k)<1e-7) {return true;}
    else {return false;}
}
int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n;
    cin>>n;
    map<int,int> f;
        rep(x,sqrt(n)){
            rep(y,sqrt(n)){
                rep(z,sqrt(n)){
                    int fn = x*x+y*y+z*z+x*y+y*z+z*x;
                    f[fn]++;
                    
                }
            }
        }
    rep(i,n){
        cout<<f[i]<<endl;
    }
}

Measured memory_bytes: 5340
/*

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

// g++ -std=c++11 a.cpp
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<unordered_map>
#include<utility>
#include<cmath>
#include<random>
#include<cstring>
#include<queue>
#include<stack>
#include<bitset>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#include<typeinfo>
#define loop(i,a,b) for(long long i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
#define FOR(i,a) for(auto i:a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
#define show1d(v) {rep(_,v.size())cout<<" "<<v[_];cout<<endl;}
#define show2d(v) {rep(__,v.size())show1d(v[__]);}
using namespace std;
//kaewasuretyuui
typedef long long ll;
#define int ll
typedef int Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip>vip;
#define mt make_tuple
typedef tuple<int,int,int,int> tp;
typedef vector<tp> vt;
template<typename A,typename B>bool cmin(A &a,const B &b){return a>b?(a=b,true):false;}
template<typename A,typename B>bool cmax(A &a,const B &b){return a<b?(a=b,true):false;}
const double PI=acos(-1);
const double EPS=1e-9;
Def inf = sizeof(Def) == sizeof(long long) ? 2e18 : 1e9+10;
#define yes cout<<"Yes\n"
#define no cout<<"No\n"

template< typename T >
istream &operator>>(istream &is, vector< T > &v) {
  for(T &in : v) is >> in;
  return is;
}

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

    int a;cin>>a;cout<<a*a<<endl;
}


Measured memory_bytes: 256
//#pragma GCC target("avx2")
//#pragma GCC optimize("O3")
 
//#include <x86intrin.h>
#include <algorithm>
#include <iostream>
#include <cstring>
#include <string>
#include <bitset> 
#include <vector>
#include <cmath>
#include <deque>     
#include <queue>
#include <iomanip>
#include <stack>
#include <map>
#include <set>
//#include <ordered_set>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
 
//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>;
     
#define F first
#define S second           
#define lb lower_bound               
#define ub upper_bound
#define pb push_back
#define pf push_front    
#define ppb pop_back
#define mp make_pair                                     
#define bpp __builtin_popcountll                                                                                        
#define sqr(x) ((x) * (x)) 
#define sz(x) (int)x.size()
#define all(x) x.begin(), x.end()
#define in insert
#define ppf pop_front
#define endl '\n'
//#define int long long
 
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
typedef pair <int, int> pii;
 
const int mod = (int)1e9 + 7;
const int N = (int)3e5 + 123;
const ll inf = (ll)1e18 + 1;
 
const double pi = acos (-1.0);
const double eps = 1e-9;                  
const int dx[] = {0, 0, 1, 0, -1};
const int dy[] = {0, 1, 0, -1, 0};

string s, t;
int ans;

inline void boost () {
   ios_base :: sync_with_stdio (0);
   cin.tie (0), cout.tie (0);
}
 
inline void Solve () {
   cin >> s >> t;
   for (int i = 0; i <  sz (s); i ++)
      if (s[i] != t[i])
         ans ++;
   cout << ans;
}               
 
signed main () {                                       
   #ifdef QWERTY
      freopen("input", "r", stdin);
   #endif
// freopen (".in", "r", stdin);    
// freopen (".out", "w", stdout);              
   boost ();
   int tt = 1;
   //cin >> tt;   
   while (tt --) {
      Solve ();
   }                                               
   return 0;      
}                   

Measured memory_bytes: 3780
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define inf 1001001001001001001
#define mod 1000000007
#define mod2 998244353
#define pi acos(-1)
#define all(v) v.begin(),v.end()

int main(){
    int N;cin>>N;
    vector<int>a(N);
    ll ans=0;
    int max=0;
    rep(i,N){
        cin>>a.at(i);
    }
    for(int i=0;i<N;i++){
        if(i==0){
            max=a.at(i);
            continue;
        }else{
            if(max<a.at(i)){
                max=a.at(i);
                continue;
            }else{
                ans+=max-a.at(i);
            }
        }
    }
    cout<<ans<<endl;
}


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


int main() {
    string s, t; cin >> s >> t;
    int count = 0;
    rep(i, 3){
        if(s[i] == t[i]) count++;
    }
    cout << count << endl;
    return 0;
}


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

main() {
  int N, K, x;
  x=1;
  cin >> N >> K;
  for(int i=0; i<N; i++){
    if(x*2 >= x+K){
      x += K;
    }
    else{
      x *= 2;
    }
  }
  cout << x << endl;
}


Measured memory_bytes: 256
package main

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

func getScanner(fp *os.File) *bufio.Scanner {
	scanner := bufio.NewScanner(fp)
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, 500001), 500000)
	return scanner
}

func getNextString(scanner *bufio.Scanner) string {
	scanner.Scan()
	return scanner.Text()
}

func getNextInt(scanner *bufio.Scanner) int {
	i, _ := strconv.Atoi(getNextString(scanner))
	return i
}

func getNextInt64(scanner *bufio.Scanner) int64 {
	i, _ := strconv.ParseInt(getNextString(scanner), 10, 64)
	return i
}

func getNextUint64(scanner *bufio.Scanner) uint64 {
	i, _ := strconv.ParseUint(getNextString(scanner), 10, 64)
	return i
}

func getNextFloat64(scanner *bufio.Scanner) float64 {
	i, _ := strconv.ParseFloat(getNextString(scanner), 64)
	return i
}

func main() {
	fp := os.Stdin
	wfp := os.Stdout

	if len(os.Args) > 1 {
		fp, _ = os.Open(os.Args[1])
		if len(os.Args) > 2 {
			wfp, _ = os.Create(os.Args[2])
		}
	}

	scanner := getScanner(fp)
	writer := bufio.NewWriter(wfp)

	v := getNextInt(scanner)
	e := getNextInt(scanner)
	edges := make(Edges, e)

	for i := 0; i < e; i++ {
		edges[i].s = getNextInt(scanner)
		edges[i].t = getNextInt(scanner)
		edges[i].w = getNextInt(scanner)
	}
	sort.Sort(edges)
	uf := make([]int, v)
	for i := 0; i < v; i++ {
		uf[i] = i
	}

	ans := 0
	for i := 0; i < e; i++ {
		rs := root(edges[i].s, uf)
		rt := root(edges[i].t, uf)
		if rs == rt {
			continue
		}
		uf[rs] = rt
		ans += edges[i].w
	}

	fmt.Fprintln(writer, ans)
	writer.Flush()
}

func root(i int, uf []int) int {
	if i == uf[i] {
		return i
	}
	uf[i] = root(uf[i], uf)
	return uf[i]
}

type Edge struct {
	s, t, w int
}

type Edges []Edge

func (a Edges) Len() int           { return len(a) }
func (a Edges) Swap(i, j int)      { a[i], a[j] = a[j], a[i] }
func (a Edges) Less(i, j int) bool { return a[i].w < a[j].w }



Measured memory_bytes: 5484
// Lec09-A Finding a Word
#include<iostream>
#include<string>
#include<algorithm>
int main(){
  static const std::string end = "END_OF_TEXT";
  std::string str1, str2;
  std::cin >> str1;
  int cnt=0, str1_len=str1.length();
  std::transform(str1.begin(), str1.end(), str1.begin(), tolower);
  while(std::cin >> str2){
    if(end == str2) break;
    if(str1_len != str2.length()) continue;
    std::transform(str2.begin(), str2.end(), str2.begin(), tolower);
    if(!str1.compare(0,str1_len,str2,0,str1_len)) cnt++;
  }
  std::cout << cnt << std::endl;
  return 0;
}

Measured memory_bytes: 3204
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#define For(i, a, b) for (i = a; i <= b; i++)

const int N = 44, C = 133333, ZZQ = 1e9 + 7;

int n, x, y, z, f[N][C], Cm, ans = 1;

int main()
{
	//freopen("poem.in", "r", stdin);
	//freopen("poem.out", "w", stdout);
	
	int i, j, S;
	std::cin >> n >> x >> y >> z;
	Cm = (1 << x + y + z) - 1;
	f[0][0] = 1;
	For (i, 1, n) ans = 10ll * ans % ZZQ;
	For (i, 0, n - 1) For (S, 0, Cm)
	{
		if (!f[i][S]) continue;
		For (j, 1, 10)
		{
			int T = ((S << j) | (1 << j - 1)) & Cm;
			if (((T >> z - 1) & 1) && ((T >> y + z - 1) & 1)
				&& ((T >> x + y + z - 1) & 1)) continue;
			f[i + 1][T] = (f[i + 1][T] + f[i][S]) % ZZQ;
		}
	}
	For (S, 0, Cm) ans = (ans - f[n][S] + ZZQ) % ZZQ;
	std::cout << ans << std::endl;
	return 0;
}


Measured memory_bytes: 20992
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i, a, b) for(ll i=(a); i<(b); i++)
#define PER(i, a, b) for(ll i=(a); i>=(b); i--)
#define rep(i, n) REP(i, 0, n)
#define per(i, n) PER(i, n, 0)
#define ALL(a)  (a).begin(),(a).end()
const ll INF = 1e18+18;
const ll MAX = 200000;
const ll MOD = 1000000007;
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl;
#define YES(n) cout << ((n) ? "YES" : "NO") << endl;



int main(){
  ll N;
  cin>>N;
  vector<long double> P(N);
  rep(i, N){
    cin>>P[i];
  }
  vector<long double> DP(N+1, 0);
  DP[0]=1;
  rep(i, N){
    per(j, N){
      long double Rev=1-P[i];
      DP[j]=DP[j]*Rev;
      if(j>0)DP[j]+=DP[j-1]*P[i];
    }
  }
  long double Ans=0;
  for(ll i=N/2+1; i<=N; i++){
    Ans+=DP[i];
  }
  cout<<setprecision(10)<<Ans<<endl;
  return 0;
} 

Measured memory_bytes: 3884
#pragma GCC optimize("Ofast")
#include <iostream>
#include<vector>
#include<set>
#include<iterator>
#include<string>
#include<map>
#include<stack>
#include<cmath>
#include<algorithm>
#include <cstdio>
#include<cstdlib>
#include <unordered_map>
#define   lli long long int
#define ld long double
#define  endl "\n"
#define pb push_back
#define vsort(v) sort((v).begin(), (v).end())
#define vsortr(v) sort((v).rbegin(), (v).rend())
ld EPSILON=0.000000001;
const lli mod=1000000007;
lli max(lli a,lli b){if(a>b)return a;else return b;}
using namespace std;
int main()
{
    lli a,b,c,k;cin>>a>>b>>c>>k;
    lli ans;
    ans=min((lli)a,(lli)k);
    k-=ans;
    lli temp=0;
    temp=min(k,b);
    k-=temp;
    temp=min(k,c);
    ans-=temp;
    cout<<ans;
    
  
 return 0;
}

Measured memory_bytes: 3624
class Node:
    def __init__(self, key):
        self.key = key
        self.parent = None
        self.left = None
        self.right = None


def insert(T, z):
    y = None
    x = T
    while x is not None:
        y = x
        if z.key < x.key:
            x = x.left
        else:
            x = x.right
    z.parent = y

    if y is None:
        T = z
    elif z.key < y.key:
        y.left = z
    else:
        y.right = z

    return T


def preorder(T, ret):
    ret.append(T.key)

    if T.left is not None:
        preorder(T.left, ret)

    if T.right is not None:
        preorder(T.right, ret)


def inorder(T, ret):
    if T.left is not None:
        inorder(T.left, ret)

    ret.append(T.key)

    if T.right is not None:
        inorder(T.right, ret)


def find(T, key):
    if key == T.key:
        return T

    elif key < T.key:
        if T.left is not None:
            ret = find(T.left, key)
            if ret is not None:
                return ret
    else:
        if T.right is not None:
            ret = find(T.right, key)
            if ret is not None:
                return ret

    return None


def main():
    m = int(input())
    Tree = None
    for i in range(m):
        cmd, *v = input().split()
        if cmd == "print":
            print(" ", end="")
            inans = []
            inorder(Tree, inans)
            print(*inans)
            print(" ", end="")
            preans = []
            preorder(Tree, preans)
            print(*preans)
        elif cmd == "insert":
            z = int(v[0])
            znode = Node(z)
            Tree = insert(Tree, znode)
        else:
            z = int(v[0])
            node = find(Tree, z)
            if find(Tree, z) is None:
                print("no")
            else:
                print("yes")


if __name__ == '__main__':
    main()



Measured memory_bytes: 94612
#include<bits/stdc++.h>
using namespace std;
int main()
{
	set<int> s;
	set<int> :: iterator it;
	
	int n,x;
	scanf("%d",&n);
	for(int i=0;i<n;i++)
	{
		scanf("%d",&x);
		if(s.empty())
		{
			s.insert(x);
		}else
		{
			if(s.find(x)==s.end())
			{
				s.insert(x);
			}else
			{
				it=s.find(x);
				s.erase(it);
			}
		}
	}
	printf("%d",s.size());
}

Measured memory_bytes: 4864
use im_rc::{HashMap, HashSet};
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}
fn main() {
    input!(
    n: usize,
    s: [String; n],
    );
    let c = s.into_iter().collect::<HashSet<String>>();
    let ans = c.iter().count();
    println!("{}", ans);
}


Measured memory_bytes: 65196
#define rep(i,n) for(ll i=0, i##_len=(n); i<i##_len; ++i)
#define rrep(i,n) for(ll i##_len=(n) ,i=i##_len-1;i>=0;--i)
#define repi(i,a,b) for(ll i=ll(a);i<ll(b);++i)
#define printd(val) std::cout<< #val" = " <<val<<"\n";
#define lim 1000000007ll
#include<bits/stdc++.h>
using ll = long long;
using pii = std::pair<ll,ll>;
using namespace std;
template<class T>T chmin(T& a,T b){if(a>b){a^=b;b^=a;a^=b;return 1;}return 0;}
template<class T>T chmax(T& b,T a){if(a>b){a^=b;b^=a;a^=b;return 1;}return 0;}
template <class T> T gcd(T a, T b){if (a < b) {a ^= b;b ^= a;a ^= b;} return b ? gcd(b, a % b) : a;}
template <class T> T lcm(T a, T b){return a * b / gcd(a, b);}

template<class T> vector<pair<T,T>> duplicator(const vector<T>& input){
    vector<pair<T,T>> out(input.size()-1);
    rep(i,input.size()-1){
        out[i].first =input[i  ];
        out[i].second=input[i+1];
    }
    return(out);
}
vector<char> String_to_vector_char(const string& input){
    vector<char> out(input.size());
    rep(i,input.size()){
        out[i]=input[i];
    }
    return out;
}
inline bool operator<(const pii &lhs,const pii &rhs){
    return(lhs.first<rhs.first);
}

int r,d,x0;
vector<int> x;
void input(){
    cin>>r>>d>>x0;
}
void src(){
    rep(i,10){
        x0=r*x0-d;
        cout<<x0<<"\n";
    }
}

int main(int argc,char* argv[]){
    ios::sync_with_stdio(false);
    //ifstream in( argv[1] ); cin.rdbuf(in.rdbuf());
    input();
    src();    
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int d = sc.nextInt();
    int x = sc.nextInt();

    int[] a = new int[n];

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

    int res = 0;

    for (int i : a) {
      int y = 1;
      while(y <= d) {
        y += i;
        ++res;
      }
    }

    System.out.println(res + x);
  }
}

Measured memory_bytes: 21716
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin >> n;
  long count = 0;
long max = -9999999999;
long min = 9999999999;
for(int i= 0; i<n;i++){
int a;
cin >> a;
if(max<a)max = a;
if(min>a)min = a;
count += a;
}
cout << min << ' '<< max << ' ' << count << endl; 
}


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

using namespace std;

typedef long long ll;

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

	int a, b;
	cin >> a >> b;
	if(a < b){
		rep(i, b){
			cout << a;
		}
		cout << endl;
	}else{
		rep(i, a){
			cout << b;
		}
		cout << endl;
	}
}


Measured memory_bytes: 256
import sys

sys.setrecursionlimit(10 ** 9)


def rec(arr, l, lst):
    # lstは操作の逆順
    # print(arr, l, lst[::-1])
    if l == 0:
        for p in lst[::-1]:
            print(p)
        exit()
        return

    for i in sorted(range(1, l + 1), reverse=True):
        # 1-indexed
        if arr[i-1] == i:
            # print(aa, '除去')
            # 最後に入れた数は、何番目と数の大きさが一致する
            rec(arr[:i - 1] + arr[i:], l - 1, lst + [i])
        elif arr[i-1] > i:
            # 何番目よりも数が大きい
            return
    return


N = int(input())
b = list(map(int, input().split()))

rec(b, N, [])

print(-1)


Measured memory_bytes: 40688
import java.util.Scanner;

public class Main {
    static Scanner sc = new Scanner(System.in);


    public static void main(String[] args) {
        char[] c = sc.next().toCharArray();
        String ACGT = "ACGT";
        int ans = Integer.MIN_VALUE;
        int count = 0;
        for (int i = 0; i < c.length; i++) {
            if (ACGT.indexOf(c[i]) >= 0) {
                count++;
            } else {
                ans = Math.max(ans, count);
                count = 0;
            }
        }
        ans = Math.max(ans, count);
        System.out.println(ans);
    }
}


Measured memory_bytes: 24148
class Node
  attr_accessor :id, :parent, :left, :right, :depth

  def initialize(id)
    @id = id
    @parent = -1
    @left = nil
    @right = nil
  end

  def add_left(left);
    @left = left
    @left.parent = self
  end

  def add_right(right);
    @right = right
    @right.parent = self
  end

  def to_s
    "#{@id}"
  end

  # ----
  def sibling
    return -1 if @parent == -1
    if @parent.left == self
      return @parent.right ? @parent.right : -1
    elsif @parent.right == self
      return @parent.left ? @parent.left : -1
    end
  end

  def degree
    if @right and @left
      degree = 2
    elsif @right or @left
      degree = 1
    else
      degree = 0
    end
    degree
  end

  def type
    if @parent == -1
      type = 'root'
    elsif @left or @right
      type = 'internal node'
    else
      type = 'leaf'
    end
    type
  end

  def set_depth(n)
    @depth = n
    @left.set_depth(@depth + 1) if @left
    @right.set_depth(@depth + 1) if @right
  end

  def height
    lh = @left  ? @left.height  : -1
    rh = @right ? @right.height : -1
    ret = lh > rh ? lh + 1 : rh + 1
  end

end

n = gets.to_i
tree = Array.new(n){ | i | Node.new(i) }
n.times do
  id, l, r = gets.split.map(&:to_i)
  tree[id].add_left(tree[l])  if l != -1
  tree[id].add_right(tree[r]) if r != -1
end

root = nil
tree.each{ |n| root = n if n.parent == -1 }
root.set_depth(0)

tree.each do | n |
  print "node #{n.id}: "
  print "parent = #{n.parent}, "
  print "sibling = #{n.sibling}, "
  print "degree = #{n.degree}, "
  print "depth = #{n.depth}, "
  print "height = #{n.height}, "
  print "#{n.type}"
  puts ''
end


Measured memory_bytes: 6880
#include <bits/stdc++.h>
using namespace std;
#define forloop(n) for(int i = 0; i < n; i++)
#define ll long long
 
#define mod 1000000007
 
ll ebob(ll a, ll b){
	if(a == 0) return b;
	return ebob(b%a, a);
}
int main(){
	ios_base::sync_with_stdio(false); cin.tie(NULL);
	ll a, b; cin>>a>>b;
	cout<<a*b/ebob(a,b);
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define mod 1000000007
#define fi first
#define sc second
#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
int n;
vector<int>vec;
vector<int>edge[10005];
int ans[10005];
ll ret;
int deg[10005];
set<P>S;
int main(){
	cin>>n;
	rep(i,n-1){
	int a,b;cin>>a>>b; edge[a].pb(b); edge[b].pb(a);
	}
	repn(i,n) {
		int r; cin>>r; vec.pb(r);
	}
	SORT(vec);
	repn(i,n){
		deg[i] = edge[i].size();
		S.insert(mp(deg[i],i));
	}
	rep(i,n){
		auto it = *S.begin();
		S.erase(S.begin());
		ret += 1LL * deg[it.sc] * vec[i];
		ans[it.sc] = vec[i];
		for(int j=0;j<edge[it.sc].size();j++){
			int to = edge[it.sc][j];
			if(ans[to]) continue;
			S.erase(S.find(P(deg[to],to)));
			deg[to]--;
			S.insert(mp(deg[to],to));
		}
	}
	cout << ret << endl;
	repn(i,n) printf("%d\n",ans[i]);}

Measured memory_bytes: 1536
#include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <tuple>
#include <vector>
using namespace std;
typedef long long ll;
ll const INF = 1LL << 60;

int main() {
  string s;
  cin >> s;
  for (int i = 0; i < s.size(); i++) {
    if (s[i] == '9') {
      cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 3624
from collections import*
class u():
  def __init__(self,n):self.n,self.r=[-1]*n,[0]*n
  def f(self,x):
    if self.n[x]<0:return x
    else:self.n[x]=self.f(self.n[x]);return self.n[x]
  def u(self,x,y):
    x,y=self.f(x),self.f(y)
    if x==y:return
    elif self.r[x]>self.r[y]:self.n[x]+=self.n[y];self.n[y]=x
    else:self.n[y]+=self.n[x];self.n[x]=y;self.r[y]+=self.r[x]==self.r[y]
n,k,l=map(int,input().split());d=u(n);t=u(n)
for _ in range(k):a,b=map(int,input().split());d.u(a-1,b-1)
for _ in range(l):a,b=map(int,input().split());t.u(a-1,b-1)
p=[(d.f(i),t.f(i))for i in range(n)];c=Counter(p);print(*[c[p[i]]for i in range(n)])

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

int main() {
  string str;
  cin >> str;
  int n=0;
  for (int i=0; i<str.size(); i+=2) {
    if(str.at(i)=='L') {
      n++;
    }
  }
  for(int i=1; i<str.size(); i+=2){
   if(str.at(i)=='R'){
     n++;
  }
  }
  
 if(n>=1){
   cout<<"No"<<endl;
 }
  else{
    cout<<"Yes"<<endl;
  }
  return 0;
}

Measured memory_bytes: 256
from sys import stdin


def fetch_one_line():
    return stdin.readline().rstrip()


def fetch_int_input():
    return [int(s) for s in fetch_one_line().split()]


def fetch_inputs(times):
    return [fetch_one_line() for _ in range(times)]


def fetch_int_inputs(times):
    return [[int(s) for s in fetch_one_line()] for _ in range(times)]

num = int(fetch_one_line())

print(int(num / 3))



Measured memory_bytes: 38384
#include<stdio.h>
int main() {
	int a, b;
	scanf("%d %d", &a, &b);
	if (a< b) {
		printf("a < b\n");
	}
	if (a> b) {
		printf("a > b\n");
	}
	if (a == b) {
		printf("a == b\n");
	}
	return 0;
}


Measured memory_bytes: 2596
import Control.Applicative
import Control.Monad
import Data.List

solve :: [[Int]] -> [String]
solve ([n,m,l]:matxs) =
    let (matA,matB) = splitAt n $ matxs in
    let mAB = [[sum $ zipWith (*) a b | b<-transpose matB] | a<-matA] in
    map (unwords . map show) mAB

main =
    mapM_ putStrLn =<< solve . takeInputs . lines <$> getContents
    where
    takeInputs :: [String] -> [[Int]]
    takeInputs = map (map read . words) 


Measured memory_bytes: 12308
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;

bool is_same_shape(vector<int> x_1, vector<int> y_1, vector<int> x_2, vector<int> y_2) {
    if (x_1.size() != x_2.size()) return false;
    for (int cnt = 0; cnt < 4; cnt++) {
        bool is_ok = true;
        for (int i = 0; i < x_1.size() - 1; i++) {
            if (x_1[i] - x_1[i + 1] != x_2[i] - x_2[i + 1]) {
                is_ok = false;
                break;
            }
            if (y_1[i] - y_1[i + 1] != y_2[i] - y_2[i + 1]) {
                is_ok = false;
                break;
            }
        }
        if (is_ok) return true;
        // rotate
        for (int i = 0; i < x_2.size(); i++) {
            int x = x_2[i], y = y_2[i];
            x_2[i] = -y;
            y_2[i] = x;
        }
    }
    return false;
}

void solve(int n) {
    int m;
    cin >> m;
    vector<int> origin_x(m), origin_y(m);
    for (int i = 0; i < m; i++) cin >> origin_x[i] >> origin_y[i];
    vector<int> ans;
    for (int i = 0; i < n; i++) {
        cin >> m;
        vector<int> now_x(m), now_y(m);
        for (int j = 0; j < m; j++) cin >> now_x[j] >> now_y[j];
        if (is_same_shape(origin_x, origin_y, now_x, now_y)) {
            ans.push_back(i + 1);
            continue;
        }
        reverse(now_x.begin(), now_x.end());
        reverse(now_y.begin(), now_y.end());
        if (is_same_shape(origin_x, origin_y, now_x, now_y)) {
            ans.push_back(i + 1);
        }
    }
    for (int i = 0; i < ans.size(); i++) cout << ans[i] << endl;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    while (true) {
        cin >> N;
        if (N == 0) break;
        solve(N);
        cout << "+++++" << endl;
    }
    return 0;
}


Measured memory_bytes: 3184
#include "bits/stdc++.h"
#define in std::cin
#define out std::cout
#define rep(i,N) for(int i=0;i<N;++i)
typedef long long int LL;

std::string a, b;

int main()
{
	in >> a >> b;
	a += b;
	LL num = std::atoll(a.c_str());
	LL res = sqrt(num);
	out << (res*res == num ? "Yes" : "No") << std::endl;
	return 0;
}

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

int main()
{
	int64_t n;
	cin >> n;
	vector<int64_t> ls(n);
	for (auto &&l : ls)
	{
		cin >> l;
	}

	sort(ls.begin(), ls.end());

	int ans = 0;

	for (int i = 0; i < n; i++)
	{
		for (int j = i + 1; j < n; j++)
		{
			for (int k = j + 1; k < n; k++)
			{
				if (ls[i] != ls[j] && ls[j] != ls[k] && ls[k] < ls[i] + ls[j])
				{
					ans++;
				}
			}
		}
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 3632
#include<iostream>
#include <bits/stdc++.h>
#include<stdio.h>
#include <stdlib.h>
#include<string>
#include<queue>
#include<algorithm>
#include<math.h>

using namespace std;

int main(){
	int H,W,N,a[10001],nuri=1,aaa=0;
	string ans;
	cin>>H>>W>>N;
	priority_queue<int,vector<int>,greater<int>> queue1;
	for(int i=0;i<N;i++){
		cin>>a[i];
	}
	for(int i=0;i<N;i++){
		for(int j=0;j<a[i];j++){
			queue1.push(nuri);
		}
		nuri++;
	}
	for(int i=0;i<H;i++){
		for(int j=0;j<W;j++){
			if(i%2==0){
				if(j!=W-1){
					cout<<queue1.top()<<" ";
					queue1.pop();
				}else{
					cout<<queue1.top()<<endl;
					queue1.pop();
				}
			}else{
				if(j!=W-1){
					ans.insert(0,to_string(queue1.top()));
					ans.insert(0," ");
					queue1.pop();
					
				}else{
					ans.insert(0,to_string(queue1.top()));
					cout<<ans<<endl;
					ans="";
					queue1.pop();
				}
			}
		}
	}
}

Measured memory_bytes: 384
#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 ll;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int n;
    while(cin>>n)
    {
        bool chk=0;
        for(int i=0;i<n;i++)
        {
            ll x;
            cin>>x;
            if(x%2==0 )
            {
                if(x%3==0 || x%5==0)
                {

                }
                else chk=1;
            }
        }
        if(chk) cout<<"DENIED"<<endl;
        else cout<<"APPROVED"<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<string>
#include<algorithm>
#include<vector>
#include<utility>
#include<tuple>
#include<map>
#include<queue>
#include<stack>
#include<deque>
#include<bitset>
#include<math.h>
using namespace std;
using ll = int64_t;
using Graph = vector<vector<int> >;
const ll M = 1000000007;

int main(){
    int h,w,k;
    cin >> h >> w >> k;
    char c[h][w];
    int blacky[h];
    for(int i=0;i<h;i++) blacky[i]=0;
    int blackt[w];
    for(int i=0;i<w;i++) blackt[i]=0;

    for(int i=0;i<h;i++){
        for(int j=0;j<w;j++){
            cin >> c[i][j];
            if(c[i][j]=='#') blacky[i]++;
        }
    }

    //for(int i=0;i<h;i++) cout << blacky[i] << ' ';
    //cout << endl;

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

    //for(int i=0;i<w;i++) cout << blackt[i] << ' ';
    //cout << endl;

    int sum=0;
    for(int i=0;i<h;i++) sum+=blacky[i];
    //cout << sum << endl;

    int cnt=0;
    for(int i=0;i<(1<<h);i++){
        int tmp=0;
        bitset<6> s(i);
        for(int p=0;p<h;p++){
            if(s.test(p)){
                tmp+=blacky[p];
            }
        }
        //cout << tmp << endl;

        for(int j=0;j<(1<<w);j++){
            bitset<6> t(j);
            int com=tmp;
            //cout << s << ' ' << t << endl;
            for(int q=0;q<w;q++){
                if(t.test(q)){
                    com+=blackt[q];

                    for(int k=0;k<h;k++){
                        if(s.test(k)){
                            if(c[k][q]=='#') com--;
                        }
                    }
                }
            }
            //cout << com << endl;
            if(sum-com==k) cnt++;
        }
        //cout << tmp << endl;
        //cout << endl;
    }
    
    cout << cnt << endl;
}

Measured memory_bytes: 3588
#include <stdio.h>
#include <algorithm>
#include <stdlib.h>
#include <string.h>
#include <iostream>
#include <queue>
#include <stack>
#include <vector>
#include <functional>
#include <math.h>
#include <map>
#include <set>
#include <string>
using namespace std;
#define fio ios::sync_with_stdio(false); cin.tie(NULL);

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;

const int INT_INF = 1e9;
const ll LL_INF = 1e18;
const int MAXN = 32000;

const ll mod = 1e9 + 7;

typedef struct node{
	ll x,y;
}node;

ll dp[105][2*MAXN];
ll sum[105][2*MAXN];

void add(ll &x, ll y){
	x+=y;
	if(x>=mod)x-=mod;
}

vector<node> num;
int main() {
	int m,n;
	scanf("%d %d", &m,&n);

	ll x = 1;
	num.push_back({0ll, 0ll});
	while(x<=m) {
		ll t = m/x;
		ll y = m/t;
		num.push_back({x,y}); 
		x = y+1;
	}

	int k=num.size()-1;
	for(int i=1;i<=k;i++){
		dp[1][i] = num[i].y-num[i].x+1; 
		dp[1][i] += dp[1][i-1];
	}

	for(int i=2;i<=n;i++) {
		for(int j=1;j<=k;j++) {
			dp[i][j] = 1ll*dp[i-1][k-j+1]*(num[j].y-num[j].x+1)%mod; 
			add(dp[i][j], dp[i][j-1]);
		}
	}
	
	ll ans = dp[n][k];
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 54644