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

typedef long long ll;
typedef long double ld;

const ll BIG = 1e9;
const int TOP = 18;

int vp(ll x, int p){
    int res = 0;
    while(x % p == 0){
        res++; x /= p;
    }
    return res;
}
ll cnt[TOP + 1][TOP + 1];
int main(){
//    ios_base::sync_with_stdio(0); cin.tie(0);
    int n; cin >> n;
    vector<ll> a;
    cout << fixed << setprecision(15);
    for(int i = 0; i < n; i++){
        ld x; cin >> x;
        x *= BIG; x = round(x);
        a.push_back((ll) x);
    }
    vector<pair<int, int>> v;
    for(int i = 0 ; i < n; i++) v.emplace_back(vp(a[i], 2), vp(a[i], 5));
    for(int i = 0; i < n; i++){
        int x = v[i].first; int y = v[i].second;
        x = min(x, TOP);
        y = min(y, TOP);
        cnt[x][y]++;
    }
    ll ans = 0;
    for(int i = TOP / 2; i <= TOP; i++){
        for(int j = TOP / 2; j <= TOP; j++){
            ans += cnt[i][j] * (cnt[i][j] - 1) / 2;
        }
    }
    for(int i = 0; i <= TOP; i++){
        for(int j = 0; j <= TOP; j++){
            for(int k = 0; k <= TOP; k++){
                for(int l = 0; l <= TOP; l++){
                    if(i + k < TOP || j + l < TOP) continue;
                    if(make_pair(i, j) >= make_pair(k, l)) continue;
                    ans += cnt[i][j] * cnt[k][l];
                }
            }
        }
    }
    cout << ans << '\n';
    return 0;
}


Measured memory_bytes: 8104
#include <set>
#include <map>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <ctype.h>
#include <ctime>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <numeric>
#include <complex>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <iostream>
#include <iterator>
#include <algorithm>
#define ALL(g) (g).begin(),(g).end()
#define REP(i, x, n) for(int i = x; i < n; i++)
#define rep(i,n) REP(i,0,n)
#define F(i,j,k) fill(i[0],i[0]+j*j,k)
#define P(p) cout<<(p)<<endl;
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define INF 1<<25
#define pb push_back
using namespace std; 
typedef vector<int> vi;
typedef vector<long long> vl;
typedef vector<double> vd;
typedef pair<int,int> pii;
typedef pair<long,long> pll;
typedef long long ll;



int main(){
	int n,m;
	cin >> n >> m;
	int C[m];
	int T[n+1];
	for(int i = 0;i < m;i++){
		cin >> C[i];
	}
	for(int i = 1;i <= n;i++){
		T[i] = INF;
	}
	T[0] = 0;
	for(int i = 0;i <= n;i++){
		for(int j = 0;j < m;j++){
			if(i - C[j] >= 0){
				T[i] = min(T[i-C[j]] + 1,T[i]);
			}
		}
	}
	P(T[n]);
	return 0;
}

Measured memory_bytes: 1352
i1 = list(map(int, input().split()))

o1 = ((i1[0]) // (i1[1]*2 + 1))
o2 = ((i1[0]) % (i1[1]*2 + 1))
if o2 == 0:
    print(o1)
else:
    print(o1 + 1)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
 
int main () {
  int n,m;
  cin>>n>>m;
  vector<int>a(n);

  for(int i=0;i<m;i++){
    int k;
    cin>>k;
    for(int j=0;j<k;j++){
      int s;
      cin>>s;
      s--;
      a.at(s) |= 1<<i; //orビット演算
    }
  } //ここ迄入力

  int p =0;
  for (int i=0;i<m;i++){
    int x;
    cin>>x;
    p |= x<<i;
  }

  int ans=0;

  for (int s=0;s<(1<<n);s++){ //bit列挙
    int t = 0;
    for(int i=0;i<n;i++){
      if(s>>i&1){ //i番目のbitが1になっているか？ifがint型の時0がfalse 以外はtrue
        t ^= a.at(i);
      }
    }
    if (t ==p){
      ans++;
    }
  }
  cout <<ans<<endl;
return 0;
}

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

#define rep(i, n) REP(i, 0, n)
#define REP(i, x, n) for (int i = x; i < n; i++)
#define OP(x) cout << x << endl;

int main() {
    int n, d; cin >> n >> d;
    vector<vector<double> > vec(n, vector<double>(d));
    rep(i, n){
        rep(j, d){
            cin >> vec[i][j];
        }
    }

    int cnt = 0;
    for(int i = 0; i < n; i++){
        for(int j = i + 1; j < n; j++){
            double tmp = 0.0;
            for(int k = 0; k < d; k++){
                tmp += pow(vec[i][k] - vec[j][k], 2.0);
            }
            // 整数判定
            if(floor(sqrt(tmp)) == sqrt(tmp)) cnt++;
        }
    }
    OP(cnt);
}


Measured memory_bytes: 256
N = int(input())
a = [0 for _ in range(N + 10)]

for i in range(1, N + 5):
    temp = i
    while(temp <= N):
        a[temp] += 1
        temp += i
ans = 0
for i in range(1, N + 1, 2):
    if a[i] == 8:  ans += 1
print(ans)

Measured memory_bytes: 63316
#include <iostream>
#include <stack>
#include <vector>
using namespace std;
static const int MAX = 100000;
static const int NIL = -1;

int n;
vector<int> G[MAX];
int color[MAX];

void dfs(int v, int id)
{
    stack<int> S;
    S.push(v);
    color[v] = id;
    int u;
    while (!S.empty()) {
        u = S.top(); S.pop();
        for (int i = 0; i < G[u].size(); i++) {
            int v = G[u][i];
            if (color[v] == NIL) {
                color[v] = id;
                S.push(v);
            }
        }
    }
}

void assignColor()
{
    int id = 1;
    for (int i = 0; i < n; i++) {
        color[i] = NIL;
    }
    for (int i = 0; i < n; i++) {
        if (color[i] == NIL) {
            dfs(i, id++);
        }
    }
}

int main(int argc, char const *argv[])
{
    int s, t, m, q;

    cin >> n >> m;

    for (int i = 0; i < m; i++) {
        cin >> s >> t;
        G[s].push_back(t);
        G[t].push_back(s);
    }

    assignColor();

    cin >> q;

    for (int i = 0; i < q; i++) {
        cin >> s >> t;
        if (color[s] == color[t]) {
            cout << "yes" << endl;
        } else {
            cout << "no" << endl;
        }
    }
    return 0;
}



Measured memory_bytes: 8984
/*** author: yuji9511 ***/
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> lpair;
const ll MOD = 1e9 + 7;
const ll INF = 1e18;
#define rep(i,m,n) for(ll i = (m); i < (n); i++)
#define rrep(i,m,n) for(ll i = (m); i >= (n); i--)
#define printa(x,n) for(ll i = 0; i < n; i++){ cout << (x[i]) << " \n"[i==n-1];};
void print() { cout << endl; }
template <class Head, class... Tail>
void print(Head&& head, Tail&&... tail){cout << head << " "; print(forward<Tail>(tail)...);}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	string S;
	cin >> S;
	if(S[0] == 'S'){
		print("Cloudy");
	}else if(S[0] == 'C'){
		print("Rainy");
	}else{
		print("Sunny");
	}
}

Measured memory_bytes: 256
#!/usr/bin/python3
# -*- coding: utf-8 -*-

import sys

while True:
    h, w = map(int, sys.stdin.readline().split())
    if h == 0  and w == 0:
        break

    top_bot = '#' * w
    mid = '#' + ('.' * (w-2)) + '#'
    print(top_bot)
    for row in range(h-2):
        print(mid)
    print(top_bot)
    print()



Measured memory_bytes: 5624
/*
    ->->->->-> Vora Mahammasasim <-<-<-<-<-
*/
#include<bits/stdc++.h>
#define Quick std :: ios_base :: sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define int long long
#define pb emplace_back
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define MOD 1e7+7;
using namespace std;





signed main(){

    Quick;
    int n;
    cin>>n;
    vector<pair<int,int>>a(n);
    for(int i=0;i<n;i++) cin>>a[i].first>>a[i].second;
    bool ok = false;
    for(int i=0;i<n-2;i++){
        if(a[i].first == a[i].second && a[i+1].first == a[i+1].second && a[i+2].first == a[i+2].second){
            ok = true;
            break;
        }
    }
    if(ok) cout<<"Yes\n";
    else cout<<"No\n";
    return 0;
}


Measured memory_bytes: 3600
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <queue>
#include <string>
#include <algorithm>
#include <cstdio>
#include <stack>
#include <vector>
#include <map>
#include <ctime>
#include <cmath>
#include <string.h>
#define inf 0x7fffffff
using namespace std;
struct P
{
    int x,y,z;

    bool operator<(const P &a)const{
       // if(y!=a.y)
       // return y>a.y;
       return x>a.x;
//        return z>a.z;
    }
};
//vector<int> v[20056],v1[20020];

int a,b,c,i,k,o[100002],n,m,d,e,dy[15]={0,0,-1,1,-1,1,-1,1},dx[15]={-1,1,0,0,1,1,-1,-1};
int l[50005];
long long x,y,z,v1,v2;
P u[200600];
int j[6000000];
queue<int> q,q1;
stack<int> s;
//queue<P> q;

//deque<int> d;
//'1'==49;
//'A'==65;
//'a'==97;
map<int, int > p;
string r,r1,r2;
//char r[5000];

bool as(int a,int b)
{
     return a>b;

}

//2147483647
int main()
{
    cin>>r;
    for(int t=0;t<r.size()-8;t++)
        printf("%c",r[t]);
}


Measured memory_bytes: 764
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <queue>
#include <map>
#include <numeric>
#include <unordered_map>
#include <iomanip>
#include <functional>
#include <bitset>
#include <complex>
#include <stack>
#include <cstdint>



#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define rrep(i, n) for(ll i = (ll)(n-1); i >= 0; i--)
#define repi(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define rrepi(i,a,b) for(ll i=(ll)(b);i>=(ll)(a);i--)

#define all(x) (x).begin(),(x).end()

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

typedef long long ll;

using namespace std;


int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll n,m;cin>>n>>m;
  vector<vector<ll>>ed(n+1);
  rep(i,m){
    ll x,y;cin>>x>>y;
    ed[x].push_back(y);
  }
  rep(i,n){
    ed[0].push_back(i+1);
  }
  vector<ll>used(n+1,-1);
  function<ll(ll)>dfs=[&](ll v){
    ll res=-1;
    for(auto nv:ed[v]){
      if(used[nv]!=-1){
        chmax(res,used[nv]);
        continue;
      }
      chmax(res,dfs(nv));
    }

    return used[v]=res+1;
  };
  cout<<dfs(0)-1<<endl;

  return 0;

}


Measured memory_bytes: 10228
#include <stdio.h>
#include <string.h>
int main()
{
    int n;  scanf("%d", &n);
    char str[100005];
    scanf("%s", str);
    int count = 0;
    for(int i=0; i<n; i++)
    {
        while(str[i]==str[i+1])
            i++;
        count++;
    }
    printf("%d\n", count);
    return 0;
}

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

using namespace std; 

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef vector<PII> VPII;
typedef long long LL;
typedef vector<LL> VL;
typedef vector<VL> VVL;
typedef pair<LL, LL> PLL;
typedef vector<PLL> VPLL;
typedef priority_queue<int> PQ_DESC;
typedef priority_queue<int, vector<int>, greater<int>> PQ_ASC;
typedef priority_queue<PII> PQ_DESC_PII;
typedef priority_queue<PII, vector<PII>, greater<PII>> PQ_ASC_PII;

#define ALL(c) (c).begin(),(c).end()
#define PB push_back
#define MP make_pair
#define SORT_ASC(c) sort(ALL(c))
//#define SORT_DESC(c) sort(ALL(c), greater<typeof(*((c).begin()))>())
#define SORT_DESC(c) sort((c).rbegin(),(c).rend())
#define REV(c) reverse((c).begin(), (c).end())
#define SIZE(a) int((a).size())

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define ROF(i,a,b) for(int i=(b-1);i>=(a);--i)
#define REP(i,n) FOR(i,0,n)
#define PER(i,n) ROF(i,0,n)

const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int LARGE_INT = 1e9+100;
const int INF = 2e9+100;
const LL INF_LL = (LL)INF * 300 * 300;
const int MOD = 1e9+7;

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

LL modpow(LL a, LL n) {
    LL res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % MOD;
        a = a * a % MOD;
        n >>= 1;
    }
    return res;
}

void Main()
{
    int x,y,z,k;cin>>x>>y>>z>>k;

    VL a(x);
    VL b(y);
    VL c(z);

    REP(i,x){
        cin>>a[i];
    }
    REP(i,y){
        cin>>b[i];
    }
    REP(i,z){
        cin>>c[i];
    }

    VL ab;
    REP(i,x){
        REP(j,y){
            ab.PB(a[i]+b[j]);
        }
    }
    SORT_DESC(ab);

    VI index(z,0);
    REP(i,k){
        LL result = 0;
        LL cake = 0;
        REP(j,z){
            LL point = c[j] + ab[index[j]];
            if(point > result){
                result = point;
                cake = j;
            }
        }
        cout<<result<<endl;
        index[cake] ++ ;
    }

	return;
}

int main()
{
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	Main();
    return 0;
}

Measured memory_bytes: 10608
from sys import stdin
from itertools import combinations
from math import factorial

n = int(stdin.readline().rstrip())
li = [stdin.readline().rstrip() for _ in range(n)]

lin = [0]*5

for i in range(len(li)):
    if li[i][0] == "M":
        lin[0] += 1
    elif li[i][0] == "A":
        lin[1] += 1
    elif li[i][0] == "R":
        lin[2] += 1
    elif li[i][0] == "C":
        lin[3] += 1
    elif li[i][0] == "H":
        lin[4] += 1
        
lis = list(combinations(lin, 3))

point = 0
for i in lis:
    point += i[0]*i[1]*i[2]

print(point)

Measured memory_bytes: 9792
#以下、他の人のコードを参照
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
ans=0
for i in range(n):
    if b[i] > a[i]:
        b[i] -= a[i]
        ans += a[i]
        if b[i] > a[i+1]:
            ans += a[i+1]
            a[i+1] = 0
        else:
            ans += b[i]
            a[i+1] -= b[i]
    else:
        ans += b[i]
        b[i]=0
print(ans)


Measured memory_bytes: 18476
import java.io.*;
import java.util.*;
 
public class Main {
	public static void main(String[] args) {
		long n = 0;
		long[] as = null;
		
		try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {
			n = Long.parseLong(br.readLine());
			
			as = new long[(int)n];
			int i = 0;
			for (String str : br.readLine().split(" ")) {
				as[i++] = Long.parseLong(str);
			}
		} catch (IOException e) {
			return;
		}
		
		int cnt = 0;
		for (int i = 1; i < n; i++) {
			if (as[i] == as[i - 1]) {
				cnt++;
				i++;
			}
		}
		
		System.out.println(cnt);
	}
}


Measured memory_bytes: 21204
#include<bits/stdc++.h>
using namespace std;
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n,m,a;
  while(cin>>n>>m>>a,n){
    int d[1001][101]={};
    while(m--){
      int h,p,q; cin>>h>>p>>q;
      d[h][p]=q,d[h][q]=p;
    }
    for(int i=1000;i>=0;--i)
      if(d[i][a]) a=d[i][a];
    cout<<a<<endl;
  }
  return 0;
}

Measured memory_bytes: 3412
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner scan = new Scanner(System.in);
		
		int k = scan.nextInt();
		String str = scan.next();
		
		if(str.length() <= k) {
			System.out.println(str);
		}else {
			System.out.println(str.substring(0, k)+"...");
		}

	}

}

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

int main(){
  int n;
  cin >> n;
  int a[n];
  for(int i = 0; i < n; i++){
    cin >> a[i];
  }
  
  int ans = 0;
  for(int i = 0; i < n; i++){
    if(a[a[i] - 1] == i + 1)ans++;
  }
  cout << ans / 2 << endl;
} 

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

using namespace std;

int main()
{

    int N;

    cin >> N;

    vector<long> A(N);

    for(int i = 0; i < N; i++){
	cin >> A.at(i);
    }

    vector<int> B(N);
    for(int i = 0; i < N; i++){
	B.at(i) = A.at(i) - (i+1);
    }
    
    sort(B.begin(), B.end());
    int b;
    if(N % 2 == 1){
	// 0 1 2 3 4
	b = B.at((N-1)/2);
    }else{
	// 0 1 2 3 4 5
	b = (B.at(N/2) + B.at(N/2-1)) / 2;
    }

    long ans = 0;
    for(int i = 0; i < N; i++){
	ans += abs(A.at(i) - (b + (i+1)));
    }
    
    cout << ans << endl;
}


Measured memory_bytes: 2560
#include <algorithm>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <string>
#include <vector>

using namespace std;

typedef long long ll;
constexpr ll MOD = 1000000007;

// struct UnionFind {
//     vector<int> par;
    
//     UnionFind(int N): par(N) {
//         for (int i=0;i<N;i++) par[i] = i;
//     }

//     int root(int x) {
//         if (par[x] == x) return x;
//         else return par[x] = root(par[x]);
//     }

//     void unite(int x, int y) {
//         int rx = root(x);
//         int ry = root(y);
//         if (rx == ry) return;
//         par[rx] = ry;
//     }

//     bool same(int x, int y) {
//         int rx = root(x);
//         int ry = root(y);
//         return rx == ry;
//     }
// };

// ll gcd(ll a, ll b) {
//     if (b == 0) return a;
//     return gcd(b,a%b);
// }

int main(void) {
    string S;
    cin >> S;
    int w = 0, l = 0;
    for (int i=0;i<S.size();i++) {
        if (S[i] == 'o') w++;
        else l++;
    }
    if (l >= 8) cout << "NO" << endl;
    else cout << "YES" << endl;


    return 0;
}

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

#define name ""
#define ini freopen(name".inp","r",stdin); freopen(name".out","w",stdout)
#define foe(it,c) for (__typeof(c.begin()) it = c.begin(); it != c.end(); it++)
#define long long long 
#define db double 
#define pii pair <int, int>
#define pll pair <long, long>
#define all(c) c.begin(), c.end()
#define fastio ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)

const int INF = 1e9+7;
const int MOD = 1e9+7;
const int dx[4] = {0,0,-1,1};
const int dy[4] = {-1,1,0,0};

const int N = 2e5+2;
int n, m;
bool mark[N], x[N];
pii b[N];
vector <pii> a[N];
vector <int> memo;

bool dfs(int u){
  mark[u] = true;
  bool cur = x[u];
  for (pii x : a[u]){
    int p = x.second; int v = x.first;
    if (mark[v]) continue;
    if (dfs(v)){
      memo.push_back(p);
      cur ^= 1;   
    }
  }  
  return cur;
}

int main()
{
  fastio;
  cin >> n >> m;
  for (int i = 1; i <= n; i++){
    cin >> b[i].first >> b[i].second;
  }
  sort(b + 1, b + 1 + n);
  for (int i = 1; i <= m; i++){
    int l, r; cin >> l >> r;
    l = lower_bound(b + 1, b + 1 + n, pii(l, 0)) - b;
    r = upper_bound(b + 1, b + 1 + n, pii(r, 1)) - b;
    if (l != r){
      a[l].push_back(pii(r, i)); 
      a[r].push_back(pii(l, i));
    }
  }
  for (int i = 1; i < n; i++) x[i + 1] = b[i].second ^ b[i + 1].second;
  x[n + 1] = b[n].second; x[1] = b[1].second;
  for (int i = 1; i <= n + 1; i++){
    if (!mark[i]){
      if (dfs(i)) return cout << -1, 0;
    }
  }
  sort(all(memo));
  cout << memo.size() << '\n';
  for (int x : memo) cout << x << ' ';
  return 0;
}

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

#define INF 1e9
#define llINF 1e18
#define MOD 1000000007
#define pb push_back
#define mp make_pair 
#define F first
#define S second
#define ll long long
#define ALL(a) (a).begin(),(a).end()
#define Yes(hoge) cout<<((hoge)?"Yes":"No")<<endl;
#define YES(hoge) cout<<((hoge)?"YES":"NO")<<endl;
using namespace std;
int main(){
  int n;cin>>n;
  vector<pair<int,int> >x(n);
  vector<int>num(n);
  bool used[n]={};
  vector<int>ans;
  ll sum=0;
  for(int i=0;i<n;i++){
    int a;cin>>a;
    x[i]=mp(a,i);
    num[i]=i;
    sum+=i;
  }
  sort(ALL(x));
  bool flag=true;
  for(int i=0;i<n;i++){
    //cout<<sum<<endl;
    //cout<<x[i].F<<" "<<i<<" "<<x[i].S<<endl;
    if((sum+ans.size())>=(x[i].F-1)){
      int cnt=i;
      int del=(x[i].F-ans.size()-1);
      //cout<<del<<endl;
      // cout<<x[cnt].S<<endl;
      while(del>0){
	if(num[x[cnt].S]>0){
	  num[x[cnt].S]--;
	  del--;
	  sum--;
	  ans.pb(x[cnt].S+1);
	}else{
	  cnt++;
	}
	if(cnt==n)break;
      }
      cnt=0;
      while(del>0){
	if(num[x[cnt].S]>0){
	  num[x[cnt].S]--;
	  del--;
	  sum--;
	  ans.pb(x[cnt].S+1);
	}else{
	  cnt++;
	}
	if(cnt==i){flag=false;}
      }
      if(del==0&&num[x[i].S]>0)flag=false;
      ans.pb(x[i].S+1);
      sum+=n-x[i].S-1;
      num[x[i].S]=n-x[i].S-1;
    }else{
      flag=false;
    }
    /*
    for(int ii=0;ii<ans.size();ii++){
      cout<<ans[ii];
      if(ii!=ans.size()-1)
	cout<<" ";
    }
    cout<<endl;*/
    //  cout<<flag<<endl;
  }
   for(int i=0;i<n;i++){
    int aaa=num[i];
    for(int j=0;j<aaa;j++){
      ans.pb(i+1);
    }
    }
  if(flag){
    cout<<"Yes"<<endl;
    for(int i=0;i<ans.size();i++){
      cout<<ans[i];
      if(i!=ans.size()-1)
	cout<<" ";
    }
    cout<<endl;
  }else{
    cout<<"No"<<endl;
  }
  return 0;
}


Measured memory_bytes: 2296
#include<algorithm>
#include <iostream>
#include<cstdio>
#include<cmath>
#include<iomanip>
#include<string>
#include<cstdlib>
#include<ctime>
#include<vector>
using namespace std;

int main(){

    int a,b;
    cin>>a>>b;

    if(a/10<1&&b/10<1){
        cout<<a*b<<endl;
    }else{
        cout<<-1<<endl;
    }

return 0;
}

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

int n, cnt[101];
vector<pair<int, int>> ans;

int main() {
  cin.tie(0); ios_base::sync_with_stdio(false);
  while(cin >> n) ++cnt[n];
  for(int i = 1; i <= 100; ++i) if(cnt[i]) ans.emplace_back(cnt[i], -i);
  sort(ans.rbegin(), ans.rend());

  for(int i = 0; ans[i].first == ans[0].first; ++i) cout << -ans[i].second << '\n';
  return 0;
}


Measured memory_bytes: 3032
#include <stdio.h>
#include <string.h>
#define LEN 100005
int head,tail,n;
typedef struct pp{//Pはpp型の変数
  char name[100];
  int time;
}P;
P Q[LEN];
void enqueue(P);//キューの末尾に要素xを追加する
P dequeue(void);//キューの先頭から要素を取り出す
int isEmpty(void);//空か確かめる
int isFull(void);//満杯か確かめる
int min(int,int);
int main(){
  int q,ctime=0,c,i;
  P u;
  scanf("%d %d",&n,&q);
  for(i=1;i<=n;i++)
	scanf("%s%d",Q[i].name,&Q[i].time);
  head=1; tail=n+1;
  while(head!=tail){
	  u=dequeue();//取り出す
	  c=min(q,u.time);
	  u.time-=c;
	  ctime+=c;
	  if(u.time>0)
		enqueue(u);
	  else
		printf("%s %d\n",u.name,ctime);
  }
  return 0;
}
void enqueue(P x){
   Q[tail]=x;
  tail = (tail+1)%LEN;
}  
P dequeue(void){
  P x=Q[head];
  head=(head+1)%LEN;
  return x;
} 
int min(int a,int b){
  return a<b?a:b;
}



Measured memory_bytes: 11872
import java.util.Scanner;

public class Main{
 public static void main(String[] args){
   Scanner sc = new Scanner(System.in);
   int A = sc.nextInt();
   int B = sc.nextInt();
   int C = sc.nextInt();

   int tenp = 0;
   int tenp2 = 0;

   tenp = A;
   tenp2 = B;
   A = C;
   B = tenp;
   C = tenp2;

   System.out.print(A + " ");
   System.out.print(B+ " ");
   System.out.print(C+ " ");
   }
}




Measured memory_bytes: 21844
/*
　　　  ∧＿∧　やあ
　　 （´・ω・｀)　　　　　/　　　　　ようこそ、バーボンハウスへ。
　　 ／∇y:::::＼　　　 [￣]　　　　　このテキーラはサービスだから、まず飲んで落ち着いて欲しい。
　　 |:⊃:|:::::|　　　|──|
￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣|　うん、「また」なんだ。済まない。
￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣|￣　  仏の顔もって言うしね、謝って許してもらおうとも思っていない。
￣￣￣￣￣￣￣￣￣￣￣￣￣￣／|
　　　　∇　∇　∇　∇　　　／.／|　　　でも、この提出を見たとき、君は、きっと言葉では言い表せない
　　　　┴　┴　┴　┴　／ ／　  |　　　「ときめき」みたいなものを感じてくれたと思う。
￣￣￣￣￣￣￣￣￣￣|／　　  |　　　殺伐としたコンテストの中で、そういう気持ちを忘れないで欲しい
￣￣￣￣￣￣￣￣￣￣　　　　 |　　　そう思って、この提出を投げたんだ。
　　　(⊆⊇)　(⊆⊇)　(⊆⊇)　　|
　    ||　　 ||　　||　　|　　　 じゃあ、判定を聞こうか。
　　.／|＼　／|＼ ／|＼
*/

#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <array>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstdio>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <vector>
using namespace std;
#define fst first
#define snd second
#define mp make_pair
#define ALL(obj) (obj).begin(),(obj).end()
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i = (b-1);i>=a;i--)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n) 
#define SIZE(x) ((int)(x).size())
#define debug(x) cerr << #x << " -> " << x << " (line:" << __LINE__ << ")" << '\n';
#define debugpair(x, y) cerr << "(" << #x << ", " << #y << ") -> (" << x << ", " << y << ") (line:" << __LINE__ << ")" << '\n';
typedef long long lint;
typedef pair<int, int> pint;
typedef pair<lint, lint> plint;
typedef vector<lint> vec;
typedef vector<vector<lint>> matrix;
typedef priority_queue<lint> p_que;
typedef priority_queue<lint, vector<lint>, greater<lint>> p_que_rev;
const lint INF = INT_MAX;
const lint LINF = LLONG_MAX;
const lint MOD = 1000000000 + 7;
const double EPS = 1e-9;
const double PI = acos(-1);
const int di[]{0, -1, 0, 1, -1, -1, 1, 1};
const int dj[]{1, 0, -1, 0, 1, -1, -1, 1};

lint gcd(lint a, lint b) {
    lint r;
    while (b != 0) {
        r = a % b;
        a = b; 
        b = r;
    }
    return a;
}

lint lcm(lint a, lint b) {
    return (a / gcd(a, b)) * b;
}

lint power(lint x, lint n, lint mod = MOD) {
    lint ret = 1;
    while(n > 0) {
        if(n & 1){
            (ret *= x) %= mod;
        }
        (x *= x) %= mod;
        n >>= 1;
    }
    return ret;
}

vector<lint> make_power(int n, lint base){
    lint num = 1;
    vector<lint> ret;
    for (int i=0; i<=n; ++i){
        ret.push_back(num);
        num *= base;
    }
    return ret;
}

int main()
{
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    int n;
    cin >> n;
    vector<int> a(n);
    REP(i, n){
        cin >> a[i];
    }
    sort(ALL(a));
    int ans = 0;
    REP(i, n-1){
        ans += a[i+1] - a[i];
    }
    cout << ans << endl;
}

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

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

    vector<int> ans(N + 1, 0);
    for (int i = N; i >= 1; i--) {
        int cnt = 0;
        for (int k = 2; i * k <= N; k++) {
            cnt += ans[k * i];
        }
        if (cnt % 2 != a[i]) {
            ans[i] = 1;
        }
    }

    cout << accumulate(ans.begin(), ans.end(), 0) << endl;
    for (int i = 1; i <= N; i++) {
        if (ans[i] == 1) {
            cout << i << " ";
        }
    }
    cout << endl;
}


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

const int maxn = 1000005;
int n, lmn[maxn], ladd[maxn];
string s;
vector <int> pl, mi;

bool cmp(int x, int y){
    if (lmn[x] != lmn[y]) return lmn[x] > lmn[y];
    else return ladd[x] > ladd[y];
}

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cin >> n;
    for (int i = 0; i < n; i++){
        cin >> s;
        int mn = 0, tot = 0;
        for (int j = 0; j < s.length(); j++){
            if (s[j] == '(') tot++;
            else tot--;
            mn = min(mn, tot);
        }
        lmn[i] = mn;
        ladd[i] = tot;
        if (tot >= 0) pl.push_back(i);
        else{
            mi.push_back(i);
            int mn = 0, tot = 0;
            for (int j = s.length()-1; j >= 0; j--){
                if (s[j] == ')') tot++;
                else tot--;
                mn = min(mn, tot);
            }
            lmn[i] = mn;
            ladd[i] = tot;
        }
    }
    sort(pl.begin(), pl.end(), cmp);
    sort(mi.begin(), mi.end(), cmp);
    int tot = 0;
    bool flag = true;
    for (int i:pl){
        if (tot + lmn[i] < 0) flag = false;
        tot += ladd[i];
        if (tot < 0) flag = false;
    }
    int tot2 = 0;
    for (int i:mi){
        if (tot2 + lmn[i] < 0) flag = false;
        tot2 += ladd[i];
        if (tot2 < 0) flag = false;
    }
    if (tot != tot2) flag = false;
    if (!flag) cout << "No\n";
    else cout << "Yes\n";
}


Measured memory_bytes: 15164
#include <cmath>
#include <cstdio>
#include <cstring>
#include <vector>
#include <algorithm>

using namespace std;

const int maxv = 10000+16;
int V, E;

typedef pair<double, double> p;
p ver[maxv];
struct edge {
	int u, v;
	double cost;
	
	edge(int x, int y) {
		u = x, v = y;

		double x1 = ver[x].first, y1 = ver[x].second;
		double x2 = ver[y].first, y2 = ver[y].second;

		cost = sqrt( pow(y2-y1, 2) + pow(x2-x1, 2) );
	}
};

bool cmp(const edge& e1, const edge& e2) {
	return e1.cost > e2.cost;
}

vector<edge> g;
double res = 0;
void read_in() {
	scanf("%d%d", &V, &E);

	int u, v;
	double x, y;

	for(int i = 0; i < V; i++) {
		scanf("%lf%lf", &x, &y);

		ver[i] = p(x, y);
	}

	for(int i = 0; i < E; i++) {
		scanf("%d%d", &u, &v);
		//printf("\n!!%d %d\n", u-1, v-1);
		g.push_back(edge(--u, --v));
		res += g[i].cost;
	}
}

int Rank[maxv];
int par[maxv];
 
int find(int x) {
	if (par[x] == x) return x;
	else return par[x] = find(par[x]);
}

bool same(int x, int y) {
	//printf("same 函数内 %d %d\n", x, y);
	return find(x) == find(y);
}

void unite(int x, int y) {
	x = find(x);
	y = find(y);

	if(x == y) return ;
	if(Rank[x] < Rank[y]) {
		par[x] = y;
	} else {
		par[y] = x;
		if(Rank[x] == Rank[y])
			Rank[x] ++;
	}
}

void init(int n) {
	for(int i = 0; i < n; i++)
		Rank[i] = 0, par[i] = i;
}

void kruskal() {
	//set<int> s;
	sort(g.begin(), g.end(), cmp);
	//puts("!");
	init(V);
	//puts("!");
	for(int i = 0; i < g.size(); i++) {
		if( !same(g[i].u, g[i].v) ) {
			//printf("same 函数结束\n");
			res -= g[i].cost;
			//puts("!");
			unite(g[i].u, g[i].v);
			//puts("!");
		}
	}
}

int main() {
	read_in();
	kruskal();

	printf("%.3lf\n", res);
	return 0;
}



Measured memory_bytes: 3348
#include<iostream>
#include<string.h>
using namespace std;

int main(){
  string a;
  cin >> a;
  int cnt, res;
  cnt=0;
  res=0;
  for(int i=0;i<a.length();i++){
  	if(a[i] == 'A' | a[i] == 'T' |a[i] == 'C' |a[i] == 'G' ){
    	cnt++;
    }else{
    	res = max(res, cnt);
      	cnt = 0;
    }
  }
  res = max(res, cnt);
  cout << res <<endl;
}

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

int main()
{
    string s1,s2;
    cin>>s1>>s2;
    int cnt= 0 ;
    for(int i = 0 ;i<3;i++)
    {
        if(s1[i]==s2[i])
        {
            cnt++;
        }
    }
    cout<<cnt<<endl;
    return 0;
}

Measured memory_bytes: 256
N = int(input())
x = [[0] * (N-1) for _ in range(N)]
y = [[0] * (N-1) for _ in range(N)]
A = [0] * N
for i in range(N):
  A[i] = int(input())
  for j in range(A[i]):
    x[i][j], y[i][j] = list(map(int, input().split()))
n = 2 ** N
Flag = 0
ans = 0
while(n < 2 ** (N+1)):
  Flag = 0
  for i in range(N):
    if(int(bin(n)[i + 3]) == 1):
      for j in range(A[i]):
        if(y[i][j] != int(bin(n)[x[i][j] + 2])):
          Flag = 1
          break
    if(Flag == 1):
      break
  else:
    ans = max(ans, sum(list(map(int,bin(n)[3:]))))
  n += 1
print(ans)

Measured memory_bytes: 75136
#include<stdio.h>
#include<string.h>
int main()
{
				int n,i,l;
				char s[100000],x;
				scanf("%d %s",&n,s);
				l=strlen(s);
				
				for(i=0;i<l;i++)
				{
							x=	s[i]+n;
								
								if(x>90){x-=26;}
						
								printf("%c",x);
				}
				
}

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

int main(){
  int N, T, A;
  cin >> N >> T >> A;
  double t = 1e9;
  int ans = -1;
  for(int i = 0; i < N; ++i){
    int h;
    cin >> h;
    if(abs(T-0.006*h-A) < t){
      ans = i+1;
      t = abs(T-0.006*h-A);
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<cmath>
#pragma GCC optimize("Ofast")
using namespace std;
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
typedef long long ll;
#define rep(i,n) for(ll i=0, i##_len=(n); i<i##_len; ++i)
#define REP(i,num,n) for(ll i=num, i##_len=(n); i<i##_len; ++i)
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
#define print(x) cout << (x) << endl;
#define pb push_back
#define mp make_pair
#define sz(x) int(x.size())
 
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
const int INF = 1e9;
const ll LLINF = 1e16;

template<typename T>
vector<T> make_v(size_t a){return vector<T>(a);}

template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
  return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}

template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value!=0>::type
fill_v(U &u,const V... v){u=U(v...);}

template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value==0>::type
fill_v(U &u,const V... v){
  for(auto &e:u) fill_v<T>(e,v...);
}
 
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, -1, 1, -1};



int main(void){
    cout.tie(0);
    cin.tie(0);
    ios::sync_with_stdio(false);
    //cout<<fixed<<setprecision(10);
    ll n;
    cin >> n;

    rep(i,50000) {
      if((int)(i * 1.08) == n) {
        print(i);
        return 0;
      }
    }
    print(":(");



}


Measured memory_bytes: 256
import math
N, M, K = map(int, input().split())
sosu = 10 ** 9 + 7

def P(n, r):
    return math.factorial(n)//math.factorial(n-r)

def C(n, r):
    return P(n, r)//math.factorial(r)


dis = M * M * N * N * (N+1) // 2 % sosu
dis = dis - M * M * N * (N+1) * ( 2* N + 1) // 6 % sosu
dis = dis + N * N * M * M * (M+1) //2 % sosu
dis = dis - N * N * M * (M+1) * (2*M + 1) // 6 % sosu

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

mod = sosu #出力の制限
N = N * M
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル

for i in range( 2, N + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )


if K >= 3:
    dis = dis * cmb(N-2, K-2, mod) % sosu
if dis >= 0:
    print(dis)
else:
    print(dis + sosu)

Measured memory_bytes: 26888
// ABC157A - Duplex Printing

#include <bits/stdc++.h>
using namespace std;

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

	int answer;

	if (N % 2 == 1) {
		answer  = N / 2 + 1;
	} else {
		answer  = N / 2;
	}

	cout << answer;
}


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[] a = new int[n];
		int[] b = new int[n];
		int[] c = new int[n-1];
		for(int i = 0; i < n; i++) {
			a[i] = sc.nextInt()-1;
		}
		for(int i = 0; i < n; i++) {
			b[i] = sc.nextInt();
		}
		for(int i = 0; i < n-1; i++) {
			c[i] = sc.nextInt();
		}
		int d = b[a[0]];
		for(int i = 1; i < n; i++) {
			d += b[a[i]];
			if(a[i] - a[i-1] == 1) d += c[a[i-1]];
		}
		System.out.println(d);

		sc.close();

	}

}

Measured memory_bytes: 22228
#include<stdio.h>
int main(){
  int n,nyu,po,nm,pm,summ,i,kari1,kari2,karir;
  int ryokin[365];
  
  scanf("%d",&n);

  for(i=0;i<n;i++){
    scanf("%d %d %d %d",&nyu,&po,&nm,&pm);
    summ=nm+pm;

    if(nm >= 5 || pm>=2){
      
      if(nm>=5 && pm>=2){
	ryokin[i]=(nyu*nm + po*pm)*0.8;
      }else{
	ryokin[i]=(nyu*nm + po*pm);
      }
      
    }else{
	ryokin[i]=(nyu*nm + po*pm);
    }

    
    kari1=(nyu*nm+po*2)*0.8;
    kari2=(nyu*5+po*pm)*0.8;
   
    
    
    if(nm >=5 && pm<2){
      if(ryokin[i]>kari1){
       ryokin[i]=kari1;
      }
    }
      
    if(nm <5 && pm>=2){
      if(ryokin[i]>kari2){
	ryokin[i]=kari2;
      } 
    }
  }
  
  for(i=0;i<n;i++){
    printf("%d\n",ryokin[i]);
  }
  
  return 0;
  
}

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

int main() {
    string S;
    cin >> S;
    bool a = true;
    int n = S.length();
    
    for (int i = 0; i < n; i += 2){
        if (S[i] != 'R' && S[i] != 'U' && S[i] != 'D'){
            a = false;
            break;
        }

        if (i + 1 < n && S[i+1] != 'L' && S[i+1] != 'U' && S[i+1] != 'D'){
            a = false;
            break;
        }


    }

    if (a){
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
}


Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>
typedef long long ll;
int main(void){
    ll n,p,ans=1;
    scanf("%lld%lld",&n,&p);
    for (ll i=1; i*i<=p; i++){
        if (p%i==0){
            if ((ll)p%(ll)(pow(i,n))==0){
                ans=ans>i?ans:i;
            }
            if ((ll)p%(ll)(pow(p/i,n))==0){
                ans=ans>(p/i)?ans:p/i;
            }
        }
    }
    printf("%lld\n",ans);
	return 0 ;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#include <cstring>
using namespace std;
int a[4];
int main()
{
   string s1,s2;
   cin>>s1>>s2;

   int n = s1.size();
   for(int i = 0;i<n;i++)
   {
        if(s1 == s2) return cout<<"Yes"<<endl,0;
        s1 = s1[n-1] + s1;
        s1.pop_back();
   }
   cout<<"No"<<endl;
   return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
ios_base::sync_with_stdio(false);
	cin.tie(NULL);
#ifndef ONLINE_JUDGE
	//freopen("input.txt","r",stdin);
#endif

	long double h,n;
	cin>>h>>n;
	cout<<ceil(h/n)<<endl;
	return 0;
}

Measured memory_bytes: 3784
#include<bits/stdc++.h>
using namespace std;
 
int L[200];

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N, ans = 0;
    cin >> N;
    for(int n=0; n<2*N; n++){
        cin >> L[n];
    }
    sort(L, L + 2 * N);
    for(int n=0; n<N; n++){
        ans += L[2*n];
    }
    cout << ans << "\n";
    return 0;
}

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

const int MAX = 1001;
const int MAX2 = 1000000;
int main() {
	int N, K;
	static int64_t a[MAX]; // 累積和取る
	cin >> N >> K;
	a[0] = 0;
	for (int i = 1;i <= N;++ i) cin >> a[i];
	for (int i = 1;i <= N;++ i) a[i] += a[i - 1];
	static int64_t sum[MAX2]; // 全ての区間和
	for (int i = 0, count = 0;i < N;++ i) {
		for (int j = i + 1;j <= N;++ j, ++ count) {
			sum[count] = a[j] - a[i];
		}
	}
	// この時点でsum[0]からsum[size-1]に全てのパターンがある
	int64_t ans = 0, size = N * (N + 1) >> 1;
	for (int64_t i = (int64_t)1 << 50;i > 0;i >>= 1) {
		int count = 0;
		for (int j = 0;j < size;++ j) {
			if ((sum[j] & i) > 0) ++ count;
		}
		if (count >= K) { // 採用できる
			ans |= i;
			for (int j = 0;j < size;++ j) {
				if ((sum[j] & i) == 0) sum[j] = 0; // 今後絶対に採用しない奴(=今回採用していない奴)を消す
			}
		}
	}
	cout << ans;
	return 0;
}
/*
31536000のコメント解説欄
ここテンプレで用意してるから、A問題とかだとこの先空欄の危険あり
また、コンテスト後に https://31536000.hatenablog.com/ で解説していると思うので、良かったら読んでねー

まず、制約よりN^2全列挙できる……できる！？
できるので、次にどれを選ぶか決めていく
まず、bitwise andの最上位桁を考えると、これは上のbitから見ていって最初に存在がK個超えたもの
次に、その次のbitは最初の条件を満たしている中で上から見ていって最初に存在がK個超えたもの……
O(KlogNa)≦40,000,000、終わる
*/

Measured memory_bytes: 4352
n,m=map(int,input().split())
a=[list(input())for i in range(n)]
b=[list(input())for i in range(m)]
def match(x,y):
    for i in range(m):
        for j in range(m):
            if a[x+i][y+j]!=b[i][j]:
                return False
    return True
for i in range(n-m+1):
    for j in range(n-m+1):
        judge=False
        if a[i][j]==b[0][0]:
            if match(i,j):
                judge=True
            if judge:
                print("Yes")
                exit()
print("No")

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

bool mask(int bit, int maskVec) {
	return (1 << bit) & maskVec;
}
int main() {
	int h, w, k;
	char ch;
	cin>>h>>w>>k;
	vector<vector<char> > arr;
	for (int i = 0; i < h; i++) {
		vector<char> col;
		for (int j = 0; j < w; j++) {
			cin>>ch;
			col.push_back(ch);
		}
		arr.push_back(col);
	}
	int ans = 0;
	for (int rowMask = 0; rowMask < pow(2, h); rowMask++) {
		for (int colMask = 0; colMask < pow(2, w); colMask++) {
			int cnt = 0;
			for (int i = 0; i < h; i++) {
				for (int j = 0; j < w; j++) {
					if (!mask(i, rowMask) && !mask(j, colMask) && arr[i][j] == '#') {
						cnt++;
					}
				}
			}
			if (cnt == k) {
				ans++;
			}
		}
	}
	cout<<ans<<endl;
}

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

int main() {
  string S; cin >> S;
  char S_head = S.at(0);
  bool ok = false;
  if (S_head == 'A') {
    int count_C = 0;
    for (int i = 2; i <= S.length()-2; i++) {
      if (S.at(i) == 'C') {
        count_C++;
      }
    }
    if (count_C == 1) {
      int count_small_alpha = 0;
      for (int i = 0; i < S.length(); i++) {
        if (S.at(i) >= 'a' and S.at(i) <= 'z') {
          count_small_alpha++;
        }
      }
      if (count_small_alpha == S.length()-2) {
        ok = true;
      }
    }
  }
  cout << (ok?"AC":"WA") << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
#define double long double
using namespace std;
const int MOD =  1000000007;
const int INF = 1e11;
using Graph = vector<vector<int>>;

signed main(){
  int N, M;
  cin >> N >> M;
  vector<int> A(N);
  for( int i = 0; i < N; i++ ) cin >> A[i];
  sort(A.begin(), A.end());

  vector<int> Asum(N+1);
  for( int i = 1; i <= N; i++ ) Asum[i] = Asum[i-1]+A[i-1];

  int l = 0;
  int r = INF;
  //1回の握手でmid以上の幸福度が得られる回数はM回未満か
  while( r-l > 1 ){
    int mid = (r+l)/2;
    int cnt = 0;
    for( int i = 0; i < N; i++ ){
      auto now = lower_bound(A.begin(), A.end(), mid-A[i]) - A.begin();
      cnt += (N-now);
    }
    if( cnt < M ) r = mid;
    else l = mid;
  }

  int ans = 0;
  for( int i = 0; i < N; i++ ){
    auto a = upper_bound(A.begin(), A.end(), l-A[i])-A.begin();
    int now = N-a;
    ans += now*A[i]+(Asum[N]-Asum[a]);
    M -= now;
  }
  ans += M*l;
  cout << ans << endl;


}

Measured memory_bytes: 4784
#include <algorithm>
#include <climits>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <vector>

#define int long long int
constexpr int INF = std::numeric_limits<int>::max();
constexpr int NINF = std::numeric_limits<int>::min();
using namespace std;

vector<int> to[10000+1];
vector<bool> visited(10000+1);

void solve() {
  int N;
  cin >> N;

  for (int i = 0; i < N-1; i++) {
    int a, b; cin >> a >> b;
    to[a].push_back(b);
    to[b].push_back(a);
  }

  vector<int> C(N);
  for (int &c:C) {
    cin >> c;
  }

  sort(C.begin(), C.end());
  reverse(C.begin(), C.end());

  int M = 0;
  for (int i = 1; i < C.size(); i++ ) {
    M += C[i];
  }

  queue<int> queue;
  queue.push(1);

  int ci = 0;

  vector<int> ans(N+1);
  while (!queue.empty()) {
    int i = queue.front();
    visited[i] = true;
    queue.pop();

    ans[i] = C[ci++];
    for (int t:to[i]) {
      if (!visited[t]) {
        queue.push(t);
      }
    }
  }

  cout << M << endl;
  for (int i = 1; i <= N; i++) {
    cout << ans[i] << " ";
  }
  cout << endl;

}

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


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

// #define int long long
#define rep(i, n) for (int i = (int)(0); i < (int)(n); ++i)
#define reps(i, n) for (int i = (int)(1); i <= (int)(n); ++i)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rreps(i, n) for (int i = ((int)(n)); i > 0; i--)
#define irep(i, m, n) for (int i = (int)(m); i < (int)(n); ++i)
#define ireps(i, m, n) for (int i = (int)(m); i <= (int)(n); ++i)
#define SORT(v, n) sort(v, v + n);
#define REVERSE(v, n) reverse(v, v+n);
#define vsort(v) sort(v.begin(), v.end());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
#define PI (acos(-1))
#define FILL(v, n, x) fill(v, v + n, x);
#define sz(x) int(x.size())

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vs = vector<string>;
using vpll = vector<pair<ll, ll>>;

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

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



signed main()
{
  cin.tie( 0 ); ios::sync_with_stdio( false );
  string s; cin>>s;
  vll a(4);
  rep(i,4){
    a[i]=s[i]-'0';
  }
  for(ll bit=0; bit<(1<<3); bit++){
    ll sum=a[0];
    rep(i,3){
      if(bit&(1<<i)){
        sum+=a[i+1];
      }else{
        sum-=a[i+1];
      }
    }
    if(sum==7){
      cout<<a[0];
      rep(i,3){
        if(bit&(1<<i)){
          cout<<"+"<<a[i+1];
        }else{
          cout<<"-"<<a[i+1];
        }
      }
      cout<<"=7"<<endl;
      return 0;
    }
  }
}

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

using namespace std;

using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int ddx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll MOD = 1000000007;
const ll INF = 1000000000000000000L;
#ifdef __DEBUG

/**
 * For DEBUG
 * https://github.com/ta7uw/cpp-pyprint
 */
#include "cpp-pyprint/pyprint.h"

#endif

void solve() {
    ll A;
    string B;
    cin >> A >> B;
    ll ans = 0;
    ll mul = 100;
    rep(i, B.size()) {
        if (i == 1) continue;
        ans += A * (B[i] - '0') * mul;
        mul /= 10;
    }
    cout << ans / 100 << '\n';
}

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


Measured memory_bytes: 3656
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <limits.h>
#include <math.h>

int main(void) {
	int n;
	int a;
	long long ans = 0;
	int flag = 0;
	int min = INT_MAX,temp;
	int fu_cnt = 0;

	scanf("%d", &n);
	for (int i = 0; i < n; i++) {
		scanf("%d", &a);
		if (a < 0)fu_cnt++;
		else if (a == 0)flag = 1;
		temp = abs(a);
		if (min > temp)min = temp;
		ans += temp;
	}
	if (flag || fu_cnt % 2 == 0)printf("%lld", ans);
	else printf("%lld", ans - 2 * min);
	
	return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#define fastio (cin.tie(0), cout.tie(0), ios::sync_with_stdio(false))
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define precise(i) fixed << setprecision(i)
using lint = long;
using llint = long long;
using namespace std;

int main() {
    fastio;
    int r, g;
    cin >> r >> g;
    cout << 2 * g - r << endl;
}

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

int main()
{
  long n, a;
  scanf("%ld", &n);
  
  long diff, sum = 0, beforeA = 0;
  for (int i = 0; i < n; i++) {
    scanf("%d", &a);
    if (i > 0) {
      diff = beforeA - a;
      if (diff > 0) {
        sum += diff;
        a += diff;
      }
    }
    beforeA = a;
  }
  
  printf("%ld\n", sum);
  
  return 0;
}

Measured memory_bytes: 1732
//Heaplax
//别让自己后悔
#include<bits/stdc++.h>
#define N 100001
#define M 200001
#define LL long long
#define LOG(x) cerr<<#x<<" = "<<x<<endl
#define add_edge(u,v) nxt[++cnt]=head[u],head[u]=cnt,to[cnt]=v
#define open(x) freopen(#x".in","r",stdin),freopen(#x".out","w",stdout)
char ch;bool fs;void re(int& x)
{
	while(ch=getchar(),ch<33);
	if(ch=='-')fs=1,x=0;else fs=0,x=ch-48;
	while(ch=getchar(),ch>33)x=x*10+ch-48;
	if(fs)x=-x;
}
using namespace std;
int col[N],md[N];
int n,m,q,vv[N],dd[N],cc[N];
int cnt,head[N],nxt[M],to[M];
void color(int u,int fa,int d,int c)
{
	if(!col[u])col[u]=c;
	if(d<=md[u])return;
	md[u]=max(md[u],d);
	for(int i=head[u],v;i;i=nxt[i])
		if((v=to[i])!=fa)
			color(v,u,d-1,c);
}
int main()
{
	re(n),re(m);
	for(int i=1,u,v;i<=m;++i)
	{
		re(u),re(v);
		add_edge(u,v);
		add_edge(v,u);
	}
	re(q);
	for(int i=1;i<=q;++i)
		re(vv[i]),re(dd[i]),re(cc[i]);
	for(int i=q;i;--i)
		color(vv[i],0,dd[i],cc[i]);
	for(int i=1;i<=n;++i)
		printf("%d\n",col[i]);
}


Measured memory_bytes: 4608
#include<bits/stdc++.h>
#define ALL(c) (c).begin(),(c).end()
#define EACH(i,c) for(auto i=(c).begin();i!=(c).end();++i)
using namespace std;
#define int long long


long long func(int A) {
    int k = (A + 1) / 2;

    return (A % 2 == 0 ? A : 0) ^ (k % 2);
}


void solve(long long A, long long B){
//    fprintf(stderr, "%x %x\n", func(A - 1), func(B));
    cout << (func(A - 1) ^ func(B)) << endl;
}

signed main(){
    long long A;
    scanf("%lld",&A);
    long long B;
    scanf("%lld",&B);
    solve(A, B);
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#define N 100
int main(){
  int A[N];
  int i,j,key,x,s,k;
  scanf("%d",&x);
  for(i=0;i<x;i++){
    scanf("%d",&j);
    A[i]=j;
  }
   for(s=0;s<x-1;s++){
      printf("%d ",A[s]);
      }
   printf("%d",A[s]);
    printf("\n");
  
  for(i=0;i<x-1;i++){

    for( k=i;k>=0;k--){

    if(k>=0 && A[k]>A[k+1]){
      key=A[k];
      A[k]=A[k+1];
      A[k+1]=key;
    }
    }
    for(s=0;s<x-1;s++){
      printf("%d ",A[s]);
      }
    printf("%d",A[s]);
    printf("\n");
  }
  return 0;
}



Measured memory_bytes: 2128
import sys
input = sys.stdin.buffer.readline

def main():
    # N = int(input())
    S = input().rstrip()
    # T1, T2 = map(int,input().split())
    # A1, A2 = map(int,input().split())
    # B1, B2 = map(int,input().split())
    # vA = list(map(int, input().split()))

    res = 0
    for s, r in zip(S, S[::-1]):
        if s != r:
            res += 1
    print(res//2)

main()


Measured memory_bytes: 3064
#include <stdio.h>

int main(void)
{
	char str[20];
	int i;
	
	scanf("%s", str);
	
	for (i = 0; str[i] != '\0'; i++){
		
		if (str[i] == ','){
		  str[i] = ' ';
		}
	}
	
	printf("%s\n", str);
	
	return (0);
}

Measured memory_bytes: 128