akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#define int long long
const int mod = 1e9+7,maxn = 2e5+5;
int n,m,k,jc[maxn],Ans;
inline int inv(int a){
	int x = mod-2,base = a,ans = 1;
	while(x){
		if(x&1)ans = ans*base%mod;
		base = base*base%mod;
		x >>= 1;
	}
	return ans;
}
int shik,row[maxn],col[maxn];
signed main(){
	scanf("%lld %lld %lld",&n,&m,&k);
	jc[0] = 1;
	for(int i=1;i<=n*m;++i)jc[i] = jc[i-1]*i%mod;
	shik = jc[n*m-2]*inv(jc[k-2])%mod*inv(jc[n*m-k])%mod;
	row[1] = m*(m-1)%mod*inv(2)%mod;
	col[1] = n*(n-1)%mod*inv(2)%mod;
	for(int i=2;i<=m;++i)row[i] = (row[i-1] - (m+2-2*i))%mod;
	for(int i=2;i<=n;++i)col[i] = (col[i-1] - (n+2-2*i))%mod;
	for(int i=1;i<=n;++i)
		for(int j=1;j<=m;++j)
			Ans = (Ans+shik*((row[j]*n%mod+col[i]*m)%mod)%mod)%mod;
	printf("%lld",Ans*inv(2)%mod);
	return 0;
}

Measured memory_bytes: 4856
#include <bits/stdc++.h>
using namespace std;
using LL = long long;
#define REP(i, n) for (LL i = 0; i < (LL)(n); i++)
#define FOR(i, m, n) for (LL i = m; i < n; i++)
#define SORT(x) sort(x.begin(), x.end())
#define REVE(x) reverse(x.begin(), x.end())
#define ALL(x) (x).begin(), (x).end()
#define SUM(x) accumulate(x.begin(), x.end(),0)
#define vLL(v,n) vector<LL> v(n); REP(i,n)cin>>v[i];
#define vstr(v,n) vector<string> v(n); REP(i,n)REP(i,n)cin>>v[i];
#define mina(a,b) a=min(a,b);
LL INF = 1e9 + 1;
LL MOD = 1e9+7;
  LL a,b,c,d,e,n,m,l,r,ans=1000;
string s,S,t;
int main() {
ios_base::sync_with_stdio(false);
  cin >>s;
  REP(i,s.size()){
      REP(j,s.size()){
              if(i!=j&&s[i]==s[j]){
                  cout << "no"<<endl;
                  return 0;
          }
      }
  }
  cout << "yes"<<endl;
}


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

#define loop(i,n) for(int i = 0;i < int(n);i++)
#define rloop(i,n) for(int i = int(n);i >= 0;i--)
#define range(i,a,b) for(int i = int(a);i <= int(b);i++)
#define SZ(c) int(c.size())
#define ALL(c) c.begin(), c.end()
#define RALL(c) c.rbegin(), c.rend()
#define PI acos(-1)
#define pb push_back
#define mp make_pair
#define fr first
#define sc second
#define sfi1(v) scanf("%d",&v)
#define sfi2(v1,v2) scanf("%d %d",&v1,&v2)
#define sfi3(v1,v2,v3) scanf("%d %d %d",&v1,&v2,&v3)
#define sfll1(v) scanf("%I64d",&v);
#define sfll2(v1,v2) scanf("%I64d %I64d",&v1,&v2)
#define sfll3(v1,v2,v3) scanf("%I64d %I64d %I64d",&v1,&v2,&v3)
#define endl '\n'

typedef vector<int> vi;
typedef vector<pair<int,int> > vii;
typedef long long ll;
typedef pair<int, int> pii;



int main()
{

#ifndef ONLINE_JUDGE
	//freopen("in.in", "r", stdin);
	//freopen("out.in", "w", stdout);
#endif
	ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

    int r;
    cin >> r;
    cout << 1LL * r * r << endl;

    return 0;
}


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

using namespace std;

int main()
{
  long long int n,m,sum=0;
  cin>>n>>m;
  vector<long long int> ar(m,0);
  for(long long int i=0;i<m;i++)
  {
    cin>>ar[i];
    sum+=ar[i];
  }
  if(sum>n)
    cout<<-1<<"\n";
  else
    cout<<n-sum<<"\n";
  return 0;
}

Measured memory_bytes: 3632
#include <iostream>
#include <math.h>
#include <algorithm>
#include <vector>
#include <numeric>
#include <string>
using namespace std;
const double PI = acos(-1.0);
const string alp = "abcdefghijklmnopqrstuvwxyz";
const string ALP = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define REP1(i,n) FOR(i,1,n+1)
#define SUM(c) accumulate((c).begin(),(c).end(),0)
#define UNIQ(c) (c).erase(unique((c).begin(), (c).end()), (c).end());
#define Yn(b) puts(b?"Yes":"No")
#define YN(b) puts(b?"YES":"NO")

bool isprime(int p) {
  if (p==1) return false;
    FOR(i,2,p) {
      if (p%i==0) return false;
    }
  return true;
}

int main(){
  long n,m;
  cin >> n >> m;
  if (n==1&&m==1) {
    cout << 1;
  } else if (n==1) {
    cout << m-2;
  } else if (m==1) {
    cout << n-2;
  } else if (n==2||m==2) {
    cout << 0;
  } else {
    cout << (n-2)*(m-2);
  }
  return 0;
}

Measured memory_bytes: 256
import sys
input = sys.stdin.readline

def find(x):
    if par[x] == x:
        return x
    else:
        return find(par[x])

def unite(x, y):
    x = find(x)
    y = find(y)

    if x != y:
        if rank[x] < rank[y]:
            par[x] = y
            size[y] += size[x]
        else:
            par[y] = x
            size[x] += size[y]
            if rank[x] == rank[y]:
                rank[x] += 1

def same(x, y):
    return find(x) == find(y)

#####################################

N, M = map(int, input().split())

par = [0] * N
for i in range(N):
    par[i] = i

rank = [1] * N
size = [1] * N
res = []

edge2 = [[0] for i in range(M)]
for i in range(M):
    edge2[i] = list(map(int, input().split()))

edge = [[0] for i in range(M)]
for i in range(M):
    edge[i] = [edge2[M - 1 - i][0] - 1, edge2[M - 1 - i][1] - 1]

for i in range(M):
    fi = find(edge[i][0])
    se = find(edge[i][1])

    if fi == se:
        res.append(0)
    else:
        res.append(size[fi] * size[se])
        unite(fi, se)

ans = 0
for i in range(M):
    ans += res[M - 1 - i]
    print(ans)

Measured memory_bytes: 48392
import java.util.Scanner;

class Main{


	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int N = scanner.nextInt();
		int Y = scanner.nextInt()/1000;
		int num = 0;
		for(int i = 0;i < N+1;i++){
			for(int j = 0;j < N+1;j++){
				//				for(int l = N - (i +j) ;l + i + j< N+1;l++){
				int l = N -(i+j);
				if(l >= 0){
					if(i + 5*j + 10*l == Y ){
						System.out.println(l+" "+j+" "+i);
						return;
					}
				}
			}

		}


		System.out.println(-1+" "+-1+" "+-1);

	}
}


Measured memory_bytes: 23252
#include <bits/stdc++.h>
#define rep(i, n) for (int i=1; i<=n; i++)
#define drep(i, n) for (int i=n; i>=1; i--)
using namespace std;
typedef long long ll;
int main() {
    int n;
    scanf("%d", &n);
    if (n<1200) printf("ABC");
        else if (n<2800) printf("ARC");
            else printf("AGC");
}

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

#define FOR(i,a,b) for(int i= (a); i<((int)b); ++i)
#define RFOR(i,a) for(int i=(a); i >= 0; --i)
#define FOE(i,a) for(auto i : a)
#define ALL(c) (c).begin(), (c).end()
#define RALL(c) (c).rbegin(), (c).rend()
#define DUMP(x)  cerr << #x << " = " << (x) << endl;
#define SUM(x) std::accumulate(ALL(x), 0LL)
#define MIN(v) *std::min_element(v.begin(), v.end())
#define MAX(v) *std::max_element(v.begin(), v.end())
#define EXIST(v,x) (std::find(v.begin(), v.end(), x) != v.end())
#define BIT_ON(bit, i) (((bit >> i) & 1) > 0)

typedef long long LL;
template<typename T> std::vector<T> make_v(size_t a){return std::vector<T>(a);}
template<typename T,typename... Ts> auto make_v(size_t a, Ts... ts){ return std::vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));}    // C++14
template<typename T,typename V> typename std::enable_if<std::is_class<T>::value==0>::type fill_v(T &t,const V &v){t=v;}
template<typename T,typename V> typename std::enable_if<std::is_class<T>::value!=0>::type fill_v(T &t,const V &v){for(auto &e:t) fill_v(e,v);}
template<class T> inline T ceil(T a, T b) { return (a + b - 1) / b; }
template<class T> inline void print(T x) { std::cout << x << std::endl; }
template<class T> inline void print_vec(const std::vector<T> &v) { for (int i = 0; i < v.size(); ++i) {  if (i != 0) {std::cout << " ";} std::cout << v[i];} std::cout << "\n"; }
template<class T> inline bool inside(T y, T x, T H, T W) {return 0 <= y and y < H and 0 <= x and x < W; }
template<class T> inline double euclidean_distance(T y1, T x1, T y2, T x2) { return sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2)); }
template<class T> inline double manhattan_distance(T y1, T x1, T y2, T x2) { return abs(x1 - x2) + abs(y1 - y2); }
template<typename T> T &chmin(T &a, const T &b) { return a = std::min(a, b); }
template<typename T> T &chmax(T &a, const T &b) { return a = std::max(a, b); }

template<class T> inline std::vector<T> unique(std::vector<T> v) {
    sort(v.begin(), v.end());
    v.erase(unique(v.begin(), v.end()), v.end());
    return v;
}
// 初項s, 交差dのn個の数列の和
long long sum_of_arithmetic_progression(long long s, long long d, long long n) {
    return n * (2 * s + (n - 1) * d) / 2;
}

const int INF = 1 << 30;
const double EPS = 1e-9;
const long double PI = acos(-1.0);
const std::vector<int> dy4 = {0, -1, 0, 1}, dx4 = {1, 0, -1, 0};
const std::vector<int> dy8 = { 0, -1, 0, 1, 1, -1, -1, 1 }, dx8 = { 1, 0, -1, 0, 1, 1, -1, -1 };


using namespace std;


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

    int N, M;
    cin >> N >> M;

    const LL MOD = 1000000000 + 7;

    auto X = make_v<LL>(N);
    auto Y = make_v<LL>(M);
    FOR(i, 0, N) {
        cin >> X[i];
    }
    FOR(i, 0, M) {
        cin >> Y[i];
    }
    sort(ALL(X));
    sort(ALL(Y));

    LL x = 0;
    FOR(i, 0, N) {
        x = x + ((X[i] * i) % MOD + MOD - (X[i] * (N - 1 - i)) % MOD) % MOD;
        x %= MOD;
    }
    LL y = 0;
    FOR(i, 0, M) {
        y = y + ((Y[i] * i) % MOD + MOD - (Y[i] * (M - 1 - i)) % MOD) % MOD;
        y %= MOD;
    }

    print((x * y) % MOD);

    return 0;
}



Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-9;
const ll mod=1e9+7;
const int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};

int n,k;
string s;
vp a;

int main(){
	cin>>n>>k>>s;
	s+='0';
	int I=0,res=0;
	for(int i=0;i<=n;i++) if(s[i]=='0'){
		if(I!=i) a.push_back({I,i});
		I=i+1;
	}
	int S=a.size();
	if(!S){
		cout<<n<<endl;
		return 0;
	}
	for(int i=0;i<S;i++) res=max(res,a[min(S-1,i+k)].second-a[i].first);
	res=max(res,a[min(S-1,k-1)].second);
	res=max(res,n-a[max(0,S-k)].first);
	cout<<res<<endl;
}

Measured memory_bytes: 1020
#include <stdio.h>
int main(){
    int N;
    scanf("%d",&N);
    int a[N];
    for (int i=0;i<N;i++){
        scanf("%d",&a[i]);
    }
    int l = -1;
    int r = N;
    int suml = 0;
    int sumr = 0;
    while(l+1<r){
        if (suml==sumr){
            l++;
            r--;
            suml += a[l];
            sumr += a[r];
        }
        else if (suml<sumr){
            l++;
            suml += a[l]; 
        }
        else if (suml>sumr){
            r--;
            sumr += a[r];
        }
        // printf("%d %d %d %d\n",suml,sumr,l,r);
    }
    int diff = suml-sumr;
    if (diff<0){
        diff = -1*diff;
    }
    printf("%d\n",diff);
}

Measured memory_bytes: 128
#include<stdio.h>
int main()
{
    int N,A;
    int ans;
  
    // 整数の入力
    scanf("%d", &N);
    scanf("%d", &A);
  
    // 黒色の数の計算
    ans = (N*N) - A ;   
    //
  
    // 出力
    printf("%d\n", ans);
    return 0;
}

Measured memory_bytes: 128
// Contest.cpp : アプリケーションのエントリ ポイントを定義します。
//

#include"iostream"
#include"string"
#include"vector"
#include"algorithm"

using namespace std;

int main()
{
	/*int n,k;
	cin >> n;
	vector<char>s(n);
	for (int j = 0; j < n; j++)  cin >> s[j];
	cin >> k;
	for (int i = 0; i < n; i++)
	{
		if (s[i] != s[k-1]) {
			s[i] = '*';
		}
	}

	for (int l = 0; l < n; l++)
	{
		cout << s[l] ;
	}*/
	int n;
	cin >> n;
	vector<int>a(n);
	for (int i = 0; i < n; i++)cin >> a[i];

	vector<pair<int, int>>p(n);
	for (int i = 0; i < n; i++) {
		p[i] = { a[i],i };
	}

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

	for (int i = 0; i < n; i++) {
		if (p[0].second !=i) {
			cout<<p[0].first<<endl;
		}
		else {
			cout << p[1].first << endl;
		}


	}
	
	
	
	return 0;
}






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

int main() {
  int A, B;
  int ans = 0;
  cin >> A >> B;
  for (int i = A; i < B+1; i++) {
    if (i%10 == i / 10000 && (i / 10)%10 == (i / 1000)%10) {
      ans++;
    }
  }
  cout << ans << "\n";
}


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

int main(){
int k, value, cont = 0;
int histogram[MAX], n, n1, m;
set<int> values;

for (int i = 0; i < MAX; i++)
                histogram[i] = 0;

cin >> n >> m;
n1 = n;
while(n--){

cin >> k;

    while(k--){
        int value;
        cin >> value;
        values.insert(value);

    }
    for (auto it=values.begin(); it!=values.end(); ++it)
            histogram[*it]++;
//                cout << *it << " "; 
    values.clear();
}

for (int i = 0; i < MAX; i++)
             if(histogram[i] >= n1 ) cont++;

cout << cont << endl;


    return 0;
}

Measured memory_bytes: 4224
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		System.out.println(solve(Integer.parseInt(sc.next()), 0));
	}
	public static int solve(int n, int c) {
		if (n < 6) return c + n;
		int a = 1,b = 1;
		while (a * 6 <= n) a *= 6;
		while (b * 9 <= n) b *= 9;
		return Math.min(solve(n - a, c + 1), solve(n - b, c + 1));
	}
}

Measured memory_bytes: 21844
N,K=map(int,input().split())

amat_white,amat_black=[],[]
for i in range(2*K):
  amat_white.append([0]*(2*K))
  amat_black.append([0]*(2*K))

smat_white,smat_black=[],[]
for i in range(2*K+1):  
  smat_white.append([0]*(2*K+1))
  smat_black.append([0]*(2*K+1))

num_white,num_black=0,0
for i in range(N):
  x,y,c=input().split()  
  xx=int(x)%(2*K)
  yy=int(y)%(2*K)
  
  if xx<K and yy<K:
    if c=="W":
      amat_white[xx][yy]+=1
      amat_white[xx+K][yy+K]+=1
      num_white+=1
    else:
      amat_black[xx][yy]+=1
      amat_black[xx+K][yy+K]+=1
      num_black+=1
  elif xx>=K and yy>=K:
    if c=="W":
      amat_white[xx-K][yy-K]+=1
      amat_white[xx][yy]+=1
      num_white+=1
    else:
      amat_black[xx-K][yy-K]+=1
      amat_black[xx][yy]+=1
      num_black+=1
  elif xx<K and yy>=K:
    if c=="W":
      amat_black[xx][yy-K]+=1
      amat_black[xx+K][yy]+=1
      num_black+=1
    else:
      amat_white[xx][yy-K]+=1
      amat_white[xx+K][yy]+=1
      num_white+=1
  elif xx>=K and yy<K:
    if c=="W":
      amat_black[xx-K][yy]+=1
      amat_black[xx][yy+K]+=1
      num_black+=1
    else:
      amat_white[xx-K][yy]+=1
      amat_white[xx][yy+K]+=1
      num_white+=1
  else:
    None
#print(amat_white)
#print(amat_black)

for i in range(1,2*K+1):
  for j in range(1,2*K+1):
    smat_white[i][j]=amat_white[i-1][j-1]+smat_white[i][j-1]+smat_white[i-1][j]-smat_white[i-1][j-1]
    smat_black[i][j]=amat_black[i-1][j-1]+smat_black[i][j-1]+smat_black[i-1][j]-smat_black[i-1][j-1]
#print(smat_white)
#print(smat_black)

max_answer=0
#white
for i in range(K):
  for j in range(K):
    answer_white=smat_white[i+K][j+K]-smat_white[i][j+K]-smat_white[i+K][j]+smat_white[i][j]
    answer_black=num_black-(smat_black[i+K][j+K]-smat_black[i][j+K]-smat_black[i+K][j]+smat_black[i][j])
    max_answer=max(max_answer,(answer_white+answer_black))
    #print(i,j,answer_white,answer_black)
#black
for i in range(K):
  for j in range(K):
    answer_white=num_white-(smat_white[i+K][j+K]-smat_white[i][j+K]-smat_white[i+K][j]+smat_white[i][j])
    answer_black=smat_black[i+K][j+K]-smat_black[i][j+K]-smat_black[i+K][j]+smat_black[i][j]
    max_answer=max(max_answer,(answer_white+answer_black))
    #print(i,j,answer_white,answer_black)
    
print(max_answer)

Measured memory_bytes: 164616
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#define For(i, n) for(int i = 0; i < (n); i ++)
#define Range(c) c.begin(), c.end()
#define RevRange(c) c.begin(), c.end()
#define Cin(T, x) T x; cin >> x;
#define Cins(T, n, xs) vector<T> xs(n); For(i, n) cin >> xs[i];
#define Cout(val) cout << (val) << "\n";
#define Sort(a) sort(Range(a));
#define DeSort(a) sort(RevRange(a));

using namespace std;
using ll = long long;

int main(void){
    Cin(int, a);
    Cin(int, b);
    Cin(int, c);
    Cin(int, d);
    Cout((a+b)*c/2);
    //Cout(() ? "Yes" : "No");
    //Cout(() ? "YES" : "NO");
}

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

using namespace std;

#define EACH(i,a) for (auto& i : a)
#define FOR(i,a,b) for(int i=(int)a;i<(int)b;++i)
#define RFOR(i,a,b) for(int i=(int)b-1;i>=(int)a;--i)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define ALL(a) (a).begin(),(a).end()
#define debug(x) cerr << #x << ":" << x << endl;
#define OK(ok) cout << (ok ? "Yes" : "No") << endl;
typedef long long ll;

void CINT(){}
template <class Head,class... Tail>
void CINT(Head&& head,Tail&&... tail) {
  cin >> head; CINT(move(tail)...);
}
#define CIN(...) int __VA_ARGS__;CINT(__VA_ARGS__)
#define LCIN(...) ll __VA_ARGS__;CINT(__VA_ARGS__)
#define SCIN(...) string __VA_ARGS__;CINT(__VA_ARGS__)

const int INF = 1e9 + 1;
const int MOD = 1e9 + 7;
const int MAX_N = 1e5 + 1;

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

  LCIN(X, Y);
  int ans = 0;
  while (X <= Y) {
    X <<= 1;
    ans++;
  }
  cout << ans << endl;

  return 0;
}




Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Scanner;
import java.util.Comparator;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        B solver = new B();
        solver.solve(1, in, out);
        out.close();
    }

    static class B {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            // 入力
            int n = Integer.parseInt(in.next());
            Integer[] a = new Integer[n];
            for (int i = 0; i < n; i++) {
                a[i] = Integer.valueOf(in.next());
            }
            Arrays.sort(a, Comparator.reverseOrder());
            int ans = Math.abs(a[0] - a[n - 1]);

            // 出力
            out.println(ans);

        }

    }
}



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

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

	for(int i=1;i<=n;i++)cout<<person[i]<<endl;

	return 0;
}


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

#define int long long
typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,f,n) for(int i=(f);i<(n);i++)
#define all(v) (v).begin(),(v).end()
#define each(it,v) for(__typeof((v).begin()) it=(v).begin();it!=(v).end();it++)
#define pb push_back
#define fi first
#define se second
template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}

signed main(){
    char c;
    cin>>c;
    string s="aeiou";
    if(find(all(s),c)!=s.end())cout<<"vowel"<<endl;
    else cout<<"consonant"<<endl;
    return 0;
}


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

int main()
{
  string s;
  int q;
  cin >> s >> q;
  bool flag = false;
  string t, u;
  for (int i = 0; i < q; i++) {
    int n, f;
    char c;
    cin >> n;
    if (n == 1) {
      flag = !flag;
      continue;
    }
    cin >> f >> c;
    ((f == 1) xor flag ? t : u) += c;
  }
  string ans;
  if (flag) {
    reverse(begin(s), end(s));
    reverse(begin(u), end(u));
    ans = u + s + t;
  } else {
    reverse(begin(t), end(t));
    ans = t + s + u;
  }
  cout << ans << endl;
}


Measured memory_bytes: 1348
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define call(var) cout<<#var<<"="<<var<<endl;
#define dup(x,y) (((x)+(y)-1)/(y))
using ll=long long;
using vi = vector<int>;
using vl = vector<ll>;
using vb = vector<bool>;
using Graph = vector<vi>;
using P = pair<int,int>;
const int MOD=(int)1e9+7;
const int INF=(int)1e9;
const ll LINF=(ll)1e18;
const int INTMAX = 2147483647;
template<class t,class u> inline bool chmax(t&a,u b){if(a<b){a=b;return true;}return false;}
template<class t,class u> inline bool chmin(t&a,u b){if(b<a){a=b;return true;}return false;}

int main(){
    int n;cin >> n;
    vector<int> pr;
    vb a(55556);
    for(int i=2;i<55556;++i){
        if(a[i]) continue;
        pr.push_back(i);
        for(int j=i;j<55556;j += i) a[j] = 1;
    }
    //call("why");
    int cur = 1;
    reverse(pr.begin(), pr.end());
    while(cur <= n){
        if(pr.back() % 10 == 1){
            cout << pr.back() << " ";
            ++cur;
        }
        pr.pop_back();
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,a,n) for(int i=a;i<=n;i++)
#define per(i,a,n) for(int i=n;i>=a;i--)
#define pb push_back
#define mp make_pair
#define FI first
#define SE second
#define maxn 1000000
#define mod 1000000007
#define inf 0x3f3f3f3f
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef double db;

int cnt[maxn+5];
int a[maxn+5];
bool ok[maxn+5];

int main()
{
    int n; scanf("%d",&n);
    rep(i,1,n) scanf("%d",&a[i]);
    rep(i,1,n) cnt[a[i]]++;
    rep(i,1,maxn) ok[i]=1;
    rep(i,1,maxn) 
    {
        if(cnt[i]>1) ok[i]=0;
        if(cnt[i])
        {
            for(int j=i+i;j<=maxn;j+=i) ok[j]=0;
        }
    }
    int ans=0;
    rep(i,1,maxn) if(ok[i] && cnt[i]) ans++;
    printf("%d\n",ans);
    return 0;
}

Measured memory_bytes: 9484
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>

using namespace std;

int main()
{
	int h, w, n;
	cin >> h >> w >> n;
	map<pair<int, int>, int> mp;
	vector<int> s(h), t(w);
	for (int i = 0; i < n; i++) {
		int a, b;
		cin >> a >> b;
		a--;
		b--;
		s[a]++;
		t[b]++;
		mp[make_pair(a, b)]++;
	}

	int smax = max_element(s.begin(), s.end()) - s.begin();
	int tmax = max_element(t.begin(), t.end()) - t.begin();

	int ans = 0;
	for (int i = 0; i < h; i++) {
		ans = max(ans, s[i] + t[tmax] - mp[make_pair(i, tmax)]);
	}
	for (int i = 0; i < w; i++) {
		ans = max(ans, t[i] + s[smax] - mp[make_pair(smax, i)]);
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 61848
#include <iostream>

using namespace std;

int ctoi(char c){
    return (int)(c-'0');
}

int main()
{
    string s;
    cin>>s;
    int a=ctoi(s[0])*10+ctoi(s[1]);
    int b=ctoi(s[2])*10+ctoi(s[3]);
    if(a>12||a==0){
        if(b>12||b==0){
            cout<<"NA"<<endl;
        }else{
            cout<<"YYMM"<<endl;
        }
    }else{
        if(b>12||b==0){
            cout<<"MMYY"<<endl;
        }else{
            cout<<"AMBIGUOUS"<<endl;
        }
    }
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <vector>
#include <set>
#include <string>
#include <algorithm>
#include <cmath>

using namespace std;

const int CMax = 200002;

int n, k, A[CMax], ats, sk;
vector <int> svor;

int main() {
    scanf("%d %d", &n, &k);

    for (int i = 0; i < n; i++) {
        scanf("%d", &sk);
        A[sk]++;
    }

    for (int i = 0; i < CMax; i++) {
        if (A[i] > 0) svor.push_back(A[i]);
    }

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

    sk = (int)svor.size();

    for (int i = 0; i < svor.size() && sk > k; i++) {
        ats += svor[i];
        sk--;
    }

    printf("%d\n", ats);
}



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

typedef long long ll;
typedef pair<int,int> P;
typedef map<int,int> M;
typedef vector<int> V;
typedef queue<int> Q;
typedef pair<long,long> PLL;
typedef map<long,long> MLL;
typedef vector<long long> VLL;
typedef vector<pair<int,int>> VP;
typedef vector<vector<int>> VV;
#define INF (int)(1e9+1)
#define MAXX (int)1.1529215e+18
#define inf 999999
#define EPS (1e-7)
#define MOD (ll)(1e9+7)
#define rep(i,n) for(int i=0; i<(int)(n);i++)
#define REP(i,n) for(int i=1;i<=(int)(n);i++)
#define rrep(i,n) for(int i=(int)(n-1);i>=0;i--)
#define FOR(i,k,n) for(int i=(k);i<(int)(n);i++)
#define ALL(a)  a.begin(),a.end()
#define RALL(a) a.begin(),a.end(),greater<int>()
#define PRALL(a) a.begin(),a.end(),greater<pair<int,int>>()
#define ROT(a) a.begin(),a.begin()+1,a.end()
#define RROT(a) a.begin(),a.end()-1,a.end()
#define PB push_back
#define MP make_pair
#define PI acos(-1.0)
//printf("myco\n");//for debug
/*--------------------------------------------*/
int main(){
    int n=2019;
    int l,r;cin>>l>>r;
    int p=min(l%n,r%n);
    int q=max(l%n,r%n);
    ll ans=inf;
    if(r-l>=n)ans=0;
    else{
        for(int i=p;i<q;i++){
            for(int j=i+1;j<=q;j++){
                ll tmp=((i%n)*(j%n))%n;
                ans=min(tmp,ans);
                if(ans==0)break;
            }
        }
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 256
import java.io.*;
import java.util.ArrayList;
import java.util.List;

public class Main {
  public static void main(String[] args) throws IOException {
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    int k = Integer.parseInt(br.readLine());
    long result = solve(k);
    System.out.println(result);
  }
  public static long solve(int k){
    List<String> list = new ArrayList<>();
    if (k <= 9){
      return k;
    } else {
      for (int i=1; i<=9; i++){
        list.add(String.valueOf(i));
      }
    }
    int counter = 9;
    while (true){
      List<String> nextList = new ArrayList<>();
      for (String s : list){
        add(nextList, Long.parseLong(s));
      }
      if (counter + nextList.size() > k){
        return Long.parseLong(nextList.get(k-counter-1));
      } else {
        counter += nextList.size();
        list = nextList;
      }
    }
  }
  public static void add(List<String> list, long num){
    String s = String.valueOf(num);
    char c = s.charAt(s.length()-1);
    if(c == '0'){
      list.add(s + "0");
      list.add(s + "1");
    } else if(c == '9'){
      list.add(s + "8");
      list.add(s + "9");
    } else {
      for (int i=0; i<3; i++){
        int n = c - '0';
        list.add(s + (n + i -1));
      }
    }
  }
}


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

using namespace std;
using ll = long long;

#define rep(i, n)      for (int i = 0; i < (n); i++)
#define repr(i, n)     for (int i = (n) - 1; i >= 0; i--)
#define repe(i, l, r)  for (int i = (l); i < (r); i++)
#define reper(i, l, r) for (int i = (r) - 1; i >= (l); i--)
#define repi(i, l, r)  for (int i = (l); i <= (r); i++)
#define repir(i, l, r) for (int i = (r); i >= (l); i--)
#define range(a) a.begin(), a.end()
void init_io() { cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); }

// K + ... + K+2N-1 <= K+2N + ... + K+3N-1
// 2K-1 <= N
// 
// K=4, N=7
// 
// A  B  C  D  E  F  G
// 4  5  6  7  8  9  10
// E  F  G  A  B  C  D
// 11 12 13 14 15 16 17
//    v     v     v
// 18 19 20 21 22 23 24
// ^     ^     ^     ^
//
// N は奇数
//  (N-1)/2        (N-1)/2
//  v
// [ABCDEFGH] [I] [abcdefgh]
//             v
// [abcdefgh] [A] [BCDEFGHI]
//  v
// [AaBbCcDd] [E] [eFfGgHhI]
// 
//  v
// [K-------] [-] [--------------------------]
//               v
// [K+N-----] [(K+N+K+2N-1)/2] [-------K+2N-1]
//  v
// [K+2N ------------------------------------]
// 
// 2K-1 <= N
//

int main() { init_io();
  int N, K; cin >> N >> K;
  if (2*K-1 > N) {
    cout << -1 << endl;
    return 0;
  }
  if (N % 2 == 0) {
    for (int i = 0; i < N / 2; i++) {
      int x = K + i;
      int y = K+N+N/2+i;
      int z = K+2*N+2*i;
      cout << x << ' ' << y << ' ' << z << endl;
    }
    for (int i = 0; i < N / 2; i++) {
      int x = K+N/2+i;
      int y = K+N+i;
      int z = K+2*N+2*i+1;
      cout << x << ' ' << y << ' ' << z << endl;
    }
  } else {
    for (int i = 0; i < (N + 1) / 2; i++) {
      int x = K + i;
      int y = K+N + N/2 + i;
      int z = K+2*N+2*i;
      cout << x << ' ' << y << ' ' << z << endl;
    }
    for (int i = 0; i < N / 2; i++) {
      int x = K+(N+1)/2+i;
      int y = K+N+i;
      int z = K+2*N+2*i+1;
      cout << x << ' ' << y << ' ' << z << endl;
    }
  }
}


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

#define REP(i,s,n) for(int i=s; i<n; ++i)
#define rep(i,n) REP(i,0,n)
#define SORT(c) sort((c).begin(),(c).end())
#define IINF INT_MAX
#define LLINF LLONG_MAX
#define DEBUG false

typedef long long ll;
typedef pair<int, int> ii;

int main(){

  string s;
  cin >> s;

  bool f = true;
  rep(i, s.size()/2) f &= (s[i] == s[s.size()-1-i]);

  if(f) cout << 0 << endl;
  else{

    vector<int> tmp;
    rep(i, s.size()){
      if(s[i] != 'x') tmp.push_back(s[i] - 'a');
    }
    vector<int> tmp2(tmp);
    reverse(tmp.begin(), tmp.end());
    if(tmp != tmp2){
      cout << -1 << endl;
      return 0;
    }
    else{
      int l = 0, r = s.size() - 1;
      ll ans = 0;
      while(l < r){
        if(s[l] == s[r]){
          l++;
          r--;
        }
        else if(s[l] == 'x'){
          ans++;
          l++;
        }
        else{
          ans++;
          r--;
        }
      }
      cout << ans << endl;
    }


  }


  return 0;
}


Measured memory_bytes: 1272
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0; i<(n); i++)
using ll = long long;
const ll mod = 998244353;

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

  bool inc = false;
  if(n%10==7) inc = true;
  n /= 10;
  if(n%10==7) inc = true;
  n /= 10;
  if(n%10==7) inc = true;
  
  if(inc) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 3632
#pragma region template
#include "bits/stdc++.h"
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const long long MOD = 1e9 + 7, MAX = 1e18, larg = 1e5, INF = -1e9;
long long A, B, C, D, E, F, G, H, I, J, K, L, N, M, O, P, Q, R, S, T, U, V, W, x, y, z;
long long max_value = INF, max_index = -1;
long long min_value = MAX, min_index = -1;
typedef long long ll;
typedef pair<ll, ll> Pa;

class UnionFind {
public:
	vector <ll> par; // 各元の親を表す配列
	vector <ll> siz; // 素集合のサイズを表す配列(1 で初期化)

	// Constructor
	UnionFind(ll sz_) : par(sz_), siz(sz_, 1LL) {
		for (ll i = 0; i < sz_; ++i) par[i] = i; // 初期では親は自分自身
	}
	void init(ll sz_) {
		par.resize(sz_);
		siz.assign(sz_, 1LL);  // resize だとなぜか初期化されなかった
		for (ll i = 0; i < sz_; ++i) par[i] = i; // 初期では親は自分自身
	}

	// Member Function
	// Find
	ll root(ll x) { // 根の検索
		while (par[x] != x) {
			x = par[x] = par[par[x]]; // x の親の親を x の親とする
		}
		return x;
	}

	// Union(Unite, Merge)
	bool merge(ll x, ll y) {
		x = root(x);
		y = root(y);
		if (x == y) return false;
		// merge technique（データ構造をマージするテク．小を大にくっつける）
		if (siz[x] < siz[y]) swap(x, y);
		siz[x] += siz[y];
		par[y] = x;
		return true;
	}

	bool issame(ll x, ll y) { // 連結判定
		return root(x) == root(y);
	}

	ll size(ll x) { // 素集合のサイズ
		return siz[root(x)];
	}
};

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

int main() {
	ll _sum = 0;
	cin >> N;
	for(int i=1;i<=N;i++){
		if(i % 3 == 0 || i % 5 == 0) continue;
		_sum += i;
	}
	cout << _sum;
}


Measured memory_bytes: 3624
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
typedef long long ll;
struct data{
    int p,t,c;
    data(int a,int b,int c_):
        p(a),t(b),c(c_){}

    data(){}
};
int main(){
    int n,m;
    vector<data>V;
    int p,t,c;
    cin>>n>>m;
    while(cin>>p>>t>>c,p||t||c){
        p--;t--;
        V.push_back(data(p,t,c));
    }
    int  q;
    cin>>q;
    while(q--){
        int a[10000];
        for(int i=0;i<m;i++)cin>>a[i];
        ll ans[10000]={0};
        for(int i=0;i<V.size();i++){
            data d=V[i];
            ans[d.p]+=(ll)a[d.t]*d.c;
        }
        for(int i=0;i<n;i++){
            if(i)cout<<" ";
            cout<<ans[i];
        }
        cout<<endl;
    }
}

Measured memory_bytes: 1992
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<set>
#include<queue>
#include<stack>
using namespace std;
#define int long long
#define vel vector<long long>
#define vvel vector<vel>
#define rep(i,n) for(long long i=0;i<n;i++)
#define rp(i,n) for(long long i=1;i<n;i++)
#define sor(v) sort(v.begin(),v.end())
#define mmax(a,b) a=max(a,b)
#define mmin(a,b) a=min(a,b)
#define mkp make_pair
#define pin pair<int,int>
#define V vector
long long p = 1000000007;
vel rui(19, 1);
vel kai(1000007, 1);
vel ink(1000007, 1);
vel par;
int root(int ser) {
	if (par[ser] == -1) { return ser; }
	int ans = root(par[ser]);
	par[ser] = ans;
	return ans;
}
bool marge(pin a) {
	int x = root(a.first);
	int y = root(a.second);
	if (x != y) { par[x] = y; }
	return x != y;
}
int gcd(int a, int b) {
	if (a < b) { swap(a, b); }
	if (b == 0) { return a; }
	return gcd(b, a%b);
}
int ru(int a, int r) {
	if (r == 0) { return 1; }
	int ans = ru(a, r / 2);
	ans *= ans; ans %= p;
	if (r % 2 == 1) { ans *= a; ans %= p; }
	return ans;
}
int inv(int a) {
	return ru(a, p - 2);
}
void make_kai() {
	rep(i, 1000006) { kai[i + 1] = (kai[i] * (i + 1)) % p; }
	rep(i, 1000007) { ink[i] = inv(kai[i]); }
}
int com(int n, int r) {
	int ans = kai[n] * ink[r];
	ans %= p;
	return ans;
}
int nap(int n, vel napw, vel napv) {
	if (napw.size() == 0) { return 0; }
	if (napw.size() == 1) {
		return (n / napw[0])*napv[0];
	}
	if (napw.size() == 2) {
		int ans = 0;
		int lim = n / napw[0];
		rep(c0, lim + 1) {
			int c1 = (n - c0 * napw[0]) / napw[1];
			mmax(ans, c0*napv[0] + c1 * napv[1]);
		}
		return ans;
	}
	int ans = 0;
	int ex;
	int lim = n / napw[0];
	int nlim;
	rep(c0, lim + 1) {
		ex = n - c0 * napw[0];
		nlim = ex / napw[1];
		rep(c1, nlim + 1) {
			int c2 = (ex - c1 * napw[1]) / napw[2];
			mmax(ans, c0*napv[0] + c1 * napv[1] + c2 * napv[2]);
		}
	}
	return ans;
}
signed main() {
	int a, b, c, k; cin >> a >> b >> c >> k;
	if (k % 2 == 0) { cout << a - b << endl; }
	else { cout << b - a << endl; }
	return 0;
}


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

int main() {
 string s;
 cin >> s;
 int x = 0;

 for (int i = 0; i < 4; i++) {
   if (s[i] == '+') {
     x++;
   }
   else {
     x--;
   }
 }
 cout << x;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <vector>
#include <queue>
#include <stack>
#include <cmath>
#include <map>
#include <iomanip>
#include <set>
#include <ctime>
#include <tuple>
#include <bitset>
#include <assert.h>
#include <deque>
using namespace std;

/*
using PAIR = pair<string, int>;
sort(sp.begin(), sp.end(), [](PAIR l, PAIR r){
        return l.first<r.first || (l.first==r.first && l.second > r.second);
        });
*/

typedef long long ll;

#define fi first
#define se second
#define rep(i, n) for (ll i = 0; i < n; i++)
#define debugA() cerr << "AAAAA" << endl
#define debug_() cerr << "-------------" << endl
#define debug(x) cerr << #x << ": " << x << endl
#define debug_vec(v)                   \
    cout << #v << endl;                \
    for (int i = 0; i < v.size(); i++) \
    {                                  \
        cout << v[i] << " ";           \
    }                                  \
    cout << endl;
#define debug_vec2(v)                         \
    cout << #v << endl;                       \
    for (int i = 0; i < v.size(); i++)        \
    {                                         \
        for (int j = 0; j < v[i].size(); j++) \
        {                                     \
            cout << v[i][j] << " ";           \
        }                                     \
        cout << endl;                         \
    }

using Graph = vector<vector<int>>;
using P = pair<int, int>;
using P1 = pair<int, pair<int, int>>; // クラスカル法とかで、{cost, {from, to}}的に使う。
const int INF = 1001001001;
const double pi = acos(-1);

int main()
{
    int x, n;
    cin >> x >> n;
    vector<int> a(n);
    for (int i = 0; i < n; i++)
    {
        cin >> a[i];
    }
    sort(a.begin(), a.end());
    int ans = 1001001001;
    for (int i = 0; i < 200; i++)
    {
        if (count(a.begin(), a.end(), i) != 0)
        {
            continue;
        }
        if (abs(ans - x) > abs(i - x))
        {
            ans = i;
        }
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3632
d = {}
r, c = [int(i) for i in input().split()]
a = [input() for i in range(r)]
for i in range(r):
    d[i] = [int(j) for j in a[i].split()]

for i in range(r):
    print(" ".join(map(str,d[i]))+" ", end="")
    print(sum(d[i]))

e = 0
for j in range(c):
    b = 0
    for i in range(r):
        b += d[i][j]
        e += d[i][j]
    print(str(b)+" ", end="")
print(e)




Measured memory_bytes: 5740
main :: IO ()                                                                                                              
main = getLine >> map read . words <$> getLine >>= print . f 0                                                             
                                                                                                                           
f :: Int -> [Int] -> Int                                                                                                   
f n as                                                                                                                     
  | all even as = f (n+1) $ map (`div`2) as                                                                                
  | otherwise = n

Measured memory_bytes: 1020
#include<bits/stdc++.h>
using namespace std;
#define ll long long int 
#define pii pair<int,int> 
#define pb push_back
#define INF INT_MAX 
#define mod 1000000007ll
#define fi first
#define se second
#define f(i,p,q) for(int i=p;i<q;i++)
#define si(a) scanf("%d",&a)
#define sii(a,b) scanf("%d %d",&a,&b)
#define siii(a,b,c) scanf("%d %d %d",&a,&b,&c)
#define pi(a) printf("%d\n",a)
#define psi(a) printf(" %d",a)
#define poi(a) printf("%d",a)
#define sl(a) scanf("%lld",&a)
#define pl(a) printf("%lld\n",a)
#define Nline() printf("\n")
#define sstr(str) scanf("%s",str)
#define pstr(str) printf("%s\n",str)
#define SET(a) memset(a,-1,sizeof(a))
#define CLR(a) memset(a,0,sizeof(a))
#define vi vector<int>
#define vvi vector<vi>
#define all(v) (v).begin(),(v).end()
#define SORT(v) sort(all(v))
#define RSORT(v) sort(all(v), greater<int>())
#define VI(a,n) vi a(n); rep(i,n)cin>>a[i];
#define sq(n) (n)*(n)
#define ios ios::sync_with_stdio(false); cin.tie(0);cout.tie(NULL);
int main() 
{
  //freopen("in.txt","r",stdin);
  //freopen("out.txt","w",stdout); 
    ios;
    int n;
    cin>>n;
    int ar[n];
     f(i,0,n)cin>>ar[i];
     sort(ar,ar+n);
     int m=n/2;
     if(n%2==0&&ar[m]!=ar[m-1])
      cout<<ar[m]-ar[m-1];
      else
      {
      	 cout<<0;
	  }
	  
       
}


Measured memory_bytes: 640
N = int(input())
tall = list(map(int, input().split()))
step = [0]*N
sum_step = 0

for i in range(0, N-1):
    if tall[i]+step[i] > tall[i+1]:
        step[i+1] = tall[i] - tall[i+1] + step[i]
        sum_step += step[i+1]
        
print(sum_step)

Measured memory_bytes: 32360
#include<bits/stdc++.h>
 
 
using namespace std;
 
int n,k,q,a,dizi[100005]={0};

int main(){
	
	scanf("%d %d %d",&n,&k,&q);
	
	for(int i=0;i<q;i++){
		scanf("%d",&a);
		dizi[a]++;
	}
	int x;
	for(int i=1;i<=n;i++){
		x=q-dizi[i];
		x=k-x;
		if(x<=0)
			printf("No\n");
		else
			printf("Yes\n");
	}
}

Measured memory_bytes: 1024
#include<cstdio>
#include<algorithm>
using namespace std;
int main(void)
{
	int n,m,d,flg1,flg2,i,j,k,cnt;
	char s[100][101];
	scanf("%d %d %d",&n,&m,&d);
	for(i=0;i<n;i++){
		scanf("%s",s[i]);
	}
	cnt=0;
	for(i=0;i<n;i++){
		for(j=0;j<m;j++){
			flg1=0;
			flg2=0;
			for(k=0;k<d;k++){
				if(s[i+k][j]=='#'||i+k>=n){
					flg1=1;
				}
				if(s[i][j+k]=='#'||j+k>=m){
					flg2=1;
				}
			}
			if(flg1==0){
				cnt++;
			}
			if(flg2==0){
				cnt++;
			}
		}
	}
	printf("%d\n",cnt);
	return 0;
}


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

// #define int long long
#define rep(i, n) for (long long i = (long long)(0); i < (long long)(n); ++i)
#define reps(i, n) for (long long i = (long long)(1); i <= (long long)(n); ++i)
#define rrep(i, n) for (long long i = ((long long)(n)-1); i >= 0; i--)
#define rreps(i, n) for (long long i = ((long long)(n)); i > 0; i--)
#define irep(i, m, n) for (long long i = (long long)(m); i < (long long)(n); ++i)
#define ireps(i, m, n) for (long long i = (long long)(m); i <= (long long)(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) long long(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>>;
using vtp = vector<tuple<ll,ll,ll>>;
using vb = vector<bool>;

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 = 1e9;
const ll MOD = 998244353;
const ll LINF = 1e18;



signed main()
{
  cin.tie( 0 ); ios::sync_with_stdio( false );
  ll n; cin>>n;
  // iの累積和を取っていき、初めて累積和がn以上となるiについて考えると
  // iまでの値で必ずnを作ることができる
  // また、累積和がnを超過する場合を考えると、超過分の値の範囲はせいぜいi-1までなので
  // iより手前の要素から超過分に対応する値を取り除けばよいと分かる
  vll sum(n+1);
  ll ma=0;
  reps(i,n){
    sum[i]+=sum[i-1]+i;
    if(sum[i]>=n){
      ma=i;
      break;
    }
  }
  reps(i,ma){
    if(sum[ma]-n==i) continue;
    cout<<i<<endl;
  }
  
}

Measured memory_bytes: 78464
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define P pair<int,int>
using ll=int64_t;
using namespace std;
#define ketasuu(n) fixed<<setprecision(n)
#define btoe(p) p.begin(),p.end()
#define etob(p) p.rbegin(),p.rend()




int main(){
    int n,m;
    cin>>n>>m;
    vector<int> h(n);
    rep(i,n) cin>>h[i];
    vector<int> ans(n,1);
    rep(i,m){
        int a,b;
        cin>>a>>b;
        if(h[a-1]<=h[b-1]) ans[a-1]=0;
        if(h[a-1]>=h[b-1]) ans[b-1]=0;
    }
    int fans=0;
    rep(i,n){
        if(ans[i]==1) fans++;
    }
    cout<<fans<<endl;
}

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

typedef long long ll;

int main(){
    int a, b;
    cin >> a >> b;
    bool res = false;
    for (int c = 1; c <= 3; c++){
        if (a * b * c % 2 == 1) res = true;
    }
    if (res) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
}


Measured memory_bytes: 256
import java.util.Scanner;

class MathUtil {
	public static void swap(int[] obj, int a, int b) {
		int tmp = obj[a];
		obj[a] = obj[b];
		obj[b] = tmp;
	}
}

class Dice {
	int N=6;
	int ten[] = new int[N+1];

	public Dice(int[] tenkaizu) {
		for(int i=1;i<=N;i++) {
			this.ten[i] = tenkaizu[i-1];
		}
	}

	public int showDice(int number) {
		return ten[number];
	}

	public void printDice() {
	    for(int i=1;i<=N;i++) {
            System.out.print(ten[i] + "\t");
        }
        System.out.println("");
    }

	public void rotate(String meirei) {
		switch (meirei) {
			case "N":
				rotate(1, 2, 6, 5);
				break;
			case "S":
				rotate(5,6, 2, 1);
				break;
			case "E":
				rotate(4, 6, 3, 1);
				break;
			case "W":
				rotate(1, 3, 6, 4);
				break;
		}
	}

	public void rotate(int a, int b, int c, int d) {
		MathUtil.swap(ten, a, b);
		MathUtil.swap(ten, b, c);
		MathUtil.swap(ten, c, d);
	}

	public void rotate(int a, int b, int c) {
		MathUtil.swap(ten, a, b);
		MathUtil.swap(ten, b, c);
	}
}

public class Main {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		String[] men_str = in.nextLine().split(" ");
		int[] men_int = new int[6];
		for(int i=0;i<6;i++) {
			men_int[i] = Integer.parseInt(men_str[i]);
		}
		Dice dice = new Dice(men_int);
		String meireiStr = in.nextLine();
		for(int i=0;i<meireiStr.length();i++) {
			dice.rotate(new String(""+meireiStr.charAt(i)));
		}
		System.out.println(dice.showDice(1));
	}
}

Measured memory_bytes: 26060
#include <algorithm>
#include <cctype>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <vector>

using namespace std;

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

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> pii;

const int INF = 1001001001;

pii convert(const char* str)
{
	return pii(str[0]-'a', atoi(str+2)-1);
}

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

struct Data
{
	int y, x, d, t;
	Data(int y, int x, int d, int t) : y(y), x(x), d(d), t(t) {}
	bool operator< (const Data& d)const{
		return t > d.t;
	}
};

int main()
{
	int h, w;
	while(scanf("%d%d", &h, &w), h){
		int D, ns;
		scanf("%d%d", &D, &ns);

		int sign[20][20] = {{0}};
		rep(i, ns){
			char str[128];
			int k;
			scanf("%s%d", str, &k);
			pii p = convert(str);
			sign[p.first][p.second] = k;
		}

		bool work[20][20][4] = {{{false}}};
		int nc;
		scanf("%d", &nc);
		rep(i, nc){
			char str1[128], str2[128];
			scanf("%s%s", str1, str2);
			pii p1 = convert(str1), p2 = convert(str2);
			rep(j, 4){
				if(pii(p1.first+dy[j], p1.second+dx[j]) == p2){
					work[p1.first][p1.second][j] = true;
					work[p2.first][p2.second][(j+2)%2] = true;
					break;
				}
			}
		}

		int cost[20][20][4] = {{{0}}};
		int nj;
		scanf("%d", &nj);
		rep(i, nj){
			char str1[128], str2[128];
			int d;
			scanf("%s%s%d", str1, str2, &d);
			pii p1 = convert(str1), p2 = convert(str2);
			rep(j, 4){
				if(pii(p1.first+dy[j], p1.second+dx[j]) == p2){
					cost[p1.first][p1.second][j] = d;
					cost[p2.first][p2.second][(j+2)%2] = d;
					break;
				}
			}
		}

		char str1[128], str2[128];
		scanf("%s%s", str1, str2);
		pii start = convert(str1), goal = convert(str2);

		int ans = -1;
		bool visited[20][20][4][101] = {{{{false}}}};
		priority_queue<Data> Q;
		Q.push(Data(start.first, start.second, 3, 0));
		while(!Q.empty()){
			Data d = Q.top();
			Q.pop();
			if(visited[d.y][d.x][d.d][d.t])
				continue;
			visited[d.y][d.x][d.d][d.t] = true;
			if(d.y==goal.first && d.x==goal.second){
				ans = d.t;
				break;
			}
			rep(i, 4){
				if(abs(d.d-i) == 2 || work[d.y][d.x][i])
					continue;

				int py = d.y + dy[i];
				int px = d.x + dx[i];
				if(py<0 || h<=py || px<0 || w<=px)
					continue;

				int pt = d.t + D + cost[d.y][d.x][i];
				if(sign[py][px]==0 || (((pt/sign[py][px])%2) ^ (i%2==0))){
					Q.push(Data(py, px, i, pt));
				}
			}
		}
		printf("%d\n", ans);
	}
	return 0;
}

Measured memory_bytes: 1320
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define all(vec) vec.begin(), vec.end()
#define tmax(x,y,z) max((x),max((y),(z)))
#define tmin(x,y,z) min((x),min((y),(z)))
typedef long long ll; ll MM = 1000000000;ll mod = MM + 7; ll MMM=9223372036854775807;//2^63 -1
ll GCD(ll x, ll y) {if (y == 0) return x;else return GCD(y, x % y);}
ll LCM(ll x, ll y) { return x / GCD(x, y) * y;}
//cout << fixed << setprecision(10);
ll fac(ll x){if(x==0) return 1;  return x*fac(x-1);}

int main(){
    string s,t,u; cin>>s>>t>>u;
    cout<<s[0]<<t[1]<<u[2];
}

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

#define ll long long
#define mp make_pair
#define pb push_back
#define F first
#define S second
#define FOR(I,N) for(I=0;I<N;++I)
ll n,k;
vector<ll> h, memo;

ll DP(ll x)
{
	if(memo[x] != -1)
		return memo[x];				
	ll p = 1e9;	
	for(ll i=1;i<=k && (x+i<n);++i)
	{
		p = min(p,(DP(x+i)+abs(h[x]-h[x+i])));
	}										
	memo[x]=p;
	return memo[x];
}

int main()
{
	ll i,j;
	cin>>n>>k;	
	FOR(i,n)
	{	
		cin>>j;
		h.pb(j);
		memo.pb(-1);
	}
	memo[n-1]=0;
	memo[n-2]= abs(h[n-1]-h[n-2]);
	cout<<DP(0);
}

Measured memory_bytes: 6764
#include <stdio.h>

int main (void) {
  int tmp,i,j;
  int height[10];
  
  for (i=0;i<10;i++) scanf("%d",&height[i]);
  
  for (i=0;i<10;i++) {
    for(j=i+1;j<10;j++) {
      if (height[i] < height[j]) {
        tmp = height[i];
        height[i] = height[j];
        height[j] = tmp;
      }
    }
  }
  
  for (i=0;i<3;i++) {
    printf("%d\n",height[i]);
  }
  
  return 0;
}

Measured memory_bytes: 600