akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
using namespace std;

int main() {
    string s,t;
    cin>>s>>t;
    int n=s.length();
    int m=t.length();
    int dp[n+1][m+1];
    for(int i=0;i<=m;i++){
        dp[0][i]=0;
    }
    for(int i=0;i<=n;i++){
        dp[i][0]=0;
    }
    for(int i=1;i<=n;i++){
        for(int j=1;j<=m;j++){
            if(s[i-1]==t[j-1]){
                dp[i][j]=1+dp[i-1][j-1];   
            }
            else{
                dp[i][j]=max(dp[i-1][j],dp[i][j-1]);
            }
        }
    }
    int i=n;
    int j=m;
    string ans="";
    int len=dp[n][m];
    while(len>0){
        if(s[i-1]==t[j-1]){
        	ans=s[i-1]+ans;
            i--;
            j--;
            len--;
        }
        else{
        if(dp[i][j-1]>dp[i-1][j]){
            j--;
        }
        else{
            i--;
        }
        }
    }
    cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 38820
import java.util.*;
import java.io.*;

class Main {

	void solve() {
		
		int n = inint();
		long sum = 0;
		for (int i=1; i<=n; i++) sum += i;
		out.println(sum);
		
	}

	public static Scanner in = new Scanner(System.in);
	public static PrintWriter out = new PrintWriter(System.out);

	public static void main(String[] args) {
		new Main().solve();
		out.flush();
	}

	public int inint() {
		return in.nextInt();
	}

	public long inlong() {
		return in.nextLong();
	}

	public String instr() {
		return in.next();
	}

	public char inchar() {
		return in.next().charAt(0);
	}

	public int[] inintar(int num) {
		int[] a = new int[num];
		for (int i=0; i<num; i++) {
			a[i] = in.nextInt();
		}
		return a;
	}

	public char[] incharar() {
		return in.next().toCharArray();
	}

	public char[][] incharmap(int h, int w) {
		char[][] a = new char[h][w];
		for (int i=0; i<h; i++) {
			String temp = in.next();
			for (int j=0; j<w; j++) {
				a[i][j] = temp.charAt(j);
			}
		}
		return a;
	}

}

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

using ll = long long;
using ull = unsigned long long;
using ld = long double;
#define REP(NAME, NUM) for (int NAME = 0; NAME < (NUM); ++NAME)
#define BREP(NAME, NUM) for (int NAME = (NUM)-1; NAME >= 0; --NAME)
#define ALL(NAME) (NAME).begin(), (NAME).end()
#define VEC(TYPE, A, NAME, INIT) vector<TYPE> NAME(A, INIT)
#define VEC2(TYPE, A, B, NAME, INIT) vector<vector<TYPE>> NAME(A, vector<TYPE>(B, (INIT)))

int main()
{
	int a, b, c, d;
	cin >> a >> b >> c >> d;
	int s = ( a -c ) * ( b - d );
	cout << s << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
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; }
int h,w;
vector<string>s;
int main(){
 cin>>h>>w;
s.resize(h);
vector<vector<int>> a(h,vector<int>(w,0));
 for(int i=0;i<h;i++){
     cin>>s.at(i);
 }
 int ans=0;
for(int i=0;i<h;i++){
    for(int j=0;j<w;j++){
        if(s.at(i).at(j)=='#')continue;
        int res=0;
        while(j+res<w){
            if(s.at(i).at(j+res)=='#')break;
            res++;
        }
        for(int k=j;k<j+res;k++){
            a.at(i).at(k)+=res;
        }
        j+=res;
    }
}
for(int j=0;j<w;j++){
    for(int i=0;i<h;i++){
        if(s.at(i).at(j)=='#')continue;
        int res=0;
        while(i+res<h){
            if(s.at(i+res).at(j)=='#')break;
            res++;
        }
        for(int k=i;k<i+res;k++){
            a.at(k).at(j)+=res;
        }
        i+=res;
    }
}
for(int i=0;i<h;i++){
    for(int j=0;j<w;j++){
        chmax(ans,a.at(i).at(j));
    }
}



cout<<ans-1<<endl;
}

Measured memory_bytes: 20096
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0;i < (n);i++)
using namespace std;
  
int main () {
  int a[5];
  rep(i,5) cin >> a[i];
  int k;
  cin >> k;
    if(a[4] - a[0] > k) {
      cout << ":(";
      return 0;
    }
  cout << "Yay!";
}


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

import os
import sys
import itertools
import math
from collections import Counter, defaultdict

class Main(object):
    
    def __init__(self):
        pass

    def solve(self):
        '''
        insert your code
        '''
        while True:
            w, h = map(int, raw_input().split())
            if w == h == 0:
                break
            m = []
            for i in range(1, h+1):
                row = list(raw_input())
                m.append(row)
            # for row in m:
            #     print row
            # print 
            d = [(0, 1), (1, 0), (0, -1), (-1, 0)]
            w_count = 0
            b_count = 0
            for i in range(h):
                for j in range(w):
                    if m[i][j] == '.':
                        q = [(i, j)]
                        flg = None
                        count = 0
                        while q:
                            y, x = q.pop()
                            if m[y][x] == '.':
                                count += 1
                            m[y][x] = 'U'
                            for dy, dx in d:
                                if 0 <= y + dy < h and 0 <= x + dx < w:
                                    if m[y+dy][x+dx] == 'W':
                                        if flg is None:
                                            flg = 'W'
                                        elif flg == 'B':
                                            flg = 'NotOccupied'
                                    elif m[y+dy][x+dx] == 'B':
                                        if flg is None:
                                            flg = 'B'
                                        elif flg == 'W':
                                            flg = 'NotOccupied'
                                    elif m[y+dy][x+dx] == '.':
                                        q.append((y + dy, x + dx))
                                                                            
                        if flg == 'W':
                            w_count += count
                        elif flg == 'B':
                            b_count += count
                        # for row in m:
                        #     print row
                        # print b_count, w_count
                        # print 
                            
            print b_count, w_count
                                                
                                    
        return None

if __name__ == '__main__':
    m = Main()
    m.solve()

Measured memory_bytes: 4872
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Scanner;
import java.util.Set;
 
 
public class Main {

	static long MOD = 1_000_000_007;
	public static void main(String[] args) throws Exception {
		// TODO Auto-generated method stub
		//int N = Integer.parseInt(sc.next());
		//long L = Long.parseLong(sc.next());
		int INF = 1_000_000_007;
		Scanner sc = new Scanner(System.in);
		char[] A = sc.next().toCharArray();
		int N = A.length;
		int[] dp = new int[N+1];
		Arrays.fill(dp, INF);
		int[][] next = new int[N+1][26];
		for(int[] next_ : next){
			Arrays.fill(next_, N+1);
		}
		for(int i=N-1; i>=0; i--){
			for(int j=0;j<26;j++)next[i][j] = next[i+1][j];
			next[i][A[i]-'a'] = i+1;
		}
		
		/*
		for(int i=0; i<N+1;i++){
			for(int j=0; j<26;j++){
				System.out.print(next[i][j]+"\t");
			}
			System.out.println();
		}
		*/
		
		//System.out.println(next[0][0]);
		dp[N] = 1;
		
		for(int i=N; i>=0; i--){
			for(int j=0; j<26; j++){
				if(next[i][j] == N+1){
					dp[i] = 1;
				}else{
					dp[i] = Math.min(dp[next[i][j]]+1,dp[i]);
				}
			}
		}
		/*
		for(int i=0;i<N+1;i++)System.out.print(dp[i]);
		System.out.println();
		*/
		
		StringBuilder ans = new StringBuilder("");
		int index = 0;
		while(index <= N){
			if(dp[index] == 1){
				for(int j=0;j<26;j++){
					boolean isNotExist = true;
					for(int i=index;i<N;i++){
						if(A[i] == (char)('a'+j)){
							isNotExist = false;
							break;
						}
					}
					if(isNotExist){
						ans.append((char)('a'+j));
						index = N+1;
						break;
					}
				}
			}else{
				for(int j=0; j<26; j++){
					if(dp[index] == dp[next[index][j]]+1){
						//System.out.println("(っ＾ω＾ｃ)");
						ans.append((char)('a'+j));
						index = next[index][j];
						break;
					}
				}
				//index++;
			}
		}
		
		
		System.out.println(ans);
		
	}
	static long lcm (long a, long b) {
		long temp;
		long c = a;
		c *= b;
		while((temp = a%b)!=0) {
			a = b;
			b = temp;
		}
		return (c/b);
	}
}



Measured memory_bytes: 57040
import java.util.*;
import java.io.*;

public class Main {

	public static String s, t;
	public static int[][] dp;

	public static String recurse(int i, int j) {
		if (dp[i][j] == 0)
			return "";
		if (s.charAt(i-1) == t.charAt(j-1))
			return recurse(i - 1, j - 1) + s.charAt(i-1);
		else if (dp[i - 1][j] > dp[i][j - 1])
			return recurse(i - 1, j);
		else
			return recurse(i, j - 1);

	}

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

		dp = new int[s.length() + 1][t.length() + 1];
		for (int i = 1; i <= s.length(); i++) {
			for (int j = 1; j <= t.length(); j++) {
				if (s.charAt(i-1) == t.charAt(j-1))
					dp[i][j] = dp[i - 1][j - 1] + 1;
				else
					dp[i][j] = Math.max(dp[i - 1][j], dp[i][j - 1]);
			}
		}
		System.out.println(recurse(s.length(), t.length()));
	}

}


Measured memory_bytes: 98772
using System;
using System.Collections.Generic;
using System.Linq;

namespace test
{
    class MainClass
    {
        public static void Main(string[] args)
        {

            //問題155

            string[] line = Console.ReadLine().Split(' ');

            int a = int.Parse(line[0]);
            int b = int.Parse(line[1]);
            int c = int.Parse(line[2]);

            if ((a == b && b != c) || (b == c && c != a) || (a == c && b != c))
                Console.WriteLine("Yes");
            else
                Console.WriteLine("No");

        }

    }





    
}


Measured memory_bytes: 27480
#include<cstdio>
const int md=1e9+7,N=1007;
typedef long long LL;
int n,A,B,C,D,F[N][N],fac[N],iv[N];
inline int pow(int a,int b){
	int ret=1;
	for(;b;b>>=1,a=(LL)a*a%md)if(b&1)ret=(LL)ret*a%md;
	return ret;
}
int main(){
	scanf("%d%d%d%d%d",&n,&A,&B,&C,&D);
	for(int i=*fac=1;i<=n;++i)fac[i]=(LL)fac[i-1]*i%md;
	iv[n]=pow(fac[n],md-2);
	for(int i=n-1;~i;--i)iv[i]=(i+1LL)*iv[i+1]%md;
	F[A-1][0]=1;
	for(int i=A;i<=B;++i)
	for(int j=0;j<=n;++j){
		int&f=F[i][j];f=F[i-1][j];
		for(int k=C,g=pow(iv[i],C);k<=D&&k*i<=j;++k,g=(LL)g*iv[i]%md){
			int L=n-j+k*i;
			f=(f+(LL)F[i-1][j-k*i]*fac[L]%md*iv[k*i]%md*iv[L-k*i]%md*fac[k*i]%md*g%md*iv[k])%md;
		}
	}
	printf("%d\n",F[B][n]);
	return 0;
}

Measured memory_bytes: 4096
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using lb = long double;
using P = pair<ll,ll>;
//マクロ
//forループ関係
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
//xにはvectorなどのコンテナ
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x)) //最大値を求める
#define MIN(x) *min_element(ALL(x)) //最小値を求める
#define debug(x) cerr << #x << ": " << x << "\n"//手動デバッグ
//定数
#define INF 1000000000000 //10^12:極めて大きい値,∞
#define inf 2147483647 //int値の最大値
#define MOD 1000000007 //10^9+7:合同式の法
#define MAXR 100000 //10^5:配列の最大のrange(素数列挙などで使用)
#define endl "\n"//endlを置き換える
//略記
#define PB push_back //vectorヘの挿入
#define MP make_pair //pairのコンストラクタ
#define F first //pairの一つ目の要素
#define S second //pairの二つ目の要素
#define CST(x) cout<<fixed<<setprecision(x)//小数点以下の桁数指定
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
int gcd(int a, int b) {
    if (b==0) return a;
    else return gcd(b, a%b);
}
int lcm(int a, int b) {
    return a * b / gcd(a, b);
}
int two(int n){
  ll ans=1;
  rep(i,n){
    ans*=2;
  }
  return ans;
}
bool check(vector<ll> v,vector<ll> lim){
  bool nuke=0;
  rep(i,4){
    if(v[i]>lim[i]){
      nuke=1;
      break;
    }
  }
  return nuke;
}
int main() {
  cin.tie(0);
  cout.tie(0);
  ios::sync_with_stdio(0);
  //##########################################################CODE_START
  string s;cin>>s;
  rep(i,26){
    if(s.find(char(i+97))==-1){
      cout<<char(i+97);
      return 0;
    }
  }
  cout<<"None"<<endl;
  
  
  
  
  
  
  
  
  //##########################################################CODE_END
  return 0;
}

Measured memory_bytes: 3696
#include<bits/stdc++.h>
using namespace std;
int main(){
  int i,j,n;
  int s=0;
  cin>>n;
  vector<int> A(n);
  for(i=0;i<n;++i){
    cin>>A[i];
  }
  for(j=1;j<n-1;++j){
    if(A[j-1]>A[j] && A[j]>A[j+1]){
      s=s+1;
    }
    else if(A[j-1]<A[j] && A[j]<A[j+1]){
      s=s+1;
    }
    else{
      s=s;
    }
  }
  cout << s << endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
        using namespace std;
         
        int main(){
          int64_t N;
          cin >> N;
          vector<int64_t> A(N+1);
          for(int64_t i=0; i<=N; i++){
            cin >> A.at(i);
          }
          vector<int64_t> Up(N+1);
          vector<int64_t> Down(N+1);
          Up.at(0)=1;
          for(int64_t i=1; i<=N; i++){
            if(Up.at(i-1)-A.at(i-1)>9223372036854775807/2+1){
              Up.at(i)=9223372036854775807;
            }
            else{
              Up.at(i)=(Up.at(i-1)-A.at(i-1))*2;
            }
          }
          Down.at(N)=A.at(N);
          for(int64_t i=N-1; i>=0; i--){
            Down.at(i)=Down.at(i+1)+A.at(i);
          }
          int64_t Ans=0;
          int64_t M=0;
          if(A.at(0)==1 && N==0){
            cout << 1 << endl;
            goto finish;
          }
          if(A.at(0)!=0){
            cout << -1 << endl;
            goto finish;
          }
          for(int64_t i=0; i<=N; i++){
            M=min(Up.at(i), Down.at(i));
            if(A.at(i)>M){
              cout << -1 << endl;
              goto finish;
            }
            else{
              Ans+=M;
            }
          }
          if(N==0){
            cout << 1 << endl;
            goto finish;
          }
          cout << Ans << endl;
          finish: N=0;
        }

Measured memory_bytes: 5580
count = {}
for ch in 'a'..'z'
  count[ch] = 0
end

s = gets
for ch in s.chomp.split("")
  count[ch] = count[ch] + 1
end

found = false
for ch in 'a'..'z'
  if count[ch] == 0
    puts ch
    found = true
    break
  end
end

if not found
  puts "None"
end


Measured memory_bytes: 6908
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007

int main() {
  
  long long N,ans = 0;
  cin >> N;

  vector<long long> res(0);
  for(long long i = 1LL;i*i <= N;i++) {
    if(N%i==0) {
      res.push_back(i);
      long long j = N / i;
      if(i != j) res.push_back(j);
    }
  }

  sort(res.begin(),res.end());
  for(int i = 1;i < res.size();i++) {
    if(N % (res.at(i)-1) == N / (res.at(i)-1)) ans += res.at(i)-1;
  }
  
  cout << ans << endl;

}






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

const int MAX_N = 100010;

int par[MAX_N], uniteRank[MAX_N];
int uniteSize[MAX_N];

void uniteInit(int n)
{
    for (int i = 0; i < n; i++)
    {
        par[i] = i;
        uniteRank[i] = 0;
        uniteSize[i] = 1;
    }
}

int root(int x)
{
    return par[x] == x ? x : par[x] = root(par[x]);
}

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

void unite(int x, int y)
{
    x = root(x);
    y = root(y);
    if (x == y)
        return;
    if (uniteRank[x] < uniteRank[y])
    {
        par[x] = y;
        uniteSize[y] += uniteSize[x];
    }
    else
    {
        par[y] = x;
        uniteSize[x] += uniteSize[y];
        if (uniteRank[x] == uniteRank[y])
        {
            uniteRank[x]++;
        }
    }
}

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N, M, K;
    cin >> N >> M >> K;
    uniteInit(N + 1);
    vector<vector<ll>> friendEdge(N + 1);
    vector<vector<ll>> blockEdge(N + 1);
    for (int i = 0; i < M; i++)
    {
        ll A, B;
        cin >> A >> B;
        friendEdge.at(A).push_back(B);
        friendEdge.at(B).push_back(A);
        unite(A, B);
    }
    for (int i = 0; i < K; i++)
    {
        ll C, D;
        cin >> C >> D;
        blockEdge.at(C).push_back(D);
        blockEdge.at(D).push_back(C);
    }
    vector<ll> answers(N + 1);
    for (int i = 1; i <= N; i++)
    {
        ll count = uniteSize[root(i)] - 1;
        for (ll edgeNum : friendEdge.at(i))
        {
            if(same(i, edgeNum))
            {
                count--;
            }
        }

        for (ll edgeNum : blockEdge.at(i))
        {
            if(same(i, edgeNum))
            {
                count--;
            }
        }
        answers.at(i) = count;
    }
    for (int i = 1; i <= N; i++)
    {
        if (i > 1)
        {
            cout << " ";
        }
        cout << answers.at(i);
    }
    cout << endl;
    return 0;
}


Measured memory_bytes: 14964
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <set>
#include <map>
using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef vector< vector<int> > VII;
typedef pair<int,int> P;
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(a) (a).begin(),(a).end()

int main(){
  int N;
  cin>>N;
  VI B(N-1);
  rep(i,N-1) cin>>B[i];
  int ans=0;
  rep(i,N-2) ans+=min(B[i],B[i+1]);
  ans+=B[0]+B[N-2];
  cout<<ans<<endl;
}




Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include<iostream>
#include<algorithm>
#include<math.h>
#include<cmath>
#include<string>
#include<set>
#include<map>
#include<stdlib.h>
#include<stdio.h>
#include<vector>
#include<utility>
#include<stdbool.h>
using namespace std;
typedef long long ll;
#define N (1000000000+7)

int main(void) {
	ll a, b;
	cin >> a >> b;
	if (a >= 0) {
		if (a > 0) {
			cout << "Positive" << endl;
			return 0;
		}
		else {
			cout << "Zero" << endl;
			return 0;
		}
	}
	else {
		if (b >= 0) {
			cout << "Zero" << endl;
			return 0;
		}
		else {
			if ((b - a + 1) % 2 == 0) {
				cout << "Positive" << endl;
				return 0;
			}
			else {
				cout << "Negative" << endl;
				return 0;
			}
		}
	}
	return 0;
}

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

using namespace std;

int main() {
    int n;
    long long k;
    cin >> n >> k;
    vector< vector<int> > a(n);
    for (int i = 0; i < n; i++) {
        a[i].resize(2);
        cin >> a[i][0] >> a[i][1];
    }
    sort(a.begin(), a.end(), [](auto& x, auto& y){return x[0] < y[0];});
    long long cnt = 0;
    for (int i = 0; i < n; i++) {
        cnt += a[i][1];
        if (k <= cnt) {
            cout << a[i][0] << endl;
            break;
        }
    }

    return 0;
}


Measured memory_bytes: 5760
//競技プログラミング用のテンプレート
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <queue>
#include <string>
#include <math.h>
#include <stack>
#include <limits>

#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define repr(i, n) for(int i = n - 1; i >= 0; i--)

using namespace std;
//エイリアス
using ll = long long int;
using p = pair<int, int>;
using pl = pair<ll, ll>;
using v = vector<int>;
using vd = vector<double>;
using vs = vector<string>;
using vl = vector<ll>;

//定数
const int intmax = numeric_limits<int>::max();
const ll llmax = numeric_limits<ll>::max();
const ll mod = 1e9 + 7;
const double pi = M_PI;

ll median(vl &target) {
  int size = target.size();
  if (size % 2 == 0) {
    size--;
    return target[size / 2] + target[(size / 2) + 1];
  } else {
    return target[size / 2];
  }
}

int main()
{
  int n;
  cin >> n;
  vl as(n, 0);
  vl bs(n, 0);
  rep(i, n) {
    ll a, b;
    cin >> a >> b;
    as[i] = a;
    bs[i] = b;
  }
  sort(as.begin(), as.end());
  sort(bs.begin(), bs.end());
  ll amedian = median(as);
  ll bmedian = median(bs) + 1;
  if(n % 2 == 0) {
    cout << (bmedian - amedian) << endl;
  } else {
    cout << (bmedian - amedian) << endl;
  }
}


Measured memory_bytes: 6408
n=int(input())
t =list(map(int, input().split()))
s=0
counter=0
for i in t:
    if s==0:
        s+=1
        left=i
        continue
    if s==1:
        s+=1
        mid=i
        continue

    if left>mid:
        if mid>i:
            counter+=1
    if left<mid:
        if mid<i:
            counter+=1
    left=mid
    mid=i

print(counter)


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

int main() {
  int N,n,M;
    cin >> N ;
  n=N%1000;
  M=(N-N%10)/10;
  if (n%111==0){
    cout << "Yes" << endl;
  }
    else if (M%111==0){
    cout << "Yes" << endl;
    }
  else {cout << "No" << endl;
       }}


Measured memory_bytes: 256
import java.util.Scanner;

class Solver {
	static final Solver INSTANCE = new Solver();

	void solve(Scanner sc) {
		int H = sc.nextInt();
		int W = sc.nextInt();
		int N = sc.nextInt();

		if (H > W) {
			int swap = H;
			H = W;
			W = swap;
		}

		int sum = 0;
		for (int i = 0; i < H; i++) {
			if (sum >= N){
				System.out.println(i);
				return;
			}
			sum += W;
		}
		System.out.println(H);
	}
}

class Main {
	public static void main(String... args) {
		Scanner in = new Scanner(System.in);

		Solver.INSTANCE.solve(in);

		in.close();
	}
}

Measured memory_bytes: 21588
#pragma GCC optimize("Ofast")
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <iomanip> // setprecision
#include <complex> // complex
#include <math.h> 
#include <functional>
using namespace std;
using ll = long long;
using P = pair<int,int>;
constexpr ll INF = 1e18;
constexpr int inf = 1e9;
constexpr ll mod2 = 1000000007;
constexpr ll mod = 998244353;
const int dx[8] = {1, 0, -1, 0,1,1,-1,-1};
const int dy[8] = {0, 1, 0, -1,1,-1,1,-1};
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; }
// --------------------------------------------------------------------------

int main(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int N;
  cin >> N;
  vector<int> A(N);
  bool can = false;
  for(int i=0; i<N; i++){
    cin >> A[i];
    if(A[i]%2){
      can = true;
    }
  }  
  if(can){
    cout << "first\n";
  }else{
    cout << "second\n";
  }
  return 0;
}

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

int main() {
  int h,w;
  char board_a[100][100],board_b[102][102];
  cin >> h >> w;
  for(int i=0; i<h; i++){
    cin >> board_a[i];
  }
  for (int i=0; i<h+2; i++){
    for (int j=0; j<w+2; j++){
      board_b[i][j] = '#';
    }
  }
  for (int i=0; i<h; i++){
    for (int j=0; j<w; j++){
      board_b[i+1][j+1]=board_a[i][j];
    }
  }
  for (int i=0; i<h+2; i++){
    for (int j=0; j<w+2; j++){
      cout << board_b[i][j];
    }
    cout << endl;
  }
}

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

constexpr double eps = 1e-8;

struct exp_tree;
using tree_ptr = shared_ptr<exp_tree>;

struct exp_tree {
    tree_ptr lch, rch;
    double asym;
    bool leaf;
    exp_tree() : lch(nullptr), rch(nullptr), asym(0), leaf(true) {}
    string to_string(bool is_sort) const {
        assert(leaf || (lch && rch));
        if(leaf) return "x";
        auto s1 = lch->to_string(is_sort), s2 = rch->to_string(is_sort);
        if(is_sort && s1 > s2) swap(s1, s2);
        return "(" + s1 + " " + s2 + ")";
    }
    double value() const {
        return asym;
    }
    bool operator<(exp_tree const& other) const { // lch.asym < rch.asym ?
        if(other.leaf) return false;
        if(leaf) return true;
        if(abs(value() - other.value()) < eps) {
            auto lmin = min(*lch, *rch);
            auto rmin = min(*other.lch, *other.rch);
            if(!(lmin < rmin) && !(rmin < lmin)) {
                auto lmax = max(*lch, *rch);
                auto rmax = max(*other.lch, *other.rch);
                return lmax < rmax;
            }
            return lmin < rmin;
        }
        return value() < other.value();
    }
    set<string> eval() {
        set<string> ss;
        if(leaf) {
            ss.insert(this->to_string(true));
            return ss;
        }
        auto ls = lch->eval(), rs = rch->eval();
        double same = 0;
        ss = move(rs);
        for(auto&& s : ls) {
            same += ss.count(s);
            ss.insert(s);
        }
        ss.insert(this->to_string(true));
        asym = same / (ss.size() - 1);
        return ss;
    }

    void swap_dfs(bool is_left) {
        if(leaf) return;
        if((*lch < *rch && !is_left) || (!(*lch < *rch) && is_left)) {
            swap(lch, rch);
        }
        lch->swap_dfs(true);
        rch->swap_dfs(false);
    }
};

tree_ptr expr(string const& s, int& p) {
    tree_ptr res = make_shared<exp_tree>();
    assert(p < (int)s.size());
    if(s[p] == 'x') {
        p += 1;
        return res;
    }
    res->leaf = false;
    res->lch = expr(s, ++p);
    res->rch = expr(s, ++p);
    p += 1;
    return res;
}

tree_ptr parse(string const& s) {
    int p = 0;
    return expr(s, p);
}

int main() {
    string s;
    while(getline(cin, s), s[0] != '0') {
        auto t = parse(s);
        t->eval();
        t->swap_dfs(true);
        cout << t->to_string(false) << endl;
    }
}



Measured memory_bytes: 3088
import sys
input = sys.stdin.readline
# 文字列をinput()した場合、末尾に改行が入るので注意
def main(R,C,K,rcv):
  inf=float('inf')
  dp0=[[-inf,-inf,-inf,0] for _ in range(C)]
  dp1=[[-inf]*4 for _ in range(C)]
  dp0[0][3]=0
  rcv.sort(key=lambda x:C*R*x[0]+x[1])
  i=0
  nowc=0
  while i<K and rcv[i][0]==1:
    nextc=rcv[i][1]-1
    for j in range(nowc+1,nextc+1):
      dp0[j][0]=dp0[nowc][0]
      dp0[j][1]=dp0[nowc][1]
      dp0[j][2]=dp0[nowc][2]
    v=rcv[i][2]
    dp0[nextc][0]=max(dp0[nextc][0],dp0[nextc][1]+v)
    dp0[nextc][1]=max(dp0[nextc][1],dp0[nextc][2]+v)
    dp0[nextc][2]=max(dp0[nextc][2],dp0[nextc][3]+v)
    i+=1
    nowc=nextc
    for j in range(nowc+1,C):
      dp0[j][0]=dp0[nowc][0]
      dp0[j][1]=dp0[nowc][1]
      dp0[j][2]=dp0[nowc][2]
  for j in range(1,R):
    for c in range(C):
      dp0[c][3]=max(dp0[c])
      dp0[c][2]=-inf
      dp0[c][1]=-inf
      dp0[c][0]=-inf
    nowc=0
    while i<K and rcv[i][0]==j+1:
      nextc=rcv[i][1]-1
      for k in range(nowc+1,nextc+1):
        dp0[k][0]=dp0[nowc][0]
        dp0[k][1]=dp0[nowc][1]
        dp0[k][2]=dp0[nowc][2]
      v=rcv[i][2]
      dp0[nextc][0]=max(dp0[nextc][0],dp0[nextc][1]+v)
      dp0[nextc][1]=max(dp0[nextc][1],dp0[nextc][2]+v)
      dp0[nextc][2]=max(dp0[nextc][2],dp0[nextc][3]+v)
      i+=1
      nowc=nextc
    for j in range(nowc+1,C):
      dp0[j][0]=dp0[nowc][0]
      dp0[j][1]=dp0[nowc][1]
      dp0[j][2]=dp0[nowc][2]
    #print(dp0)

  print(max(dp0[-1]))


if __name__=='__main__':
  R,C,K=map(int,input().split())
  rcv=[list(map(int,input().split())) for _ in range(K)]
  #import datetime
  #print(datetime.datetime.now())
  main(R,C,K,rcv)
  #print(datetime.datetime.now())




Measured memory_bytes: 131424
#include <stdio.h>

int main(void) {
        int a,b,c,d,e,k;
        scanf("%d %d %d %d %d %d",&a,&b,&c,&d,&e,&k);
        int flag = 0;   //yay
        flag |= (b-a>k)?1:0;
        flag |= (c-a>k)?1:0;
        flag |= (d-a>k)?1:0;
        flag |= (e-a>k)?1:0;
        flag |= (c-b>k)?1:0;
        flag |= (d-b>k)?1:0;
        flag |= (e-b>k)?1:0;
        flag |= (d-c>k)?1:0;
        flag |= (e-c>k)?1:0;
        flag |= (e-d>k)?1:0;
        if (flag) printf(":(\n");
        else printf("Yay!\n");
        return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#include <stdlib.h>
#include <math.h>
using namespace std;
typedef long long ll;
const ll mod=1000000007;
const ll BIG=1e15;

int ans[200];
int N; 
int L,R,X;

int ShA(int x){
  cout<<"? "<<flush;
  for(int i=0;i<N;i++) cout<<x+i<<' '<<flush;
  cout<<endl;
  string S; cin>>S;
  if(S=="Red") return 1;
  if(S=="Blue") return -1;
  exit(0);
}

int ShB(int x){
  if(x==L) return X;
  if(x==L+N) return -X;
  cout<<"? "<<flush;
  cout<<x<<' '<<flush;
  if(x<L || L+N<x) for(int i=0;i<N-1;i++) cout<<L+1+i<<' '<<flush;
  else{
    if(L!=1) for(int i=1;i<L;i++) cout<<i<<' '<<flush;
    if(L!=N) for(int i=L+N+1;i<=2*N;i++) cout<<i<<' '<<flush;
  }
  cout<<endl;
  string S; cin>>S;
  if(S=="Red") return 1;
  if(S=="Blue") return -1;
  exit(0);
  
}

int main(){
  cin>>N;
  X=ShA(1);
  L=1, R=N+1;
  while(R>L+1){
    int MID=(R+L)/2;
    if(X==ShA(MID)) L=MID;
    else R=MID;
  }
  //cout<<L<<endl;
  
  for(int i=1;i<=2*N;i++) ans[i]=ShB(i);
  cout<<"! "<<flush;
  for(int i=1;i<=2*N;i++){
    if(ans[i]==1) cout<<'R'<<flush;
    else cout<<'B'<<flush;
  }
  cout<<endl;




}

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

using namespace std;

/*  テンプレここから */
typedef long long ll;

#define rep(i, n) for(int i = 0; i < n; ++i)
#define repi(i, start, end) for(int i = start; i < end; ++i)
#define all(x) (x).begin(), (x).end()
#define INF (1e9)
#define INFL (1e18)
#define add_mod(a, b, x) ( (ll)(a) + (ll)(b) ) % (ll)(x)
#define mul_mod(a, b, x) ( ((ll)(a) % (ll)(x)) * ((ll)(b) % (ll)(x)) ) % (ll)(x)
#define out(x) cout << (x) << endl;
#define outyes(bool_val) cout << (bool_val ? "yes" : "no") << endl;
#define outYes(bool_val) cout << (bool_val ? "Yes" : "No") << endl;
#define outYES(bool_val) cout << (bool_val ? "YES" : "NO") << endl;
#define outPossible(bool_val) cout << (bool_val ? "Possible" : "Impossible") << endl;
#define outPOSSIBLE(bool_val) cout << (bool_val ? "POSSIBLE" : "IMPOSSIBLE") << endl;

template<typename A, size_t N, typename T>
void array_fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

ll sub_mod(ll a, ll b, ll x){
    ll tmp = (a - b) % x;
    if(tmp < 0) tmp += x;
    return tmp;
}
ll gcd(ll a, ll b){
    if(b == 0) return a;
    else return gcd(b, a % b);
}

int dx[] = {0, 1, 0, -1};
int dy[] = {-1, 0, 1, 0};
/*  テンプレここまで */

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

    int n;
    cin >> n;
    vector<int> a(n), b(n), c(n-1);
    rep(idx, n) cin >> a[idx];
    rep(idx, n) cin >> b[idx];
    rep(idx, n-1) cin >> c[idx];

    int ans = 0;
    rep(idx, n) {
        ans += b[a[idx]-1];
        if(idx > 0) {
            if(a[idx-1] + 1 == a[idx]) {
                ans += c[a[idx-1]-1];
            }
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
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();
        for (int i = a; i <= a * b; i+=a) {
            if (i % b == c) {
                System.out.println("YES");
                return;
            }
        }
        System.out.println("NO");
    }
}

Measured memory_bytes: 35796
#include <iostream>
#include <cstring>
#include <cstdio>
#include <algorithm>
using namespace std;
int V;
const int maxv=17;
const int INF=2e9+7;
int cost[maxv][maxv];
int d[maxv];
bool used[maxv];
void bjs(int s)
{

    fill(d,d+V,INF);
    d[s]=0;
    memset(used,0,sizeof(used));
    while(true)
    {
        int v=-1;
        for(int i=0;i<V;i++)
        {
            if(!used[i]&&(v==-1||d[i]<d[v]))
               v=i;
        }
        if(v==-1) break;
        used[v]=1;
        for(int i=0;i<V;i++)
            d[i]=min(d[i],d[v]+cost[v][i]);
    }
    return ;
}
int main()
{
   int n;
   while(cin>>n&&n!=0)
   {
     V=0;
     for(int i=0;i<maxv;i++)
        fill(cost[i],cost[i]+maxv,INF);
     for(int i=0;i<n;i++)
     {
         int x,y,z;
         cin>>x>>y>>z;
         cost[x][y]=z;
         cost[y][x]=z;
         V=max(V,x);
         V=max(V,y);
     }
     V++;
     int ans[V];
     memset(ans,0,sizeof(ans));
     for(int i=0;i<V;i++)
     {
         bjs(i);
         for(int j=0;j<V;j++)
            ans[i]+=d[j];
     }
     int ans0=0;
     for(int i=0;i<V;i++)
     {
         if(ans[i]<ans[ans0])
            ans0=i;
     }
     cout<<ans0<<" "<<ans[ans0]<<endl;
   }

}



Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using pint = pair<int,  int>;
using pll = pair<ll, ll>;
using edge = pair<int, ll>;
using Graph = vector<vector<int>>; 
using WeightedGraph = vector<vector<edge>>;
const ll INF = 1LL << 60;
const int INF32 = 1 << 29;
const ll MOD = 1000000007;

int main(){
  ll n,k;cin >> n >> k;
  vector<pll> a(n);
  for(int i = 0; i < n; ++i){
    cin >> a[i].first >> a[i].second;
  }
  sort(a.begin(), a.end());
  ll tmp = 0;
  for(int i = 0; i < n; ++i){
    tmp += a[i].second;
    if(tmp>=k){
      cout << a[i].first << endl;
      return 0;
    }
  }
}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
//#include <boost/multiprecision/cpp_int.hpp> 
//using namespace boost::multiprecision; 
using namespace std;
#define ll long long int
#define ld long long double
#define vi vector<int>
#define vl vector<ll>
#define pi pair<int, int>
#define pl pair<ll, ll>
#define pb push_back
#define pf push_front
#define pob pop_back
#define pof pop_front
#define nl '\n'
#define mp make_pair
#define debug1(x) cout <<#x<<" "<<x<<'\n';
#define debug2(x,y) cout <<#x<<" "<<x <<" "<<#y<<" "<<y <<'\n';
#define debug3(x,y,z) cout<<#x<<" "<<x<<" "<<#y<<" "<<y<<" "<<#z<<" "<<z<<'\n';
#define fi first
#define se second
#define boost ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define inf 1e18
const int mod = (int)1e9+7;
pair<ll,ll>s4[4]={{-1,0},{1,0},{0,-1},{0,1}};
pair<ll,ll>s8[8]={{-1,-1},{-1,0},{-1,1},{0,-1},{0,1},{1,1},{1,0},{1,-1}};

void solve() {
	ll n,m;
	cin >> n >> m;
	ll sum=0;
	if(n>1)
		sum += n*(n-1)/2;
	if(m>1)
		sum += m*(m-1)/2;
	cout << sum <<endl;

}

signed main() {
	boost;
	solve();
}

Measured memory_bytes: 256
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		int r = sc.nextInt();
		if(r < 1200)
System.out.println("ABC");
else if(r < 2800)
System.out.println("ARC");
else
System.out.println("AGC");
	}
}

Measured memory_bytes: 23764
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author ExplodingFreeze
 */

#include <iostream>
#include <fstream>

#include <bits/stdc++.h>
#define int long long
#define f(i,a,b) for(int i=(a);i<(b);i++)
const int MOD=1e9+7;
using pii=std::pair<int,int>;
//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); <-- PUT IN main()/solve()!

using namespace std;

int a,b;
class A9x9 {
public:
	void solve(std::istream& in, std::ostream& out) {
		in >> a >> b;
		if(a>9||b>9)
			out << "-1\n";
		else
			out << a*b << "\n";
	}
};


int32_t main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	A9x9 solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 256
// 3_abc135_c
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rep1(i, n) for(int i = 1; i <= (int)(n); i++)
#define SZ(x) ((int)(x).size())
#define INF (1e16)
typedef long long ll;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    vector<int> a(n + 1);
    vector<int> b(n);

    rep(i, n + 1){
        cin >> a[i];
    }
    rep(i, n){
        cin >> b[i];
    }

    ll ans = 0;
    rep(i, n){
        if(a[i] > b[i]){
            ans += b[i];
        }else{
            if(b[i] >= a[i] + a[i + 1]){
                ans += a[i] + a[i + 1];
                a[i + 1] = 0;
            }else{
                ans += b[i];
                a[i + 1] -= b[i] - a[i];
            }
        }
    }

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


Measured memory_bytes: 1024
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author aajisaka
 */

#include<bits/stdc++.h>

using namespace std;

void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

#define SPEED ios_base::sync_with_stdio(false);cin.tie(nullptr)
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define all(v) v.begin(), v.end()
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

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

constexpr long double PI = 3.14159265358979323846264338327950288L;
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());

class CStrangeDance {
public:

    int calc(vector<vector<vector<int>>>& v, int k) {
      int w = 0;
      if (k > 0) {
        w = calc(v, k-1);
      }
      auto ret = v[2][k][w];

      auto w0 = v[0][k][w];
      auto w1 = v[1][k][w];
      auto w2 = v[2][k][w];

      v[1][k][w] = w0;
      v[2][k][w] = w1;
      v[0][k][w] = w2;
      return ret;
    }

    void solve(istream& cin, ostream& cout) {
      SPEED;
      int n;
      cin >> n;
      string t;
      cin >> t;

      // initialize vector size
      vector<vector<vector<int>>> v(3, vector<vector<int>>(n));
      int k = 1;
      rep(i, n) {
        rep(j, 3) {
          v[j][i].resize(k);
        }
        k *= 3;
      }
      int K = k;

      // initialize vector
      rep(i, n) {
        int idx = 0;
        rep(j, 3) {
          for(auto& e: v[j][i]) {
            e = idx;
            idx++;
          }
        }
      }

      for(auto c: t) {
        if (c=='S') {
          // swap vector
          swap(v[1], v[2]);
        } else {
          // swap by point recursively
          calc(v, n-1);
        }
      }

      // recover
      vector<int> ans(K);
      k = 1;
      rep(i, n) {
        rep(j, 3) {
          for(auto e: v[j][i]) {
            for(int idx=e; idx<K; idx+=(k*3)) {
              ans[idx] += j*k;
            }
          }
        }
        k *= 3;
      }

      for(auto e: ans) {
        cout << e << ' ';
      }
      cout << endl;

    }
};

signed main() {
  CStrangeDance solver;
  std::istream& in(std::cin);
  std::ostream& out(std::cout);
  solver.solve(in, out);
  return 0;
}

Measured memory_bytes: 9392
//
// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
//
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

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

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

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

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

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

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

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

//
// solution 
//
//
use std::collections::HashSet;
#[allow(unused_mut)]
#[allow(non_snake_case)]
fn main() {
    input!{
        S: chars,
        T: chars,
    }

    let set: HashSet<CharPair> = 
        S.into_iter().zip(T.into_iter()).map(|(s, t)| CharPair(s, t)).collect();

    let max_count = set.len();

    if max_count > set.iter().map(|cp| cp.0).collect::<HashSet<char>>().len() {
        println!("No");
    } else if max_count > set.iter().map(|cp| cp.1).collect::<HashSet<char>>().len() {
        println!("No");
    } else {
        println!("Yes");
    }
}

#[derive(Debug, PartialEq, Eq, Hash, Copy, Clone)]
struct CharPair(char, char);


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

signed main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	
	int n,m;
	cin>>n>>m;
	vi in(m);
	rep(i,m){
		int a;
		cin>>a;
		rep(j,a){
			int b;
			cin>>b;
			in[i]+=1<<(b-1);
		}
	}
	vi w(m);
	rep(i,m)cin>>w[i];
	int out=0;
	rep(i,1<<n){
		bool h=true;
		rep(j,m){
			int c=0,t=i&in[j];
			rep(k,n)if(t&1<<k)c++;
			if(w[j]-c%2)h=false;
		}
		
		if(h)out++;
	}
	cout<<out<<endl;
}











Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>

using namespace std;

/* constant */

const int MAX_N = 36;

/* typedef */

typedef pair<int,char> pic;

struct Card {
  int v, i;
  char s;
  Card() {}
  Card(int _v, char _s, int _i): v(_v), s(_s), i(_i) {}
  bool operator<(const Card &c) const { return v < c.v; }
  void print() { printf("%c%d", s, v); }
};

/* global variables */

Card as[MAX_N], bs[MAX_N], cs[MAX_N];

/* subroutines */

void bubble_sort(int n, Card as[]) {
  for (int i = 0; i < n; i++)
    for (int j = n - 1; j > i; j--)
      if (as[j] < as[j - 1])
	swap(as[j], as[j - 1]);
}

void selection_sort(int n, Card as[]) {
  for (int i = 0; i < n; i++) {
    int mini = i;
    for (int j = i; j < n; j++)
      if (as[j] < as[mini])
	mini = j;
    if (i != mini) swap(as[i], as[mini]);
  }
}

bool stable(int n, Card as[]) {
  for (int i = 0; i < n; i++) {
    Card &ai = as[i];
    for (int j = i + 1; j < n && ai.v == as[j].v; j++)
      if (ai.i > as[j].i) return false;
  }
  return true;
}

void print_cards(int n, Card as[]) {
  for (int i = 0; i < n; i++) {
    if (i) putchar(' ');
    as[i].print();
  }
  putchar('\n');
}

/* main */

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

  for (int i = 0; i < n; i++) {
    string s;
    cin >> s;
    cs[i] = bs[i] = as[i] = Card(s[1] - '0', s[0], i);
  }

  bubble_sort(n, bs);
  bool bst = stable(n, bs);
  print_cards(n, bs);
  cout << (bst ? "Stable" : "Not stable") << endl;
  
  selection_sort(n, cs);
  bool cst = stable(n, cs);
  print_cards(n, cs);
  cout << (cst ? "Stable" : "Not stable") << endl;

  return 0;
}


Measured memory_bytes: 3300
#include<bits/stdc++.h>
using namespace std;
#define rep(i,j,n) for(int i=(int)(j);i<(int)(n);i++)
#define REP(i,j,n) for(int i=(int)(j);i<=(int)(n);i++)
#define MOD 1000000007
#define int long long
#define ALL(a) (a).begin(),(a).end()
#define vi vector<int>
#define vii vector<vi>
#define pii pair<int,int>
#define priq priority_queue<int>
#define disup(A,key) distance(A.begin(),upper_bound(ALL(A),(int)(key)))
#define dislow(A,key) distance(A.begin(),lower_bound(ALL(A),(int)(key)))
signed main(){
  int N;
  cin>>N;
  vi A(26);
  string S;
  cin>>S;
  rep(i,0,S.size())
    A[S[i]-'a']++;
  rep(i,1,N){
    string X;
    cin>>X;
    vi B(26);
    rep(j,0,X.size())
      B[X[j]-'a']++;
    rep(j,0,26)
      A[j]=min(A[j],B[j]);
    } 
  string ans;
  rep(i,0,26){
    rep(k,0,A[i])
      ans+='a'+i;
    }
  cout<<ans;
  }


Measured memory_bytes: 256