akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>

#define pb push_back
#define F first
#define S second
#define int long long
#define lint long long
#define mp make_pair
#define pii pair<int, int>
#define vi vector<int>
#define sz(x) (int)x.size()
#define all(x) begin(x), end(x)
#define SET(x, val) memset(x, val, sizeof(x))
#define fastio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
using namespace std;
using namespace __gnu_pbds;
template<typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

const int N = 303, MOD1 = 1e9 + 7, MOD2 = 998244353;
const lint INF = 1e18;

int n, mov, m, dp[N][N][N], a[N], suff[N], pref[N], pdsum[N][N][N], psum[N][N][N];
string s;
signed main()
{
    cin >> s;
    cin >> mov;
    s = "0" + s;
    n = s.length();
    mov = min(mov, n);
    int cnt = 0;
    for(int i = 0; i < n; i++)
    {
        if(s[i]=='0'){
            cnt++;
        }
        else{
            m++;
            a[cnt]++;
        }
    }
    for(int i = 1; i <= cnt; i++)
    {
        pref[i] = pref[i-1] + a[i];
    }
    for(int i = cnt; i >= 0; i--)
    {
        suff[i] = suff[i+1] + a[i];
    }
    //cout << cnt << " " << m << " " << mov << endl;
    dp[0][0][0] = 1;
    for(int it = 0; it <= min(m, mov); it++)
    {
        pdsum[0][it][it] = 1;
    }
    for(int it = 0; it <= m; it++)
    {
        psum[0][it][0] = 1;
    }
    for(int i = 1; i <= cnt; i++){
        for(int j = pref[i]; j <= m; j++){
            for(int k = 0; k <= mov; k++){
                dp[i][j][k] = pdsum[i-1][j-a[i]][k];
                int it = min(j-a[i]+k, j);
                dp[i][j][k] = (dp[i][j][k] + psum[i-1][it][k] - psum[i-1][j-a[i]][k] + MOD2)%MOD2;
                /*for(int jj = j - a[i] + 1; jj <= min(j - a[i] + k, j); jj++)
                {
                    dp[i][j][k] = (dp[i][j][k] + dp[i-1][jj][k])%MOD2;
                }*/
                /*int it = suff[i+1]+1;
                if(it <= j && it <= k){
                    dp[i][j][k] = (dp[i][j][k] - pdsum[i-1][j-it][k-it] + MOD2)%MOD2;
                }*/
                psum[i][j][k] = pdsum[i][j][k] = dp[i][j][k];
                if(j>0 && k>0){
                    pdsum[i][j][k] = (pdsum[i][j][k] + pdsum[i][j-1][k-1])%MOD2;
                }
                if(j>0)
                {
                    psum[i][j][k] = (psum[i][j][k] + psum[i][j-1][k])%MOD2;
                }
                //cout << i << " " << j << " " << k << " - " << dp[i][j][k] << endl;
            }
        }
    }
    int ans = 0;
    for(int i = 0; i <= mov; i++)
    {
        ans = (ans + dp[cnt][m][i])%MOD2;
    }
    cout << ans;
}

Measured memory_bytes: 162620
#include<bits/stdc++.h>
using namespace std;
int in(){
	int x;
	cin>>x;
	return x;
}
int main(){
    int n,q;
    cin>>n>>q;
    string s;
    cin>>s;
    vector<int> a(n-1);
    for(int i=0;i<n-1;i++){
        if(s[i]=='A'&&s[i+1]=='C')a[i]= 1;
    }
    vector<int> sum(n);
    for(int i=0;i<n-1;i++)sum[i+1]=sum[i]+a[i];
    while(q--){
        int l=in()-1,r=in()-1;
        int ans=sum[r]-sum[l];
        cout<<ans<<endl;
    }
    return 0;
}

Measured memory_bytes: 1792
#include <iostream>
#include <algorithm>
using namespace std;
#define N_MAX 8
#define rep(i,n) for(int i=0;i<n;i++)

char p[N_MAX][N_MAX];

void rotate(){
	rep(i,N_MAX)rep(j,i)swap(p[i][j],p[j][i]);
	rep(i,N_MAX)reverse(p[i],p[i]+N_MAX);
	rep(i,N_MAX){
		rep(j,N_MAX)cout <<p[i][j];
		cout << endl;
	}
}

int main(){
	rep(i,N_MAX)rep(j,N_MAX)cin >> p[i][j];
	cout << 90 << endl;
	rotate();
	cout << 180 << endl;
	rotate();
	cout << 270 << endl;
	rotate();
}

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

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll n,x,mi=10000000000;
	cin>>n>>x;
	vector<ll>v(n);
	for(ll i=0;i<n;i++) {
		cin>>v.at(i);
		v.at(i)=abs(v.at(i)-x);
	}
	for(ll i=0;i<n-1;i++){
		mi=min(__gcd(v.at(i),v.at(i+1)),mi);
	}
	if(n==1){
		cout<<v.at(0)<<endl;
	}else{
		cout<<mi<<endl;
	}
}


Measured memory_bytes: 1024
use std::io;
use std::cmp::min;

fn main() {
  let mut input = String::new();
  if let Ok(_) = io::stdin().read_line(&mut input) {
    let v: Vec<i64> = input.trim().split(' ').map(|x| x.parse().unwrap()).collect();
    let count = v[0];
    let unit = v[1] + v[2];
    let blue = v[1];
    let div = count / unit;
    let res = count % unit;
    println!("{}", div * blue + min(res, blue));
  }
}

Measured memory_bytes: 4352
from itertools import product

n, m, x = list(map(int, input().split()))
aa = []
cc = []
for k in range(n):
    a = list(map(int, input().split()))
    c = a[0]
    a = a[1:]
    aa.append(a)
    cc.append(c)

cost_min = 1e18
for idx in product([0,1], repeat = n):
    cost = 0
    t = [x] * m
    for j in range(n):
        if idx[j] == 1:
            for k in range(m):
                t[k] -= aa[j][k]
            cost += cc[j]
    if max(t) <= 0:
        if cost < cost_min:
            cost_min = cost
if cost_min == 1e18:
    print(-1)
else:
    print(cost_min)

Measured memory_bytes: 9240
# include<bits/stdc++.h>
using namespace std;
vector <int> s;
int main (){
int a,b,c;
cin>>a>>b>>c;
s.push_back(a);
s.push_back(b);
s.push_back(c);
sort(s.begin(),s.end());
if((s[2]==s[1] && s[0]%2==0) || (s[2]==s[1]+s[0])){
    cout<<"Yes";
}
else {
    cout<<"No";
}
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, a) for(int i = 0; i < a; i++)
#define all(v) v.begin(), v.end()
#define dcout cout << fixed << setprecision(15)
#define arep(i, a) for(auto i : a)
#define F first
#define S second
#define VE vector<int>
#define pb(x) push_back(x)
#define MOD 1000000007
#define INF 10000000000
#define int long long
#define KETA(n) floor(log10(n) + 1)
using namespace std;
signed main() {
    char a, b;
    cin >> a >> b;
    if(a == b)
        cout << "=";
    else if(a < b)
        cout << "<";
    else
        cout << ">";
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
  int H,W;
  cin>>H>>W;
  string data[H];
  //値の読み込み
  for(int i=0;i<H;i++){
    cin>>data[i];
  }

  int dx[8] = { -1, -1, -1, 0, 0, 1, 1, 1 };
  int dy[8] = { -1, 0, 1, -1, 1, -1, 0, 1 };
  for (int i = 0; i < H;i++){
    for (int j = 0; j < W;j++){
      int cnt = 0;
      if (data[i][j] == '#')
        continue;
      for (int k = 0; k < 8;k++){
        int h = i + dx[k];
        int w = j + dy[k];
        if(h<0 || h>=H)
          continue;
        if(w<0 || w>=W)
          continue;
        if(data[h][w]=='#')
          cnt++;
      }
      data[i][j] = char('0' + cnt);
    }
  }
  for(int i=0;i<H;i++){
    cout << data[i] << endl;
  }
}

Measured memory_bytes: 256
use std::io;
use std::str::FromStr;

fn main() {
    let stdin = io::stdin();
    let mut buf = String::new();
    stdin.read_line(&mut buf).ok();
    let mut it = buf.split_whitespace().map(|n| usize::from_str(n).unwrap());
    let (n, m) = (it.next().unwrap(), it.next().unwrap());
    let mut v = vec![0; n + 1];
    for _ in 0..m {
        let mut buf = String::new();
        stdin.read_line(&mut buf).ok();
        let mut it = buf.split_whitespace().map(|n| usize::from_str(n).unwrap());
        let (a, b) = (it.next().unwrap(), it.next().unwrap());
        v[a] += 1;
        v[b] += 1;
    }
    for i in 1..(n+1) {
        println!("{}", v[i]);
    }
}


Measured memory_bytes: 4352
n = gets.to_i

def divisor(n)
	array = []
	(1..Math.sqrt(n)).each do |i|
		if n % i == 0
			array << i
			array << n / i unless i ** 2 == n
		end
	end
	array
end

ans = 0
ans += divisor(n-1).size - 1
divisor(n).each do |i|
	next if i == 1
	temp = n
	while temp % i == 0
		temp /= i
	end
	ans += 1 if (temp - 1) % i == 0
end

puts ans

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

using namespace std;

int main()
{
    long long  n,k;
    cin>>n>>k;
    priority_queue<long long>q;
    for(long long i=0;i<n;i++)
    {
        long long a;
        cin>>a;
        q.push(a);
    }
    while(k>0)
    {
        long long x=q.top();
        q.pop();
        x/=2;
        q.push(x);
        --k;
    }
    long long sum=0;
    while(!q.empty())
    {
        long long x=q.top();
        sum+=x;
        q.pop();
    }
    cout<<sum<<endl;
}


Measured memory_bytes: 1400
n,k=map(int,input().split())
a=list(map(int,input().split()))

def imos(n,a):
  imos_l=[0]*n
  for i in range(n):
    l=max(i-a[i],0)
    r=min(i+a[i],n-1)
    imos_l[l]+=1
    if (r+1)!=n:
      imos_l[r+1]-=1

  b=[0]
  for i in range(1,n+1):
    b.append(imos_l[i-1]+b[i-1])
  return b[1:]

for i in range(k):
  na=imos(n,a)
  if na==a:
    break
  a=na

print(*a)

Measured memory_bytes: 219992
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <regex>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <valarray>
#include <vector>
using namespace std;

using ll = long long;
using ld = long double;
const int INF = 1e9;
const double EPS = 1e-9;
const ll MOD = 1e9 + 7;

int main()
{
  long long N;
  scanf("%lld", &N);
  long long K;
  scanf("%lld", &K);
  std::vector<long long> p(N);
  for (int i = 0; i < N; i++)
  {
    scanf("%lld", &p[i]);
  }
  sort(p.begin(), p.end());
  cout << accumulate(p.begin(), p.begin() + K, 0) << endl;

  return 0;
}


Measured memory_bytes: 3700
#include <bits/stdc++.h>
using namespace std;
#define finish(x) return cout << x << endl, 0
#define ll long long

const int N = 200001;

int n, k, tree[4 * N];
vector <int> a;

void update(int l, int r, int node, int idx){
    if(r < l || r < idx || l > idx) return;
    if(l == r){
        tree[node]++;
        return;
    }
    int mid = (l + r) / 2;
    update(l, mid, 2 * node, idx);
    update(mid + 1, r, 2 * node + 1, idx);
    tree[node] = tree[2 * node] + tree[2 * node + 1];
}
int query(int l, int r, int node, int s, int e){
    if(r < l || r < s || l > e) return 0;
    if(s <= l && r <= e) return tree[node];
    int mid = (l + r) / 2;
    return query(l, mid, 2 * node, s, e) + query(mid + 1, r, 2 * node + 1, s, e);
}
int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cin >> n >> k;
    a.resize(n);
    for(auto &i : a){
        cin >> i;
        i -= k;
    }
    vector <ll> b;
    b.push_back(0);
    for(auto &i : a){
        b.push_back(b.back() + i);
    }
    map <ll, int> mp;
    for(auto &i : b) mp[i];
    int x = 0;
    for(auto &i : mp) i.second = x++;
    for(auto &i : b) i = mp[i];
    ll ans = 0;
    for(auto &i : b){
        ans += query(0, n, 1, 0, i);
        update(0, n, 1, i);
    }
    cout << ans << endl;
}


Measured memory_bytes: 20216
#include <bits/stdc++.h>
#define rep3(i, s, n, a) for (int i = (s); i < (int)(n); i += a)
#define rep2(i, s, n) rep3(i, s, n, 1)
#define rep(i, n) rep2(i, 0, n)

using namespace std;
using ll = long long;
using ull = unsigned long long;
using P = pair<int, int>;

int main(){
    int n, m;
    cin >> n >> m;
    priority_queue<ll> a;
    rep(i, n){
        ll x;
        cin >> x;
        a.push(x);
    }
    rep(i, m){
        ll x = a.top();
        a.pop();
        x /= 2LL;
        a.push(x);
    }
    ll sum = 0;
    rep(i, n){
        sum += a.top();
        a.pop();
    }
    cout << sum << endl;
    return 0;
}

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

/*struct*/
struct aaa {
	aaa() {
		cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(20);
	};
}aaaaaaa;

signed main()
{
	int n; cin >> n;
  	int cnt{};
	map<int, int> a{};
	while (n--)
	{
		int tmp; cin >> tmp;

		++a[tmp];
	}

	for(auto itr: a){
		cnt += itr.second % 2;
	}

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

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

#define rep(i, n) for(int i = 0; i<(n); i++)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
using ll = long long;

ll dp[110][2][4];

int main() {
    string S;
    int K;
    cin >> S >> K;

    dp[0][0][0] = 1;
    rep(i, S.size()) {
        int c = S[i] - '0';

        rep(d, 10) {
            if (d < c) {
                if (d == 0) {
                    rep(k, 4) dp[i + 1][1][k] += dp[i][0][k];
                    rep(k, 4) dp[i + 1][1][k] += dp[i][1][k];
                } else {
                    rep(k, 3) dp[i + 1][1][k + 1] += dp[i][0][k];
                    rep(k, 3) dp[i + 1][1][k + 1] += dp[i][1][k];
                }
            } else if (d == c) {
                if (d == 0) {
                    rep(k, 4) dp[i + 1][0][k] += dp[i][0][k];

                    rep(k, 4) dp[i + 1][1][k] += dp[i][1][k];
                } else {
                    rep(k, 3) dp[i + 1][0][k + 1] += dp[i][0][k];

                    rep(k, 3) dp[i + 1][1][k + 1] += dp[i][1][k];
                }
            } else {
                if (d == 0) {
                    rep(k, 4) dp[i + 1][1][k] += dp[i][1][k];
                } else {
                    rep(k, 3) dp[i + 1][1][k + 1] += dp[i][1][k];
                }
            }
        }
    }

    cout << dp[S.size()][0][K] + dp[S.size()][1][K] << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cmath>
#include<queue>
#include<map>
#include<set>
#include<list>
#include<iomanip>
#include<vector>
#include<functional>
#include<algorithm>
#include<cstdio>
#include<unordered_map>
using namespace std;
//---------------------------------------------------
//ライブラリゾーン！！！！
#define int long long
#define str string
#define rep(i,j) for(int i=0;i<(int)(j);i++)
typedef long long ll;
typedef long double ld;
const ll inf = 4523372036854775807;
short gh[2][4] = { { 0,0,-1,1 },{ -1,1,0,0 } };
struct P {
	ll pos, cost;
};
bool operator<(P a, P b) { return a.cost < b.cost; }
bool operator>(P a, P b) { return a.cost > b.cost; }
struct B {//隣接リスト表現
	ll to, cost;
};
struct S {//辺の情報を入れる変数
	int from, to, cost;
};
struct H {
	int x, y;
};
bool operator<(H a, H b) {
	if (a.x != b.x) return a.x < b.x;
	return a.y < b.y;
}
bool operator>(H a, H b) {
	if (a.x != b.x) return a.x > b.x;
	return a.y > b.y;
}
ll gcm(ll i, ll j) {//最大公約数
	if (i > j) swap(i, j);
	if (i == 0) return j;
	return gcm(j%i, i);
}
ld rad(ld a, ld b, ld c, ld d) {
	return sqrt(pow(a - c, 2) + pow(b - d, 2));
}//rad＝座標上の2点間の距離
int ari(int a, int b, int c) {
	return (a + b)*c / 2;
}//等差数列の和
bool suf(ld a, ld b, ld c, ld d) {
	if (b <= c || d <= a) return 0;
	return 1;
}//[a,b),[c,d)
//---------------------------------------------------
//+++++++++++++++++++++++++++++++++++++++++++++++++++
int a[50][50], h, w;
bool b[50][50];
signed main() {
	cin >> h >> w;
	for (int i = 0; i < h; i++) {
		string s;
		cin >> s;
		for (int j = 0; j < w; j++) {
			if (s[j] == '#') {
				b[i][j] = 1;
				for (int x = -1; x <= 1; x++) {
					for (int y = -1; y <= 1; y++) {
						if (i + x >= 0 && i + x < h&&j + y >= 0 && j + y < w) {
							a[i + x][j + y]++;
						}
					}
				}
			}
		}
	}
	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) {
			if (b[i][j])
				cout << "#";
			else
				cout << a[i][j];
		}
		cout << endl;
	}
	getchar(); getchar();
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.Serializable;
import java.util.Arrays;

public class Main {
	public static void main(String args[]) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		int n = Integer.parseInt(br.readLine());

		String p = br.readLine().replace(" ", "");
		String q = br.readLine().replace(" ", "");

		Permutation<String> per = new Permutation<>(p.split(""));

		String str[] = new String[kaizyou(n)];
		int count = 0;
		do {
			String s = "";
			String ss[] = per.getTarget().clone();
			for (int i = 0; i < n; i++) {
				s += ss[i];
			}
			str[count++] = s;
		} while (per.next());

		Arrays.sort(str);

		int a = 0;
		int b = 0;

		for (int i = 0; i < str.length; i++) {
			if (str[i].equals(p)) {
				a = i;
			}
			if (str[i].equals(q)) {
				b = i;
			}
		}

		System.out.println(Math.abs(a - b));
	}

	static int kaizyou(int n) {
		if (n == 0)
			return 1;
		return kaizyou(n - 1) * n;
	}
}

class Permutation<T extends Serializable> {

	private int baseIndex;
	private int index;
	private T[] objs;

	private Permutation<T> subPermutation;

	public Permutation(T[] objs) {
		this(0, 0, objs.clone());
	}

	private Permutation(int baseIndex, int index, T[] objs) {
		if (objs == null || objs.length == 0) {
			throw new IllegalArgumentException();
		}

		this.baseIndex = baseIndex;
		this.index = index;
		this.objs = objs;

		if (this.index < this.objs.length - 1) {
			this.subPermutation = new Permutation<T>(this.baseIndex + 1, this.index + 1, this.objs);
		}
	}

	public T[] getTarget() {
		return this.objs;
	}

	public boolean next() {
		if (this.subPermutation == null) {
			return false;
		}

		boolean result = this.subPermutation.next();
		if (result == true) {
			return true;
		}

		this.swap(this.baseIndex, this.index);

		++this.index;
		if (this.objs.length <= this.index) {
			this.index = this.baseIndex;
			return false;
		}

		this.swap(this.index, this.baseIndex);
		return true;
	}

	private void swap(int index1, int index2) {
		T tmp = this.objs[index1];
		this.objs[index1] = this.objs[index2];
		this.objs[index2] = tmp;
	}
}


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

int main() {

  long long int n;

  cin >> n;

  for ( long long int i = 0; i < n; i++ ) {

    long long int y, m, d;

    cin >> y >> m >> d;

    long long int ans = 0;

    ans += ( ( y - 1 ) / 3 ) * ( 195 * 2 + 200 );

    if ( ( y % 3 ) == 0 ) {
      ans += 195 * 2;
      ans += ( m - 1 ) * 20;
      ans += d - 1;
    }else {
      if ( ( y % 3 ) == 2 ) {
	ans += 195;
      }
      for ( int j = 1; j < m; j++ ) {
	if ( ( j % 2 ) == 0 ) {
	  ans += 19;
	}else {
	  ans += 20;
	}
      }
      ans += d - 1;
    }

    cout << 196470 - ans << endl;

  }

  return 0;

}

Measured memory_bytes: 1156
//#include "stdafx.h"
#include <iostream>
#include <set>
#include <queue>
#include <vector>
#include <algorithm>
#include <math.h>
#include <cmath>
#include <string>
#include <cstring>
#include <functional>
#include <climits>
#include <sstream>
#include <iomanip>
#include <map>
#include <stack>
#include <tuple>
#include <numeric>
#include <assert.h>
#include <functional>
#include <unordered_map>

using namespace std;

/*-----------------------------------------------------------------------------
　定義
 -------------------------------------------------------------------------------*/
#define REP(i, n)				for (int (i) = 0 ; (i) < (int)(n) ; ++(i))
#define REPN(i, m, n)			for (int (i) = m ; (i) < (int)(n) ; ++(i))
#define INF						2e9
#define MOD						(1000 * 1000 * 1000 + 7)
#define Ceil(x, n)				(((((x))+((n)-1))/n))		/* Nの倍数に切り上げ割り算 */
#define CeilN(x, n)				(((((x))+((n)-1))/n)*n)		/* Nの倍数に切り上げ */
#define FloorN(x, n)			((x)-(x)%(n))				/* Nの倍数に切り下げ */
#define IsOdd(x)				(((x)&0x01UL) == 0x01UL)			
#define IsEven(x)				(!IsOdd((x)))						
#define	BitSetV(Val,Bit)		((Val) |= (Bit))			
#define	BitTstV(Val,Bit)		((Val) & (Bit))				
#define ArrayLength(x)			(sizeof( x ) / sizeof( x[ 0 ]))
#define	MAX_QWORD				((QWORD)0xFFFFFFFFFFFFFFFF)
#define	MIN_QWORD				((QWORD)0x0000000000000000)
#define	MAX_SQWORD				((SQWORD)0x7FFFFFFFFFFFFFFF)
#define	MIN_SQWORD				((SQWORD)0x8000000000000000)
#define M_PI					3.14159265358979323846
typedef long long				ll;
typedef unsigned long			DWORD;
typedef unsigned long long int	QWORD;
typedef pair<ll, ll>			P;

/*-----------------------------------------------------------------------------
　処理
 -------------------------------------------------------------------------------*/
// メイン
int main()
{
	// 入力
	string S, T;
	cin >> S >> T;
	vector<int> SCNT(26, 0), TCNT(26, 0);
	
	REP(i, S.length()) {
		SCNT[S[i] - 'a']++;
	}
	REP(i, T.length()) {
		TCNT[T[i] - 'a']++;
	}
	sort(SCNT.begin(), SCNT.end());
	sort(TCNT.begin(), TCNT.end());

	bool ans = true;
	REP(i, SCNT.size()) {
		if (SCNT[i] != TCNT[i]) {
			ans = false;
			break;
		}
	}
	if (ans) {
		cout << "Yes" << endl;
	} else {
		cout << "No" << endl;
	}
	return 0;
}



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

void solve() {
  char n;
  cin>>n;
  if (n<'a') {
    cout<<"A";
  } 
  else cout<<"a";
}

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


Measured memory_bytes: 3652
#include <iostream>
#include <algorithm>
#include <vector>

using namespace std;

int solve(vector<int> &layer) {
	int ret = 1;
	sort(layer.begin(), layer.end());
	for (int i = 1; i < layer.size(); i++) {
		if (layer[i - 1] != layer[i])
			ret++;
	}
	return ret;
}

int main() {
	int n;
	cin >> n;
	vector<int> layer(n);
	for (int i = 0; i < n; i++)
		cin >> layer[i];
	cout << solve(layer) << endl;
}

Measured memory_bytes: 256
//IN THE NAME OF LORD
#include<bits/stdc++.h>
using namespace std;
 
#define ff              first
#define ss              second
#define int              long long 
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define vvi             vector<vector<int>>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define inf             9e18
#define ALL(a)          a.begin(),a.end()
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)
#define from(i,n)       for(int i=0;i<(int)n;i++)
#define from_j(i,j,n)   for(int i=j;i<(int)n;i++)
mt19937                 rng(chrono::steady_clock::now().time_since_epoch().count());
 
//typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;
 
int md = 1e9+7;
int mul(int a,int b){
    return ((a*b)%md+md)%md;
} 
int add(int a,int b){
    return ((a+b)%md+md)%md;
} 
void c_p_c()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

}
int n,k;
vvi matmul(vvi a,vvi b,int d){
    vvi c(d,vi(d,0));
    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++){
            //c[i][j]=0;
            for(int k=0;k<n;k++)
               // cout<<"mul "<<a[i][k]<<" and "<<b[j][k]<<endl;
                c[i][j] = add(c[i][j],mul(a[i][k],b[k][j]));
        }
    }
    return c;
}
vvi power(vvi a,int N){
    if(N==1)
        return a;
    vvi b = power(a,N/2);
    vvi c;
    if(N&1)
        c = matmul(matmul(b,b,n),a,n);
    else
        c = matmul(b,b,n);
    return c;

}
int32_t main()
{
    c_p_c();
    cin>>n>>k;
    vvi a(n,vi(n));
    for(int i=0;i<n;i++)
        for(int j=0;j<n;j++)
            cin>>a[i][j];
    
    vvi b = power(a,k);
 //   cout<<b.size()<<endl;
    int ans = 0;
    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++)
            ans = add(ans,b[i][j]);
        
    }
    cout<<ans;

 cerr << "proc time: " << 1.0 * clock() / CLOCKS_PER_SEC << "s    ";
    return 0;
        
}


Measured memory_bytes: 5052
#include<stdio.h>
int main(){
  int a[100001],n,t=1,i;
  scanf("%d",&n);
  for(i=1;i<=n;i++)scanf("%d",&a[i]);
  for(i=1;i<=n;i++){t=a[t];if(t==2){printf("%d",i);return 0;}}
  printf("-1");
}


Measured memory_bytes: 512
#include <iostream>
#include <cmath>
#include <stdarg.h>
using namespace std;

int i=0;
bool sosuhantei(int num)
{
    if(num<2) return false;
    else if(num == 2) return true;
    else if(num%2 ==0)return false;
    
    
    for(int i=3;i<=sqrt(num);i+=1)
    {
        if(num%i==0)
        {
            return false;
        }
    }
    return true;

}


int main()
{
    int n;
    cin >>n;
    for(i=1;i<=55555;i++){
    if(sosuhantei(i)==true&&i%5==1){
        
        cout<<i<<" ";
        n-=1;
    }
        if(n==0)break;
    }
    cout << endl;
    return 0;
}

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

int score(char myhand, char yourhand){
  if (myhand == 'p' && yourhand == 'g') return 1;
  else if (myhand == 'g' && yourhand == 'p') return -1;
  else return 0;
}

int main(){
  int N;
  int ret = 0;
  string S;

  cin >> S;
  N = S.size();

  rep(i, N/2) ret += score('p', S[i]);
  rep0(i, N/2, N) ret += score('g', S[i]);

  cout << ret << endl;
}


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

// 方針
// 全体として、クリアできるパターンが

// 1,白黒白黒白　パターン 10101
// 2,黒白黒白黒　パターン 01010

// の2通りしかない。
// なので、総当りでこれにすればよさそう。
// Sは高々10^5なので、O(N)ならいける。

// とりあえず1番ルートで終わる過程でforループをまわす。
// 010101010　に一致しているか一文字づつチェックして、一致していない数をカウント。
// そのカウント数nが n  >= |S|/2 で場合わけして、超えてなかったらカウントした数が答え。
// 超えてたら、2番のパターンなので、S-n が答えになる。
// これはO(N)のはず。

int main(){
    string S;
    cin >> S;
    int count = 0;
    for(int i = 0;i < S.size();i++){

        if(S[i] == '0'){
            if(i % 2 == 0){ // 偶数個目
                continue;
            }
            else { //　奇数個目
                count += 1;
            }
        }
        else if(S[i] == '1'){
            if(i % 2 == 0){
                count += 1; // 偶数
            }
            else { // 奇数
                continue;
            }
        }
    }
    if(count > (S.size() / 2 ) ){
        cout << S.size() - count << endl;
    }
    else{
        cout << count << endl;
    }
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
#define faster  ios :: sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll long long
#define ull unsigned long long
using namespace std;

int main()
{
    faster
    int n;
    string s;

    cin>>n>>s;

    if(n>=3200)
        cout<<s<<endl;
    else
        cout<<"red"<<endl;




    return 0;
}


Measured memory_bytes: 256
N, K = map(int, input().split())
A = list(map(int, input().split()))

def f(x):
  r = 0
  for a in A:
    r += (a+x-1)//x-1
  return r

a = 0
b = 2**32
while b>0:
  if f(a+b)>K:
    a += b
  b //= 2
print(a+1)


Measured memory_bytes: 30844
#include<iostream>
#include<cmath>
#include<algorithm>
#include<iomanip>
#include<string>
#include<vector>
#include<cstdio>
#include<cstring>
#include<map>
#include<set>
#include<fstream>
#include<sstream>
#include<queue>
#include<iterator>
#include<stack>

using namespace std;

#define st first
#define nd second
#define FOR(i,a,b) for(long long i=a;i<b;i++)
#define REV(a) reverse(a.begin(),a.end())
#define SORT(a) sort(a.begin(),a.end())
#define inf (int)1e9
#define linf (long long)1e18

typedef long long ll;
typedef short int si;
typedef pair<int,int> pii;
typedef pair<ll,int> pli;
typedef vector<int> vi;
typedef vector<pii> vpii;
typedef vector<pli> vpli;

int main() {
		ll n;
		cin>>n;
		FOR(i,1,3501){
				FOR(j,1,3501){
						if(4*i*j-n*j-n*i){
								ll k=(n*i*j)/(4*i*j-n*j-n*i);
								if(k*((4*i*j-n*j-n*i))==n*i*j&&k>0){
										cout<<i<<" "<<j<<" "<<k<<endl;
										return 0;
								}
						}



				}
		}




		return 0;
}


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

divisors = [0 for _ in range(n+1)]

for i in range(1, n+1):
    for j in range(i, n+1, i):
        divisors[j] += 1
#print(divisors)

ans = 0
for k in range(n+1):
    ans += (k * divisors[k])

print(ans)


Measured memory_bytes: 225060
#include<cstdio>
#include<vector>
#include<deque>
#include<map>
#include<cstdlib>
#include<algorithm>

using namespace std;

const int MN=100100;

vector<int> G[MN];
bool used[MN];
int root[MN],dep[MN];
int even[MN],odd[MN];
int N;

void dfs(int v,int p,int d,int r){
	used[v]=true;
	dep[v]=d;
	root[v]=r;
	if(d%2==0) even[r]++;
	else odd[r]++;
	
	for(int i=0;i<G[v].size();i++){
		int u=G[v][i];
		if(u==p) continue;
		if(used[u]){
			if((dep[v]-dep[u])%2==0){
				printf("-1\n");
				exit(0);
			}else continue;
		}
		dfs(u,v,d+1,r);
	}
}

int w[MN],v[MN],num[MN];
map<int,int> nums;
int K,n;

int dp[MN];

void solve(){
	for(int i=0;i<K;i++){
		for(int a=0;a<w[i];a++){
			deque<int> deqi,deqv;
			for(int j=0;j*w[i]+a<=n;j++){
				int val=dp[j*w[i]+a]-j*v[i];
				while(!deqi.empty()&&deqv.back()<=val){
					deqi.pop_back();
					deqv.pop_back();
				}
				deqi.push_back(j);
				deqv.push_back(val);
				dp[j*w[i]+a]=deqv.front()+j*v[i];
				if(deqi.front()==j-num[i]){
					deqi.pop_front();
					deqv.pop_front();
				}
			}
		}
	}
}

int main(){
	int E;
	scanf("%d%d",&N,&E);
	if(E==0){
		int a=N/2;
		int b=N-a;
		long long all=(long long)a*b;
		printf("%lld\n",all);
		return 0;
	}
	for(int i=0;i<E;i++){
		int u,v;
		scanf("%d%d",&u,&v);
		u--;v--;
		G[v].push_back(u);
		G[u].push_back(v);
	}
	for(int i=0;i<N;i++){
		if(used[i]==false){
			dfs(i,-1,0,i);
		}
	}
	int S=0;
	for(int i=0;i<N;i++){
		if(root[i]==i){
			int d=max(odd[i]-even[i],even[i]-odd[i]);
			if(d!=0) nums[d]++;
			S+=d;
		}
	}
	if(nums.size()==0){
		int n=N/2;
		long long all=(long long)n*n;
		printf("%lld\n",all-E);
		return 0;
	}
	n=S/2;
	K=nums.size();
	map<int,int>::iterator it=nums.begin();
	int c=0;
	for(;it!=nums.end();it++){
		v[c]=it->first;
		w[c]=it->first;
		num[c++]=it->second;
	}
	solve();
	int a=0;
	for(int i=0;i<=n;i++) a=max(a,dp[i]);
//	int dif=S-2*dp[n];
	int dif=S-2*a;
	int x=(N-dif)/2;
	int y=x+dif;
	long long all=(long long)x*y;
	printf("%lld\n",all-E);
	return 0;
}

Measured memory_bytes: 8616
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define zero_pad(num) setfill('0') << std::right << setw(num)
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;

int main() {
    string s;
    cin >> s;
    int ans = (int)s.size() / 2;
    rep(i, s.size()){
        if(s[i] == 'p')ans--;
    }
    cout << ans << endl;
}

Measured memory_bytes: 512
T = int(input())
query = [list(map(int, input().split())) for i in range(T)]

def gcd(a, b):
	while b:
		a, b = b, a % b
	return a


ans_list = []
for i in range(T):
    A = query[i][0]
    B = query[i][1]
    C = query[i][2]
    D = query[i][3]
    if A < B:
        ans_list.append("No")
        continue
    if B > D:
        ans_list.append("No")
        continue
    if C >= B:
        ans_list.append("Yes")
        continue
    g = gcd(B, D)
    max_modB = B - g + A%g
    if max_modB > C:
        ans_list.append("No")
    else:
        ans_list.append("Yes")
        

print('\n'.join(ans_list))

Measured memory_bytes: 3064
#include <algorithm>
#include <iostream>
#include <vector>

using namespace std;

#define reps(i,f,n) for(int i=f; i<n; ++i)
#define rep(i,n) reps(i,0,n)

void solve(int n)
{
    vector<int> v(n);
    
    rep(i, n){
        string s;
        cin >> s;
        v[i] = s.size();
    }
    
    const int len[] = {5, 7, 5, 7, 7};
    rep(i, n){
        int p = 0, j = i;
        while(p < 5 && j < n){
            int cnt = len[p];
            for(; cnt && j<n; ++j){
                cnt -= v[j];
                if(cnt < 0) goto end;
            }
            ++p;
        }
        
        if(p == 5){
            cout << i+1 << endl;
            break;
        }
    end:;
    }
}

int main()
{
    int n;
    
    while(cin >> n, n){
        solve(n);
    }
}

Measured memory_bytes: 3164
def c_multiple_clocks(N, T):
    def gcd(a, b):
        while b > 0:
            a, b = b, a % b
        return a

    def lcm(a, b):
        return (a * b) // gcd(a, b)

    ans = 1
    for x in T:
        ans = lcm(ans, x)
    return ans

N = int(input())
T = [int(input()) for _ in range(N)]
print(c_multiple_clocks(N, T))

Measured memory_bytes: 3060
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <fstream>
#include <sstream>
#include <set>
#include <map>
#include <vector>
#include <list>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <string>
#include <stack>
#include <queue>
#include <bitset>     //UWAGA - w czasie kompilacji musi byc znany rozmiar wektora - nie mozna go zmienic
#include <cassert>
#include <iomanip>        //do setprecision
#include <ctime>
#include <complex>
using namespace std;

#define FOR(i,b,e) for(int i=(b);i<(e);++i)
#define FORQ(i,b,e) for(int i=(b);i<=(e);++i)
#define FORD(i,b,e) for(int i=(b)-1;i>=(e);--i)
#define REP(x, n) for(int x = 0; x < (n); ++x)

#define ST first
#define ND second
#define PB push_back
#define PF push_front
#define MP make_pair
#define LL long long
#define ULL unsigned LL
#define LD long double
#define pii pair<int,int>
#define pll pair<LL,LL>
#define vi vector<int>
#define vl vector<LL>
#define vii vector<vi>
#define vll vector<vl>

const double pi = 3.14159265358979323846264;
const int mod=1000000007;

int main(){
	int n;
    cin>>n;
    vi a(n,0);
    FOR(i,1,n){
        int aa;
        cin>>aa;
        a[aa-1]++;
    }
    FOR(i,0,n){
        cout<<a[i]<<endl;
    }
}


Measured memory_bytes: 3964
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
#define rep(i, n) for(ll i = 0;i < n;i++)
template<class T, class U> void cmax(T& a, U b) { if (a<b) a = b; }
template<class T, class U> void cmin(T& a, U b) { if (a>b) a = b; }
const ll INF = 1LL << 40;

ll calc(int i, ll x, ll y) {
  int cnt = 0;
  if (i&1) {
    cnt++;
    x *= -1;
  }
  if (i&2) {
    cnt++;
    y *= -1;
  }
  if (y >= x) {
    return y-x+cnt;
  } else {
    return INF;
  }
}

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

  ll x, y;
  cin >> x >> y;

  ll ans = INF;

  rep(i, 4) {
    cmin(ans, calc(i, x, y));
  }

  cout << ans << endl;
}


Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
int main()
{
	while(1)
	{
		int b,r,g,c,s,t;
		cin >> b >> r >> g >> c >> s >> t;
		if(b+r+g+c+s+t == 0) return 0;
		cout << (95*b+63*r+7*g+2*c+3*s-3*t+100) << endl;
	}
}

Measured memory_bytes: 1164
#!/usr/bin/env python3
import sys


def solve(N: int, M: int):
    ## Sccをいきなり作る
    answer =0 
    if N>=M//2:
        answer = M//2
    else:
        answer = N+(M-N*2)//4
    print(answer)


    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    M = int(next(tokens))  # type: int
    solve(N, M)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3060
#define rep(i,a,b) for (int i = (a); i < (b); i++)
#define _USE_MATH_DEFINES
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <cstring>
#include <queue>
#include <functional>
#include <set>
#include <map>
#include <string>
#include <cmath>
#include <math.h>
#include <complex>
#include <cassert>
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> P;
typedef complex<double> com;
const int mod = 1e9 + 7;
const int MOD = 998244353;
const int INF = 2e9;



int main() {
	int n, k; cin >> n >> k;
	vector<int> a(n);
	rep(i, 0, n) cin >> a[i];
	sort(a.begin(), a.end(),greater<int>());
	ll sum; int ans = 0;
	rep(i, 0, n) {
		sum = 0;
		rep(j, i, n) {
			sum += a[j];
			if (sum >= k) {
				ans = max(ans, j + 1);
				sum -= a[j];
			}
		}
	}
	ans = n - ans;
	printf("%d", ans);
	return 0;
}


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

#define pb push_back

#define F first
#define S second
#define all(x) x.begin(), x.end()
#define debug(x) cerr << #x << " " << x << '\n'
using namespace std;

typedef long long ll;
typedef long double ld;
typedef string str;
typedef pair<ll, ll> pll;

const ld PI = 3.14159265359;

const ll MOD = (ll) 1e9 + 7;
const ll MAXN = (ll) 12345 + 10;
const ll INF = (ll) 9223372036854775;
const ld EPS = (ld) 1e-8;

int main(){
    ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	ll n, su = 0;
	cin >> n;
	str s;
	cin >> s;
	//debug(s);
	for(auto x : s){
		//debug(x);
		if(x=='R') su++;
		else su--;
	}
	if(su > 0) cout << "Yes";
	else cout << "No";
	return 0;
}



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

#define filein freopen ("in.txt", "r", stdin)
#define fileout freopen ("out.txt", "w", stdout)
#define dbg(x) cerr << #x << ": " << x << endl

using namespace std;
typedef long long ll;

const int maxn = 1003;
const ll mod = 1000000007;

char grid[maxn][maxn];
ll dp[maxn][maxn];

int main(){
	ll n, m;
	scanf ("%lld %lld", &n, &m);
	getchar();
	for (ll i = 1; i <= n; i++){
		for (ll j = 1; j <= m; j++){
			scanf ("%c", &grid[i][j]);
		}
		getchar();
	}
	dp[1][1] = 1;
	for (ll i = 2; i <= m; i++){
		if (grid[1][i - 1] == '.' and grid[1][i] == '.')
			dp[1][i] = dp[1][i - 1];
		else break;
	}
	for (ll i = 2; i <= n; i++){
		if (grid[i - 1][1] == '.' and grid[i][1] == '.')
			dp[i][1] = dp[i - 1][1];
		else break;
	}
	for (ll i = 2; i <= n; i++){
		for (ll j = 2; j <= m; j++){
			if (grid[i][j] == '.' and grid[i - 1][j] == '.'){
				dp[i][j] += dp[i - 1][j];
				dp[i][j] %= mod;
			}
			if (grid[i][j] == '.' and grid[i][j - 1] == '.'){
				dp[i][j] += dp[i][j - 1];
				dp[i][j] %= mod;
			}
		}
	}
	cout << dp[n][m] << '\n';
	return 0;
}

Measured memory_bytes: 9088
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i=0; i<(int)(n); i++)
#define all(x) x.begin(), x.end()
#define mod 1000000007
typedef long long ll;

typedef struct{
  int x, y, h;
} point;

int main(){
  int n;
  cin >> n;
  vector<point> vec(n);
  rep(i, n){
    point p;
    cin >> p.x >> p.y >> p.h;
    vec[i] = p;
  }
  for(int i=0; i<=100; i++){
    for(int j=0; j<=100; j++){
      int H;
      rep(k, n){
        if(vec[k].h != 0){
          H = vec[k].h+abs(vec[k].x-j)+abs(vec[k].y-i);
          break;
        }
      }
      bool isok = true;
      rep(k, n){
        if(vec[k].h != 0){
          if(H != vec[k].h+abs(vec[k].x-j)+abs(vec[k].y-i)){
            isok = false;
            break;
          }
        }
      }
      if(!isok) continue;
      rep(k, n){
        if(vec[k].h != max(H-abs(vec[k].x-j)-abs(vec[k].y-i), 0)){
          isok = false;
          break;
        }
      }
      if(!isok) continue;
      cout << j << " " << i << " " << H << endl;
      return 0;
    } 
  }
  return 0;
}




Measured memory_bytes: 3636
def main():
    S = input()
    L, R = 1001001, 0
    for i in range(len(S)):
        if S[i] == 'A' and L > i:
            L = i
        if S[i] == 'Z' and R < i:
            R = i
    print(R - L + 1)


if __name__ == '__main__':
    main()


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

//A>B のときGREATER、A<B のときLESS、A=B のときEQUAL

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

  if (a == b)
  {
    cout << "EQUAL" << endl;
  }
  else if (a > b && a.size() >= b.size())
  {
    cout << "GREATER" << endl;
  }
  else if (a.size() > b.size())
  {
    cout << "GREATER" << endl;
  }
  else
  {
    cout << "LESS" << endl;
  }
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main() {
	long long a, b; cin >> a >> b;
	if (b % a == 0 || a == 2) cout << -1 << endl;
	else {
		long long minmul = (b / a) * a;
		if (minmul < b) minmul += a;
		long long gr = 0, ngr = minmul / a, tmp = minmul, ans = -1;
		gr += tmp / b, tmp %= b;
		gr += tmp / a, tmp %= a;
		gr += tmp;
		if (gr > ngr) ans = minmul;

		cout << ans << endl;
	}

	return 0;
}


Measured memory_bytes: 3104
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vb=vector<bool>;
using vvb=vector<vb>;
using vd=vector<double>;
using vvd=vector<vd>;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using pii=pair<int,int>;
using pll=pair<ll,ll>;
using tll=tuple<ll,ll>;
using tlll=tuple<ll,ll,ll>;
using vs=vector<string>;

#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rep(i,n) range(i,0,n)
#define rrep(i,n) for(int i=(n)-1;i>=0;i--)
#define range(i,a,n) for(int i=(a);i<(n);i++)

#define LINF ((ll)1ll<<60)
#define INF ((int)1<<30)
#define EPS (1e-9)
#define MOD (1000000007ll)
#define fcout(a) cout<<setprecision(a)<<fixed
#define fs first
#define sc second
#define PI 3.1415926535897932384

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

template<class T>bool chmax(T&a,T b){if(a<b){a=b; return true;}return false;}
template<class T>bool chmin(T&a,T b){if(a>b){a=b; return true;}return false;}
template<class S>S acm(vector<S>&a){return accumulate(all(a),S());}
template<class S>S max(vector<S>&a){return *max_element(all(a));}
template<class S>S min(vector<S>&a){return *min_element(all(a));}
void YN(bool b){cout<<(b?"YES":"NO")<<"\n";}
void Yn(bool b){cout<<(b?"Yes":"No")<<"\n";}
void yn(bool b){cout<<(b?"yes":"no")<<"\n";}

ll max(int a,ll b){return max((ll)a,b);} ll max(ll a,int b){return max(a,(ll)b);}
template<class T>void puta(T&&t){cout<<t<<"\n";}
template<class H,class...T>void puta(H&&h,T&&...t){cout<<h<<' ';puta(t...);}
template<class S,class T>ostream&operator<<(ostream&os,pair<S,T>p){os<<"["<<p.first<<", "<<p.second<<"]";return os;};
template<class S>auto&operator<<(ostream&os,vector<S>t){bool a=1; for(auto s:t){os<<(a?"":" ")<<s;a=0;} return os;}

void solve(int n){
	int m,ans=0;
	cin>>m;
	vl x0(m),y0(m);
	rep(i,m){
		cin>>x0[i]>>y0[i];
	}
	rep(i,n){
		cin>>m;
		vl x(m),y(m);
		rep(j,m)cin>>x[j]>>y[j];
		bool ok=false;
		int tx,ty;
		rep(j,4){
			bool check=true;
			rep(k,m){
				tx=(x[k]-x[0]);
				ty=(y[k]-y[0]);
				if(j==1){swap(tx,ty);tx*=-1;}
				if(j==2){tx*=-1;ty*=-1;}
				if(j==3){swap(tx,ty);ty*=-1;}
				//puta(tx,ty,":",x0[k]-x0[0],y0[k]-y0[0]);
				if(!(tx==x0[k]-x0[0]&&ty==y0[k]-y0[0])){
					check=false;
					k=m;
					//puta("!");
				}
			}
			ok|=(check&&m==x0.size());
		}
		rep(j,4){
			bool check=true;
			rep(k,m){
				tx=(x[k]-x[0]);
				ty=(y[k]-y[0]);
				if(j==1){swap(tx,ty);tx*=-1;}
				if(j==2){tx*=-1;ty*=-1;}
				if(j==3){swap(tx,ty);ty*=-1;}
				//puta(tx,ty,":",x0[k]-x0[0],y0[k]-y0[0]);
				if(!(tx==x0[m-1-k]-x0[m-1]&&ty==y0[m-1-k]-y0[m-1])){
					check=false;
					k=m;
					//puta("!");
				}
			}
			ok|=(check&&m==x0.size());
		}
		if(ok)cout<<i+1<<"\n";
	}
	cout<<"+++++"<<endl;
}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;
	while(cin>>n,n)solve(n);
}



Measured memory_bytes: 3152
#include <bits/stdc++.h>
using namespace std;
struct Fast {
    Fast() {
        cin.tie(0);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(20);
    }
} fast;

void yes() {
    cout << "Yes" << endl;
    exit(0);
}
void no() {
    cout << "No" << endl;
    exit(0);
}
#define REP(i, n) for (long long i = 0; i < (n); i++)

long long modpow(long long m, long long n) {
    if (n == 0) return 1;
    if (n % 2 == 0) {
        long long t = modpow(m, n / 2);
        return t * t;
    } else {
        return modpow(m, n - 1) * m;
    }
}
typedef long long ll;
typedef pair<ll, ll> P;
map<long long, long long> cnt;
void primeFactors(long long n) {
    while (n % 2 == 0) {
        cnt[2]++;
        n = n / 2;
    }
    for (int i = 3; i <= sqrt(n); i = i + 2) {
        while (n % i == 0) {
            cnt[i]++;
            n = n / i;
        }
    }
    if (n > 2) {
        cnt[n]++;
    }
}
signed main() {
    int n;
    cin >> n;
    vector<ll> as(n);
    ll sum = 0;
    REP(i, n) {
        cin >> as[i];
        sum = sum ^ as[i];
    }
    REP(i, n) {
        ll now = sum;
        now = sum ^ as[i];
        cout << now << " ";
    }
}

Measured memory_bytes: 4780
class solver :
	def __init__(self) :
		self.n, self.m, self.x = map(int, input().split())
		self.initVariables()
		for i in range(self.n) :
			self.a[i] = [int(i) for i in input().split()]

	def initVariables(self) :
		self.a = [list() for i in range(self.n)]

	def checkRequirement(self, skill) :
		for i in skill :
			if i < self.x :
				return False
		return True

	def getResult(self, mask) :
		skill = [0] * self.m
		cost = 0
		for i in range(self.n) :
			if mask % 2 == 1:
				cost += self.a[i][0]
				for j in range(self.m) :
					skill[j] += self.a[i][j + 1] 
			mask //= 2
		return (cost, self.checkRequirement(skill))

	def solve(self) :
		ans = [-1, False]
		for mask in range(2 ** self.n) :
			cur = self.getResult(mask)
			if cur[1] == True :
				if ans[1] == False or cur[0] < ans[0] :
					ans = cur
		return ans

print(solver().solve()[0])



Measured memory_bytes: 9212
#include <bits/stdc++.h> 
using namespace std;
const long INF=1000000000000000;
const long MOD=1000000007;

long dis(long a,long b,long c){
    return max(a,max(b,c))-min(a,min(b,c));
}

int main() {
    string A,B,C;
    
    cin>>A>>B>>C;
    
    if(A.at(A.size()-1)==B.at(0) && B.at(B.size()-1)==C.at(0)) cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
	public static String toUpper(int i){
		switch(i){
			case 0:
			case 1:
				return ".";
			case 2:
			case 3:
				return "#";
			default:
			    return "?";
		}
	}//0,1->"." 2,3->"#"
	public static String toLower(int i){
		switch(i){
			case 0:
			case 2:
				return ".";
			case 1:
			case 3:
				return "#";
			default:
			    return "?";
		}
	}//0,2->"." 1,3->"#"
	
    public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int N = Integer.parseInt(br.readLine());
        String upper = "",
               lower = "";
        boolean end = false;
        int next = 0;
        while(!end && next<4){
        	System.out.println(upper + toUpper(next));
        	System.out.println(lower + toLower(next));
        	String result = br.readLine();
        	if(result.equals("end")){
        		upper = upper + toUpper(next);
        		lower = lower + toLower(next);
        		end = true;
        	}
        	else if(result.equals("T")){
        		upper = upper + toUpper(next);
        		lower = lower + toLower(next);
        		next = 0;
        	}
        	else next++;
        }//upper and lower is the right edge
        next = 0;
        while(!end){
        	System.out.println(toUpper(next) + upper);
        	System.out.println(toLower(next) + lower);
        	String result = br.readLine();
        	if(result.equals("end")){
        		upper = toUpper(next) + upper;
        		lower = toLower(next) + lower;
        		end = true;
        	}
        	else if(result.equals("T")){
        		upper = toUpper(next) + upper;
        		lower = toLower(next) + lower;
        		next = 0;
        	}
        	else next++;
        }
    }
}

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

int main(){
    int a,b,c;
    cin >> a >> b >> c;
    if(a > b){
        int a0;
        a0 = a;
        a = b;
        b = a0;
    }
    if(b > c){
        int b0;
        b0 = b;
        b = c;
        c = b0;
    }
    if(a > b){
        int a0;
        a0 = a;
        a = b;
        b = a0;
    }
    cout << a << " " << b << " " << c << endl;

    return 0;
}


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

int main(){
	int prev, next, oldsum, max=0;
	cin >> prev >> next >> oldsum;
	while(!(prev==0 && next == 0 && oldsum == 0)){
		for(int i=1; i<=oldsum; i++){
			for(int j=1; j<=oldsum; j++){
				if((i+i*prev/100)+(j+j*prev/100) == oldsum){
					if(max < (i+i*next/100)+(j+j*next/100)){
						max=(i+i*next/100)+(j+j*next/100);
					}
				}
			}
		}
		cout << max << endl;
		max=0;
		cin >> prev >> next >> oldsum;
	}

}

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

int main(void){

	double vel;
	int N;

	while(scanf("%lf",&vel)!=EOF){
		N=1;
		while(9.8*sqrt((5*N-5)/4.9)<vel){
			N++;
		}
		printf("%d\n",N);
	}

	return 0;
}

Measured memory_bytes: 1056
a, b, c, d = map(int, input().split())
takaturn = 0
while (a > 0 and c > 0):
  takaturn += 1
  takaturn %= 2
  if takaturn:
    c -= b
  else:
    a -= d
if takaturn:
  print("Yes")
else:
  print("No")

Measured memory_bytes: 9100