akhauriyash/Code-Regression huggingface dataset:
import java.io.*;
import java.util.*;

public class Main {
    public static final long mod = (long)1e9+7;
    public static final long INF = Long.MAX_VALUE/2;
    public static final int inf = Integer.MAX_VALUE/2;

    static void solve(InputReader in, PrintWriter out){
        String s = in.ns();
      	for(int i = 0; i<10000000;i++) s = reverse(s);
        if(s.length()==2) out.println(s);
        else out.println(new StringBuffer(s).reverse().toString());
    }

    public static void main(String[] args){
        InputReader in = new InputReader(System.in);
        PrintWriter out = new PrintWriter(System.out);
        solve(in, out);
        out.close();
    }
    public static String reverse(String s){
        return new StringBuilder(s).reverse().toString();
    }
    public static class InputReader{
        private BufferedReader br;
        private StringTokenizer st;
        public InputReader(InputStream is){
            br = new BufferedReader(new InputStreamReader(is));
            st = null;
        }
        public String ns(){
            if(st == null || !st.hasMoreTokens()){
                try{
                    st = new StringTokenizer(br.readLine());
                }catch (Exception e){
                    throw new RuntimeException(e);
                }
            }
            return st.nextToken();
        }
        public int ni(){
            return Integer.parseInt(ns());
        }
        public long nl(){
            return Long.parseLong(ns());
        }
        public double nd(){
            return Double.parseDouble(ns());
        }
        public char nc(){
            return ns().toCharArray()[0];
        }
        public int[] ni(int n){
            int[] a = new int[n];
            for (int i = 0; i < n; i++) {
                a[i] = ni();
            }
            return a;
        }
        public long[] nl(int n){
            long[] a = new long[n];
            for (int i = 0; i < n; i++) {
                a[i] = nl();
            }
            return a;
        }
        public double[] nd(int n){
            double[] a = new double[n];
            for (int i = 0; i < n; i++) {
                a[i] = nd();
            }
            return a;
        }
    }
}


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

using namespace std;

int main()
{
  vector<int> a(3); cin >> a[0] >> a[1] >> a[2];
  sort(a.begin(), a.end());

  if (a[0] == a[1] and a[1] == a[2]) cout << 1;
  else if (a[0] == a[1] or a[1] == a[2]) cout << 2;
  else cout << 3;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    long W,H,x,y,r;
    cin>>W>>H>>x>>y>>r;
    
    bool flug=false;
    
    
    
    if(x-r<0 || y-r<0 || x+r>W || y+r>H )
    {
        cout<<"No"<<endl;
        
    }
    else
    {
        cout<<"Yes"<<endl;
    }
  
    return 0;
    
}



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

typedef long long ll;
typedef unsigned long long ull;
typedef double dd;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;

const int Mx=1e6+11;
const double PI = acos(-1);
#define MOD 1000000007

#define nl '\n'
#define pb push_back
#define F first
#define S second
#define I insert
#define mp make_pair

#define sz(x) x.size()
#define tt int t; cin>>t; while(t--)
#define be(a) (a).begin(),(a).end()
#define rbe(a) (a).rbegin(),(a).rend()
#define mem(a,b) memset(a,b,sizeof(a))
#define yes cout<<"YES"<<nl
#define no cout<<"NO"<<nl

#define su ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define file freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
#define frac cout.unsetf(ios::floatfield); cout.precision(10); cout.setf(ios::fixed,ios::floatfield);

vi adj[Mx];
bool vis[Mx];

void dfs ( int u )
{
    vis[u] = 1;
    for ( auto v : adj[u] ) {
        if ( !vis[v] ) dfs ( v );
    }
}


void f()
{
    int n, m,cnt=0,u,v;
    cin >> n >> m;
    for ( int i = 1; i <= m; i++ ) {
        cin >> u >> v;
        adj[u].pb ( v );
        adj[v].pb ( u );
    }
    for ( int i = 1; i <= n; i++ ) {
        if ( !vis[i] ) {
            dfs ( i );
            cnt++;
        }
    }
    cout << cnt-1 << nl;
}

int main()
{
    su;
    f();
    return 0;
}


Measured memory_bytes: 30668
import java.util.*;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		String t = sc.next();
		char[] s2 = s.toCharArray();
		char[] t2 = t.toCharArray();
		Arrays.sort(s2);
		Arrays.sort(t2);
		t2[0]=t2[t2.length-1];
		String S = String.valueOf(s2);
		String T = String.valueOf(t2);
		if(S.compareTo(T)<0) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}
	}
 
}

Measured memory_bytes: 21972
num = int(input())

digits = len(str(num))

ans = digits

for i in range(1,10 ** (digits // 2 + 1)):
    if num % i == 0:
        target = max(len(str(i)), len(str(num//i)))
        if ans >= target:
            ans = target
        else:
            print(ans)
            exit()
print(ans)

Measured memory_bytes: 9188
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
using ll = long long;
using vec = vector<ll>;
using vect = vector<double>;
using Graph = vector<vector<ll>>;
#define loop(i, n) for (ll i = 0; i < n; i++)
#define Loop(i, m, n) for (ll i = m; i < n; i++)
#define pool(i, n) for (ll i = n; i >= 0; i--)
#define Pool(i, m, n) for (ll i = n; i >= m; i--)
#define mod 1000000007ll
#define setbit bitset<8>
#define flagcount __builtin_popcount
#define flag(x) (1 << x)
#define flagadd(bit, x) bit |= flag(x)
#define flagpop(bit, x) bit &= ~flag(x)
#define flagon(bit, i) bit &flag(i)
#define flagoff(bit, i) !(bit & (1 << i))
#define all(v) v.begin(), v.end()
#define low2way(v, x) lower_bound(all(v), x)
#define high2way(v, x) upper_bound(all(v), x)
#define count2way(v, x) high2way(v, x) - low2way(v, x)
#define lower(v, x) low2way(v, x) - v.begin()       //1番左が0、もし見つから無いならｎを出力
#define higher(v, x) high2way(v, x) - v.begin() - 1 //1番左が0、もし見つからないならn-1を出力（注意）
#define putout(a) cout << a << endl
#define putout2(a, b) \
  putout(a);          \
  putout(b)
#define putout3(a, b, c) \
  putout(a);             \
  putout(b);             \
  putout(c)
#define putout4(a, b, c, d) \
  putout(a);                \
  putout(b);                \
  putout(c);                \
  putout(d)
#define putout5(a, b, c, d, e) \
  putout(a);                   \
  putout(b);                   \
  putout(c);                   \
  putout(d);                   \
  putout(e)
#define Gput(a, b) G[a].push_back(b)
#define cin1(a) cin >> a
#define cin2(a, b) cin >> a >> b
#define cin3(a, b, c) cin >> a >> b >> c
#define cin4(a, b, c, d) cin >> a >> b >> c >> d
#define cin5(a, b, c, d, e) cin >> a >> b >> c >> d >> e
#define Sum(v) accumulate(all(v), 0ll)
#define gcd(x, y) __gcd(x, y)
ll ctoi(char c)
{
  if (c >= '0' && c <= '9')
  {
    return c - '0';
  }
  return 0;
}
template <typename T>
T lcm(T x, T y)
{
  T z = gcd(x, y);
  return x * y / z;
}
template <typename T>
bool primejudge(T n)
{
  if (n < 2)
    return false;
  else if (n == 2)
    return true;
  else if (n % 2 == 0)
    return false;
  double sqrtn = sqrt(n);
  for (T i = 3; i < sqrtn + 1; i++)
  {
    if (n % i == 0)
    {
      return false;
    }
    i++;
  }
  return true;
}
template <typename T>
T modinv(T a, T m)
{
  T b = m, u = 1, v = 0;
  while (b)
  {
    T t = a / b;
    a -= t * b;
    swap(a, b);
    u -= t * v;
    swap(u, v);
  }
  u %= m;
  if (u < 0)
    u += m;
  return u;
}
//場合によって使い分ける
//const ll dx[4]={1,0,-1,0};
//const ll dy[4]={0,1,0,-1};
const ll dx[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll dy[8] = {0, 1, 1, 1, 0, -1, -1, -1};
//多次元配列の宣言法
//vector<vector<ll>> field(h, vector<ll>(w));
template <class T>
inline void chmax(T &a, T b)
{
  if (a < b)
    a = b;
}
template <class T>
inline void chmin(T &a, T b)
{
  if (a > b)
    a = b;
}
/*
ライブラリをここに置いてコメントを削除
*/

int main()
{
  cout << fixed << setprecision(30);
  string s;
  cin >> s;
  loop(i, 3) if (s[i] == '7')
  {
    putout("Yes");
    return 0;
  }
  putout("No");
  return 0;
}


Measured memory_bytes: 3624
#include<bits/stdc++.h>
using namespace std;
struct data{
	int a;
	int b;
};
bool operator<(const data &data1,const data &data2){
	return data1.a > data2.a;
};

int main(){
	int n,m;
	cin >> n >> m;
	priority_queue<data> Q;
	int money,gendo;
	for(int i = 0; i < n; i++){
		cin >> money >> gendo;
		data p;
		p.a = money;
		p.b = gendo;
		Q.push(p);
	} 

	long long sum_ans = 0;
	int sum_m = 0;
	while(sum_m < m){
		data p = Q.top();
		Q.pop();
		for(int i = 0; i < p.b; i++){
			sum_ans += p.a;
			sum_m++;
			if(sum_m >= m)break;
		}
	}
	cout << sum_ans << endl;
	return 0;
}

Measured memory_bytes: 1400
import java.util.*;

public class Main {
	static HashMap<Long, Long> memo;
	static int A,B,C,D;
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int T = sc.nextInt();
		
		for(int i=0; i<T; i++) {
			long N = sc.nextLong();
			A = sc.nextInt();
			B = sc.nextInt();
			C = sc.nextInt();
			D = sc.nextInt();
			
			memo = new HashMap<>();
			memo.put(0l, 0l);
			memo.put(1l, (long)D);
			
			System.out.println(solve(N));
		}
		
		sc.close();
	}
	
	static long solve(long N) {
		if(memo.get(N)!=null)
			return memo.get(N);
		long min = Long.MAX_VALUE;
		if(N < Long.MAX_VALUE/D)
			min = N*D;
		
		for(int i=-1; i<=1; i++) {
			if((N+i)%2==0)
				min = Math.min(min, solve((N+i)/2)+Math.abs(i)*D+A);
		}
		for(int i=-1; i<=1; i++) {
			if((N+i)%3==0)
				min = Math.min(min, solve((N+i)/3)+Math.abs(i)*D+B);
		}
		for(int i=-2; i<=2; i++) {
			if((N+i)%5==0)
				min = Math.min(min, solve((N+i)/5)+Math.abs(i)*D+C);
		}

		memo.put(N, min);
		return min;
	}
}

Measured memory_bytes: 62928
#include<deque>
#include<queue>
#include<vector>
#include<algorithm>
#include<iostream>
#include<set>
#include<cmath>
#include<tuple>
#include<string>
#include<chrono>
#include<functional>
#include<iterator>
#include<random>
#include<unordered_set>
#include<array>
#include<map>
#include<iomanip>
#include<assert.h>
#include<list>
#include<bitset>
#include<stack>
#include<memory>
#include<numeric>
using namespace std;
using namespace std::chrono;
typedef long long int llint;
typedef long double lldo;
#define mp make_pair
#define mt make_tuple
#define pub push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
#define fir first
#define sec second
#define res resize
#define ins insert
#define era erase
/*cout<<fixed<<setprecision(20);cin.tie(0);ios::sync_with_stdio(false);*/
const int mod=1000000007 ;
const llint big=2.19e15+1;
const long double pai=3.141592653589793238462643383279502884197;
const long double eps=1e-10;
template <class T,class U>bool mineq(T& a,U b){if(a>b){a=b;return true;}return false;}
template <class T,class U>bool maxeq(T& a,U b){if(a<b){a=b;return true;}return false;}
llint gcd(llint a,llint b){if(a%b==0){return b;}else return gcd(b,a%b);}
llint lcm(llint a,llint b){if(a==0){return b;}return a/gcd(a,b)*b;}
template<class T> void SO(T& ve){sort(ve.begin(),ve.end());}
template<class T> void REV(T& ve){reverse(ve.begin(),ve.end());}
template<class T>llint LBI(const vector<T>&ar,T in){return lower_bound(ar.begin(),ar.end(),in)-ar.begin();}
template<class T>llint UBI(const vector<T>&ar,T in){return upper_bound(ar.begin(),ar.end(),in)-ar.begin();}
//13:14~
int main(void){
	cout<<fixed<<setprecision(20);cin.tie(0);ios::sync_with_stdio(false);
	string s;cin>>s;
	llint ans=0,i,n=s.size()+1;
	vector<llint>a(n);
	for(i=0;i<n-1;i++){
		if(s[i]=='<'){a[i+1]=a[i]+1;}
	}
	for(i=n-2;i>=0;i--){
		if(s[i]=='>'){maxeq(a[i],a[i+1]+1);}
	}
	for(i=0;i<n;i++){ans+=a[i];}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 4764
#include <stdio.h>
int main ()
{
	int min,i,j,n,a[100],temp,count;
	while(scanf("%d",&n)!=EOF)
	{
		count=0;
		for(i=0;i<n;i++)
		{
			scanf("%d",&a[i]);
		}
		for(i=0;i<n;i++)
		{
			min=i;
			for(j=i;j<n;j++)
			{
				if(a[min]>a[j])min=j;
			}
			if(min!=i)
			{
				temp=a[i];
				a[i]=a[min];
				a[min]=temp;
				count++;
			}
		}
		for(i=0;i<n;i++)
		{
			if(i==n-1)printf("%d\n",a[i]);
			else
				printf("%d ",a[i]);
		}
		printf("%d\n",count);
	}
	return 0;
}


Measured memory_bytes: 2052
#include <algorithm>
#include <cmath>
#include <iostream>
#include <numeric>
#include <utility>
#include <string>
#include <unordered_map>
#include <vector>

using namespace std;

int main() {
    int n, k;
    cin >> n >> k;
    vector<int> tmp;
    vector<int> sumn(1, 0);
    vector<int> sump(1, 0);
    for (int i = 0; i < n; i++) {
        int x;
        cin >> x;
        if (x < 0) {
            tmp.push_back(x);
        } else {
            sump.push_back(x);
        }
    }
    for (int i = tmp.size()-1; i >= 0; i--) {
        sumn.push_back(-tmp[i]);
    }

    int ans = 1e9;
    if (sumn.size() > k && ans > sumn[k]) {
        ans = sumn[k];
    }
    if (sump.size() > k && ans > sump[k]) {
        ans = sump[k];
    }
    for (int i = 1; i < sumn.size(); i++) {
        if (sump.size() > k - i) {
            ans = min(ans, 2 * sumn[i] + sump[k - i]);
        }
    }
    for (int i = 1; i < sump.size(); i++) {
        if (sumn.size() > k - i) {
            ans = min(ans, 2 * sump[i] + sumn[k - i]);
        }
    }
    cout << ans << endl;
}


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

int main() {
	long long x;
	cin >> x;
	long long i = floor(sqrt(x)) - 1;
	long long sum = i * (i + 1) / 2;
	while (!(sum < x && x <= sum + i + 1)) {
		sum += ++i;
	}
	cout << i + 1 << endl;
	return 0;
}

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

#define forn(i, n) for (int i = 0; i < int(n); ++i)
#define for1(i, n) for (int i = 1; i <= int(n); ++i)
#define ms(a, x) memset(a, x, sizeof(a))
#define F first
#define S second
#define all(x) (x).begin(),(x).end()

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int INF = 0x3f3f3f3f;
mt19937 gen(random_device{}());

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n;
    cin>>n;
    ll sum=0;
    for1(i,n) for1(j,n) for1(k,n) sum+=__gcd(__gcd(i,j),k);
    cout<<sum;
    return 0;
}



Measured memory_bytes: 3660
#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); (i) >= 0; --(i))
#define FOR(i, n, m) for(int (i) = (n); (i) < (m); ++(i))

constexpr int INF = 1e9;
// constexpr ll INF = 1LL<<61;
constexpr ll mod = 1e9+7;


int main(){
  string S;
  cin >> S;
  int ans = 0, cnt = 0;
  REP(i, 3){
    if(S[i] == 'R'){
      cnt++;
    }
    else{
      cnt = 0;
    }
    ans = max(ans, cnt);
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3596
#include<bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define int ll
typedef pair<int,int> pr;
const int mxn = 1;
const int mxm = 1;
const int INF = 0x3f3f3f3f;
const int mod = 1e9+7;
const double eps = 1e-7;
const double pii = 3.1415926535898;
#define mpr make_pair
int gcd(int x,int y){if(y==0) return x; else return gcd(y,x%y);}
int qpow(int a,int b){int ans=1; while(b){ if(b&1) ans=ans*a%mod; b>>=1; a=a*a%mod; } return ans;}
int lowbit(int x){return (x&(-x));}
int qmul(int a,int b){int ans=0; while(b){ if(b&1) ans=(ans+a)%mod; b>>=1; a=(a+a)%mod; } return ans; }


string s;
signed main(void){
    cin>>s;
    int l = s.size();
    int nowans = 0;
    int nowpos = 0;
    int last = 0;
    while(nowpos<l){
        if(nowpos==0){
            nowans++;
            nowpos++;
            last=1;
        }
        else{
            if(last == 2) nowpos++,nowans++,last = 1;
            else if(s[nowpos]==s[nowpos-1]){
                if(nowpos==l-1){
                    break;
                }
                else{
                    nowpos+=2;
                    nowans++;
                    last = 2;
                }
            }
            else{
                nowpos++,nowans++,last=1;
            }
        }
    }
    cout<<nowans<<endl;
    return 0;
}


Measured memory_bytes: 640
def c_coloring_colorfully(S):
    s1 = '10' * (len(S) // 2) + ('1' if len(S) % 2 == 1 else '')
    s2 = '01' * (len(S) // 2) + ('0' if len(S) % 2 == 1 else '')
    ans1 = len([1 for k, s in enumerate(S) if s != s1[k]])
    ans2 = len([1 for k, s in enumerate(S) if s != s2[k]])
    return min(ans1, ans2)

S = input()
print(c_coloring_colorfully(S))

Measured memory_bytes: 4212
#include<stdio.h>
#include<string.h>
#define LEN 100005
#define MAX 100000

typedef struct pp{
  char name[100];
  int t;
}P;

P Q[LEN+1];
int head, tail, n;

void enqueue(P x){
  if(isFull()){
    printf("error(overflow)");
      }
  Q[tail] = x;
  if(tail + 1 == MAX) tail = 0;
  else tail++;
}

P dequeue(){
  P a;
  if(isEmpty()){
    printf("error(underflow)");
      }
  a = Q[head];
  if(head + 1 == MAX) head = 0;
  else head++;
  return a;
}
int isEmpty(void){
  if(head==tail)
  return 1;
  else return 0;
}
int isFull(void){
  if((head==tail+1)% MAX)
    return 1;
  else return 0;
}
  
int main(){
  int elaps = 0, c;
  int i, q;
  P u;
  scanf("%d %d", &n, &q);

  for ( i = 1; i <= n; i++){
    scanf("%s", Q[i].name);
    scanf("%d", &Q[i].t);
  }
  head = 1;
  tail = n +1;
  while(n != 0){
    u = Q[head];
    u.t = Q[head].t - q;
    if(u.t > 0){
      elaps = elaps + q;
      enqueue(u);
      Q[head]=dequeue();
    } else {
      elaps = elaps + Q[head].t;
      printf("%s %d\n",u.name,elaps);
      Q[head] = dequeue();
      n--;
    }
  }
  return 0;
}


Measured memory_bytes: 11984
#include <stdio.h>

int selectionSort(int *, int);

int main(){
  int A[100],N,i,sw;

  scanf("%d",&N);

  for(i=0;i<N;i++) scanf("%d",&A[i]);

  sw = selectionSort(A, N);

  for(i=0;i<N;i++){
    if(i>0) printf(" ");
    printf("%d",A[i]);
  }
  printf("\n");
  printf("%d\n",sw);
  
  return 0;
}

int selectionSort(int A[], int N){
  int i,j,temp,sw=0,minj;
  
  for(i=0;i<N-1;i++){
    minj = i;
    for(j=i;j<N;j++){
    if(A[j] < A[minj]) minj = j;
    }
    temp = A[i];
    A[i] = A[minj];
    A[minj] = temp;
    if(i!=minj) sw++;
  }
  return sw;
}


Measured memory_bytes: 2104
#include <stdio.h>
#define INF 100000000 
#define N 100
  
int n;
int size[N];
int to[N][N];
int cost[N][N];
int dist[N];
   
void DFS(int,int);
   
main(int argc,char *argv[]){
  int i, j;
  scanf("%d", &n);
  for(i=0;i<n;i++){
    int u;
    scanf("%d", &u);
    scanf("%d", &size[u]);
    for(j=0;j<size[u];j++){
      scanf("%d", &to[u][j]);
      scanf("%d", &cost[u][j]);
    }
  }
  for(i=0;i<n;i++) dist[i] = INF;
  DFS(0, 0);
  for(i=0;i<n;i++){
    printf("%d %d\n", i, dist[i]);
  }
  return 0;
}
void DFS(int p, int c){
  int i;
  dist[p] = c;
  for(i=0;i<size[p];i++){
    if(dist[to[p][i]] > c + cost[p][i])
      DFS(to[p][i], c + cost[p][i]);
  }
}

Measured memory_bytes: 676
#include <bits/stdc++.h>
using namespace std;
#define pii pair<int,int>
const int maxn=1e5+1;
typedef long long ll;
vector<int> g[maxn];
int v[maxn],d[maxn],c[maxn];
bool colored[maxn];
bool used[maxn][11];
int color[maxn];
int main(){
    int n,m,q;
    cin>>n>>m;
    for (int i=1; i<=m; ++i){
        int a,b;
        cin>>a>>b;
        g[a].push_back(b);
        g[b].push_back(a);
    }
    cin>>q;
    for(int i=1; i<=q; ++i){
        cin>>v[i]>>d[i]>>c[i];
    }
    for(int i=q; i>=1; --i){
        if (used[v[i]][d[i]])
            continue;
        queue<pii> qu;
        qu.push({v[i],d[i]});
        while (!qu.empty()){
            int cur=qu.front().first;
            int dist=qu.front().second;
            //cout<<cur<<" "<<dist<<"\n";
            qu.pop();
            if (dist<0)
                continue;
            if (!color[cur])
                color[cur]=c[i];


            if (used[cur][dist])
                continue;
            for(int j=1; j<=dist; ++j)
                used[cur][j]=true;
            for(int to:g[cur]){
                qu.push({to,dist-1});
            }
        }
    }
    for(int i=1; i<=n; ++i)
        cout<<color[i]<<"\n";
}


Measured memory_bytes: 36100
#include<stdio.h>
int max(int a,int b){
  if(a>b) return a;
  return b;
}
int main(void){
  int H,W,i,j,k,ans=0,tmp;
  scanf("%d %d",&H,&W);
  char S[H][W+1];
  int l[H][W],r[H][W],u[H][W],d[H][W];
  for(i=0;i<H;i++) scanf("%s",S[i]);
  for(i=0;i<H;i++){
    for(j=0;j<W;j++){
      if(S[i][j]=='#') l[i][j] = 0;
      else if(j==0) l[i][j] = 1;
      else l[i][j] = l[i][j-1] + 1;
      
      if(S[i][W-j-1]=='#') r[i][W-j-1] = 0;
      else if(j==0) r[i][W-j-1] = 1;
      else r[i][W-j-1] = r[i][W-j] + 1;
    
      if(S[i][j]=='#') u[i][j] = 0;
      else if(i==0) u[i][j] = 1;
      else u[i][j] = u[i-1][j] + 1;
  
      if(S[H-i-1][j]=='#') d[H-i-1][j] = 0;
      else if(i==0) d[H-i-1][j] = 1;
      else d[H-i-1][j] = d[H-i][j] + 1; 
    }  
  }
  for(i=0;i<H;i++){
    for(j=0;j<W;j++){
      //printf("i:%d j:%d   l::%d r::%d u::%d d::%d\n",i,j,l[i][j],r[i][j],u[i][j],d[i][j]);
      ans = max(ans,l[i][j]+r[i][j]+u[i][j]+d[i][j]-3);
    }
  }
  printf("%d\n",ans);
  return 0;
}

Measured memory_bytes: 66560
#include<iostream>
#include<vector>
#include<algorithm>
#include<math.h>
#include<queue>
#include<deque>
#include<map>
using namespace std;
typedef long long ll;

int main() {
    int a, b, c, d; cin >> a >> b >> c >> d;
    if (a == c)cout << 0 << endl;
    else cout << 1 << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MN = 500500;
ll P = 53;
ll MA = 1e9+7,MB = 1e9+9;
ll sa[MN],sb[MN];
ll ra[MN],rb[MN];
char st[MN];
ll n;
ll hs(ll s, ll l) {
	ll ha = ra[s+l]-sa[l]*ra[s];
	ll hb = rb[s+l]-sb[l]*rb[s];
	ha = ((ha%MA)+MA)%MA;
	hb = ((hb%MB)+MB)%MB;
	return (ha*MB)+hb;
}
bitset<MN> pr,su;
int main() {
	scanf("%s",st);
	n = strlen(st);
	bool ol = true;
	for(int i=0;i<n;i++) {
		if(st[i] != st[0]) {ol = false;break;}
	}
	if(ol) {
		printf("%d\n1\n",n);
		return 0;
	}
	sa[0] = sb[0] = 1;
	ra[0] = rb[0] = 0;
	for(int i=0;i<n;i++) {
		sa[i+1] = (sa[i]*P)%MA;
		sb[i+1] = (sb[i]*P)%MB;
		ra[i+1] = (P*ra[i]+st[i]-'a'+1)%MA;
		rb[i+1] = (P*rb[i]+st[i]-'a'+1)%MB;
	}
	pr.set();su.set();
	for(int i=1;i<=n;i++) {
		ll val = hs(0,i);
		for(int j=1;i*(j+1)<=n;j++) {
			if(val != hs(i*j,i)) {
				break;
			}
			pr.reset(i*(j+1));
		}
		val = hs(n-i,i);
		for(int j=1;i*(j+1)<=n;j++) {
			if(val != hs(n-i*(j+1),i)) {
				break;
			}
			su.reset(n-i*(j+1));
		}
	}
	if(pr[n]) {
		printf("1\n1\n");
		return 0;
	}
	/*
	for(int i=1;i<n;i++) {
		printf("%d",pr[i]?1:0);
	}
	printf("\n");
	for(int i=1;i<n;i++) {
		printf("%d",su[i]?1:0);
	}
	printf("\n");
	*/
	ll tot = 0;
	for(int i=1;i<n;i++) {
		tot += pr[i]*su[i];
	}
	printf("2\n");
	printf("%lld\n",tot);
}

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

int main(){
  int H,W;  cin >> H >> W;
  string mass[50];

  for(int i = 0;i < H;i++)cin >> mass[i];

  for(int i = 0;i < H;i++){
    for(int j = 0;j < W;j++){
      if(mass[i][j] == '.'){//爆弾ではないとき
        int count = 0;
        if(i + 1 < H and j + 1 < W and mass[i+1][j+1] == '#')count++;
        if(i + 1 < H and mass[i+1][j] == '#')count++;
        if(i + 1 < H and j - 1 >= 0 and mass[i+1][j-1] == '#')count++;
        if(j - 1 >= 0 and mass[i][j-1] == '#')count++;
        if(i - 1 >= 0 and j - 1 >= 0 and mass[i-1][j-1] == '#')count++;
        if(i - 1 >= 0 and mass[i-1][j] == '#')count++;
        if(i - 1 >= 0 and j + 1 < W and mass[i-1][j+1] == '#')count++;
        if(j + 1 < W and mass[i][j+1] == '#')count++;

        mass[i][j] = count + '0';
      }

    }
  }

  for(int i = 0;i < H;i++)cout << mass[i] << endl;



}

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

int main(){
	int n;
	while(1){
		cin >> n;
		if(n==0) break;
		int a[n];
		int e = 0;
		for(int i=0;i<n;i++) cin >> a[i];
		while(1){
			int b[n];
			for(int i=0;i<n;i++) b[i] = 0;
			for(int i=0;i<n;i++) for(int j=0;j<n;j++) if(a[i]==a[j]) b[i]++;
			int d = 0;
			for(int i=0;i<n;i++) if(a[i]==b[i]) d++;
			if(d==n) break;
			e++;
			for(int i=0;i<n;i++) a[i] = b[i];
		}
		cout << e << endl;
		cout << a[0];
		for(int i=1;i<n;i++) cout << " " << a[i];
		cout << endl;
	}
}

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

using namespace std;


//repetition
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define euc_dis(x, y) sqrt(x*x + y*y)

#define pb push_back
#define mp make_pair
#define INF 999999999
#define MOD 1000000007
#define sp ' '
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()

//typedef
typedef long long ll;
typedef pair<int, int> pint;
typedef map<int, int> mint;
typedef set<int> sint;
typedef vector<int> vint;
typedef vector<char> vchr;
typedef vector<long long> vll;
typedef vector<string> vstr;


ll mod(ll a, ll b){return (a%b+b)%b;}
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b){return a/gcd(a,b)*b;}
void Yes(){cout << "Yes" << endl;}
void No(){cout << "No" << endl;}
void Judge(bool b){b?Yes():No();}
void YES(){cout << "YES" << endl;}
void NO(){cout << "NO" << endl;}
void JUDGE(bool b){b?YES():NO();}
ll powMod(ll a, ll b, ll c){ll ans=1; rep(i, b){ans=ans*a%c;} return ans;}


template<typename T>
void ppp(T n){cout << n << endl;}
template<typename T>
void dpp(T n){cerr << n << endl;}
template<typename T>
void vpp(T a){rep(i,a.size()){cout << a[i] << endl;}}
template<typename T>
void vdp(T a){rep(i,a.size()){cerr << a[i] << endl;}}

const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
const int ddx[8] = {1,0,-1,0,1,-1,-1,1};
const int ddy[8] = {0,1,0,-1,1,1,-1,-1};




template < typename T > std::string to_string( const T& n )
{
    std::ostringstream stm ;
    stm << n ;
    return stm.str() ;
}


vector<string> split(const string &str, char sep)
{
    vector<string> v;
    stringstream ss(str);
    string buffer;
    while( getline(ss, buffer, sep) ) {
        v.pb(buffer);
    }
    return v;
}




int main(){

    cin.tie(0);
    ios::sync_with_stdio(false);

    ll n;
    cin >> n;

    ll ans = 1;

    rep(i, n){
        ll t;
        cin >> t;
        ans = lcm(ans, t);
    }

    ppp(ans);



    return 0;
}


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

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


Measured memory_bytes: 384
def main():
    n,a = map(int,input().split())
    x=list(map(int,input().split()))

    dp=[[[0 for _ in range(50*n+1)] for _ in range(n+1)] for _ in range(n+1)]
    dp[0][0][0]=1
    
    for i in range(n+1):
        for j in range(i+1):
            for k in range(50*j+1):
                if i>0 and k<x[i-1]:
                    dp[i][j][k]=dp[i-1][j][k]
                elif i>0 and j>0 and k>=x[i-1]:
                    dp[i][j][k]=dp[i-1][j][k]+dp[i-1][j-1][k-x[i-1]]
    ans=0
    for i in range(n):
        ans+=dp[n][i+1][(i+1)*a]
    print(ans)

if __name__ == "__main__":
    main()

Measured memory_bytes: 95068
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(X) (X).begin(),(X).end()
using namespace std;
using ll = long long;
using P = pair<int,int>;

int main(){
    ll l, r;
    cin >> l >> r;
    ll ans = 1e9*2 +1;
    for(ll i = l; i <= r; ++i){
        for(ll j = i + 1; j<=r; ++j){
            ans = min(ans, (i*j)%2019);
            if(ans==0){
                cout << ans << endl;
                return 0;
             }
        }
    }
    cout << ans << endl;


    return 0;
}

Measured memory_bytes: 256
a, b = map(int, input().split())
power = [2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 1]

a = power.index(a)
b = power.index(b)

if a > b:
    print('Alice')
elif a < b:
    print('Bob')
elif a == b:
    print('Draw')

Measured memory_bytes: 3060
s = input()
c, d = 0, 0
if '01' <= s[:2] <= '12':
    c = 1
if '01' <= s[2:] <= '12':
    d = 1

if c == d == 0:
    print('NA')
if c == d == 1:
    print('AMBIGUOUS')
if c == 0 and d == 1:
    print('YYMM')
if c == 1 and d == 0:
    print('MMYY')        


Measured memory_bytes: 3060
#if __has_include("debug.h")
    #include "debug.h"
#else  
#include <bits/stdc++.h>
using namespace std;
#define d(...) 2;
#endif

#define int long long int
#define ld long double

#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define endl "\n"      

#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()
#define ff first
#define ss second
#define eps 1e-10
#define PI acos(-1LL)

#define gcd(a,b)            __gcd((a),(b))
#define lcm(a,b)            ((a*b)/gcd(a,b))

void solve();

pair<int, int>dig(int n)
{
	string s=to_string(n);

	pair<int, int>p;
	p.ff=s[0]-'0';
	p.ss=s[s.length()-1]-'0';
	return p;
}

int32_t main()
{
    #ifdef DEBUG
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
    #endif 

    fast
    
    int t = 1;
	// cin>>t;
	
	while(t--)
	    solve();
	return 0;  
}

void solve()
{
	int i,j;
	int n;
	cin>>n;

	map<int,pair<int,int>>mp;

	int a[10][10];

	for(i=0;i<10;i++)
	{
		for(j=0;j<10;j++)
		{
			a[i][j]=0;
		}
	}

	for(i=1;i<=n;i++)
	{
		a[dig(i).ff][dig(i).ss]++;
	}

	int cnt=0;

	for(i=1;i<10;i++)
	{
		for(j=1;j<10;j++)
		{
			cnt+=(a[i][j]*a[j][i]);
		}
	}

	cout<<cnt<<endl;



}

Measured memory_bytes: 3716
<?php
$N = trim(fgets(STDIN));
$ans ='Yes';
for($i=0;$i<$N;$i++){
  $W[$i] = trim(fgets(STDIN));
  $w =str_split($W[$i]);

  if ($i ==0){
    }else{
    //１．$Wが同じか
    if ($capital!==$w[0]){
    $ans = 'No';
    }
    for($j=0;$j<$i;$j++){
      if ($W[$i]==$W[$j]){
        $ans = 'No';
      }

    }
  }
  $capital = trim($w[count($w)-1]);
}
echo $ans;

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

#ifdef LOCAL
#include <debug.hpp>
#else
#define debug(...) void()
#endif

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int h, w, k;
  cin >> h >> w >> k;
  vector<string> a(h);
  for (int i = 0; i < h; i++) {
    cin >> a[i];
  }
  vector<vector<int>> ans(h, vector<int>(w));
  int cnt = 0;
  for (int i = 0; i < h; i++) {
    bool F = false;
    for (int j = 0; j < w; j++) {
      if (a[i][j] == '#') {
        if (F) {
          cnt++;
        } else {
          F = true;
        }
      }
      ans[i][j] = cnt;
    }
    cnt++;
  }
  vector<bool> emp(h, true);
  for (int i = 0; i < h; i++) {
    for (int j = 0; j < w; j++) {
      if (a[i][j] == '#') {
        emp[i] = false;
        break;
      }
    }
  }
  for (int i = 0; i < h; i++) {
    if (emp[i]) {
      bool fill = false;
      for (int ii = i + 1; ii < h; ii++) {
        if (!emp[ii]) {
          ans[i] = ans[ii];
          fill = true;
          break;
        }
      }
      if (!fill) {
        for (int ii = i - 1; ~i; ii--) {
          if (!emp[ii]) {
            ans[i] = ans[ii];
            break;
          }
        }
      }
    }
  }
  debug(ans);
  vector<vector<int>> nans(h, vector<int>(w));
  map<int, int> mp;
  mp[ans[0][0]] = 1;
  for (int i = 0; i < h; i++) {
    for (int j = 0; j < w; j++) {
      if (!mp.count(ans[i][j])) {
        if (j > 0) {
          mp[ans[i][j]] = mp[ans[i][j - 1]] + 1;
        } else if (i > 0) {
          mp[ans[i][j]] = mp[ans[i - 1][w - 1]] + 1;
        }
      }
      nans[i][j] = mp[ans[i][j]];
    }
  }
  debug(nans);
  for (int i = 0; i < h; i++) {
    for (int j = 0; j < w; j++) {
      cout << nans[i][j] << (j == w - 1 ? '\n' : ' ');
    }
  }
  return 0;
}

Measured memory_bytes: 8676
#include<deque>
#include<queue>
#include<vector>
#include<algorithm>
#include<iostream>
#include<set>
#include<cmath>
#include<tuple>
#include<string>
#include<chrono>
#include<functional>
#include<iterator>
#include<random>
#include<unordered_set>
#include<array>
#include<map>
#include<iomanip>
#include<assert.h>
#include<bitset>
#include<stack>
#include<memory>
using namespace std;
typedef long long int llint;
typedef long double lldo;
#define mp make_pair
#define mt make_tuple
#define pub push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
#define fir first
#define sec second
#define res resize
#define ins insert
#define era erase
/*
cout<<setprecision(20);
cin.tie(0);
ios::sync_with_stdio(false);
*/
const llint mod=1000000007;
const llint big=2.19e15+1;
const long double pai=3.141592653589793238462643383279502884197;
const long double eps=1e-15;
template <class T,class U>bool mineq(T& a,U b){if(a>b){a=b;return true;}return false;}
template <class T,class U>bool maxeq(T& a,U b){if(a<b){a=b;return true;}return false;}
llint gcd(llint a,llint b){if(a%b==0){return b;}else return gcd(b,a%b);}
llint lcm(llint a,llint b){if(a==0){return b;}return a/gcd(a,b)*b;}
template<class T> void SO(T& ve){sort(ve.begin(),ve.end());}
template<class T> void REV(T& ve){reverse(ve.begin(),ve.end());}
template<class T>llint LBI(vector<T>&ar,T in){return lower_bound(ar.begin(),ar.end(),in)-ar.begin();}
template<class T>llint UBI(vector<T>&ar,T in){return upper_bound(ar.begin(),ar.end(),in)-ar.begin();}
int main(void){
	llint n,K,a,ans=0;cin>>n>>K;
	a=n/K;ans=a*a*a;
	if(K%2==0){a=(n+(K/2))/K;ans+=a*a*a;}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 888
# coding:utf-8

# ??\???
n,m = map(int, input().split())
matrix = []
for i in range(n):
    matrix.append([0] * m)

for i in range(n):
    col = input().split()
    for j in range(m):
        matrix[i][j] = int(col[j])

vector = [0] * m
for j in range(m):
    vector[j] = int(input())

for i in range(n):
    row_sum = 0
    for j in range(m):
        row_sum += matrix[i][j] * vector[j]
    print(row_sum)

Measured memory_bytes: 7848
N = int(input())

max = -1
max2 = -1
maxnum = -1
max2num = -1
for index in range(N):
    temp = int(input())
    if max < temp:
        max = temp
        maxnum = index
    elif max2 < temp:
        max2 = temp

for index in range(N):
    if index == maxnum:
        print(max2)
    else:
        print(max)

Measured memory_bytes: 4540
#include <bits/stdc++.h>
using namespace std;
int main(){
map<int,int>m;
vector<int>number(3);
for(int i=0;i<3;i++){
    cin>>number[i];
    m[number[i]]++;
}
for(int i=0;i<3;i++){
    if(m[number[i]]==1)cout<<number[i];
}
 return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <bitset>
#include <string>
#include <cmath>
#include <complex>
#include <numeric>
#include <cassert>

#include <vector>
#include <array>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <utility>

#define PI 3.14159265358979323846
#define int64 long long
#define uint64 unsigned long long
#define coutfix(i) cout << fixed << setprecision(i)		//coutの浮動小数出力の桁数設定
using namespace std;

int main()
{
	int64 nn, tmp = 0;
	cin >> nn;
	vector<int64> pp(nn), qq(nn);
	for(int64 ii = 0;ii < nn;ii++)
	{
		cin >> pp[ii];
		qq[ii] = pp[ii];
	}
	sort(qq.begin(), qq.end());
	for(int64 ii = 0;ii < nn;ii++)
	{
		if(pp[ii] != qq[ii])
		{
			tmp++;
		}
	}
	if(tmp == 2 || tmp == 0)
	{
		cout << "YES" << endl;
	}
	else
	{
		cout << "NO" << endl;
	}
	return 0;
}

Measured memory_bytes: 3624
#include<iostream>
#include<vector>
#include<cstdio>
#include<string>
#include<numeric>
#include<algorithm>
using namespace std;

int main(){
    int A, B, K;
    cin >> A >> B >> K;
    int C = max(A,B);
    int count = 0;
    int ans;
    for(int i=C; i>=1; i--){
        if(A%i==0 && B%i==0){
            count += 1;
            //cout << i;
            if(count == K){
                ans = i;
                break;
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
using namespace std;
#include <bits/stdc++.h>
#define rep(i, s) for (int i = 0; i < s; ++i)
#define repr(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define all(v) (v.begin(), v.end())
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)
#define VEC(a, n) vector<int>a(n)
#define PQ(a) priority_queue<int>a
#define PQmin(a) priority_queue< int, :vector<int>, greater<int> >a
#define PAIR pair<int, int>
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
#define EPS (1e-7)
#define INF (1e10)
#define PI (acos(-1))
const ll mod = 1000000007;
bool f(string s){
  bool ans=true;
  rep(i,s.size()/2){
    if(s[i]!=s[s.size()/2+i]){
      ans=false;
      break;
    }
  }
  return ans;
}

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  int N,M;
  cin>>N>>M;
  int A[N];
  int sum;
  rep(i,N){
    cin>>A[i];
    sum+=A[i];
  }
  sort(A,A+N);
  if(sum%(4*M)==0){
    if(A[N-M]>=sum/(4*M))
      cout<<"Yes"<<endl;
    else
      cout<<"No"<<endl;
  }
  else{
    if(A[N-M]>=sum/(4*M)+1)
      cout<<"Yes"<<endl;
    else
      cout<<"No"<<endl;
  }
}


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

using namespace std;


int main() {
    while(true) {
        vector<double> height(40, 0.0);
        int sun_r, n; cin >> sun_r >> n;
        if(sun_r == 0 && n == 0) break;
        for(int i = 0; i < n; ++i) {
            int l, r; double h;
            cin >> l >> r >> h;
            l += 20, r += 20;
            for(int x = l; x < r; ++x) {
                height[x] = max(height[x], h);
            }
        }
        double ans = 20.0;
        for(int i = 0; i < sun_r; ++i) {
            double limit = min(height[20+i], height[19-i]);
            double max_h = limit - sqrt(1.0*(sun_r*sun_r - i*i)) + sun_r;
            if(ans > max_h) ans = max_h;
        }
        cout << ans << endl;
    }
    return 0;
}

// [Problem] Vampire
// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=1194&lang=jp



Measured memory_bytes: 3288
//Joy Shree Kriskna
    #include<bits/stdc++.h>
    #define fast  ios_base::sync_with_stdio(false);cin.tie(NULL)
    #define rep(i,n) for(i=0;i<n;i++)
    #define rep1(i,n) for(i=n-1;i>=0;i--)
    #define rep2(j,t) for(j=1;j<=t;j++)
    #define rep3(i,a,b) for(i=a;i<=b;i++)
    #define PI acos(-1)
    #define remove(s) s.erase(unique(s.begin(),s.end()),s.end());
    #define e return 0
    //#define lcm(a,b) ((a*b)/__gcd(a,b))
    #define endl "\n"
    #define al(v) v.begin(),v.end()
    #define ll long long
    using namespace std;
    void solve()
    {
       int l,r,d;
       cin>>l>>r>>d;
       int c=0;
       for(int i=l;i<=r;i++)
       {
           if(i%d==0)c++;
       }
       cout<<c<<endl;
    }

    int main()
      {
           fast;
           int i,n,t;
           solve();
      }
//arupsaha52
//1704052_Arup


Measured memory_bytes: 3636
n=int(input())
s=input()
data=[]
ans=0
for i in range(n-1):
  if s[i] not in data:
    data.append(s[i])
  res=0
  for j in data:
    if j in s[i+1:n]:
      res+=1
  ans=max(ans,res)
print(ans)

Measured memory_bytes: 9172
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <algorithm>
#include <math.h>
#include <map>
#include <numeric>
using namespace std;
typedef long long ll;
typedef long double ld;

int main(){
   string s,t;cin>>s>>t;
   vector<int> a(26,-1),b(26,-1);
   for(int i=0;i<s.size();i++){
       int n=s[i]-'a',m=t[i]-'a';
       if(a[n]!=-1||b[m]!=-1){
           if(a[n]!=m||b[m]!=n){cout<<"No";return 0;}
       }
       else{a[n]=m;b[m]=n;}
   }
   cout<<"Yes";
}

Measured memory_bytes: 776
n,m = map(int, input().split())
d = [list(map(int, input().split()))[1:] for _ in range(m)]
s = list(map(int, input().split()))

count = 0

for i in range(2**n):

    for j in range(m):
        switch = 0
        for k in range(n):
            if (i >> k) & 1 and k+1 in d[j]:
                switch += 1
        if switch%2 != s[j]:
            break
    else:
        count += 1

print(count)

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

const int N=2e5+5;
const int M=1e6+5;
const int MOD=998244353;
int n,m,cur,ans;
int a[N];
int ct[M],gd[M],mt[M];
int tot[M],de[M];
int p[15],q[15];

inline void add(int &x,int y){
	x=(x%MOD+y%MOD)%MOD;
}

inline void dec(int &x,int y){
	x=(x%MOD+MOD-y%MOD)%MOD;
}

void dfs(int x,int t){
//	printf(":%d %d %d\n",cur,x,t);
	if(x==m+1){
		add(tot[t],cur);
		add(de[t],1ll*cur*cur%MOD);
		return;
	}
	for(int i=0;i<=q[x];i++){
		dfs(x+1,t);
		t*=p[x];
	}
}

int Pow(int x,int y){
	int MT=x,RT=1;
	while(y){
		if(y&1) RT=1ll*RT*MT%MOD;
		y>>=1;
		MT=1ll*MT*MT%MOD;
	}
	return RT;
}

int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++){
		m=0;
		memset(p,0,sizeof(p));
		memset(q,0,sizeof(q));
		scanf("%d",a+i);
		int x=a[i];
		cur=a[i];
		for(int j=2;j*j<=x;j++) if(x%j==0){
			p[++m]=j;
			while(x%j==0){
				x/=j;
				q[m]++;
			}
		}
		if(x!=1){
			p[++m]=x;
			q[m]=1;
		}
		dfs(1,1);
	}
//	for(int i=0;i<N;i++) if(tot[i]) printf("%d %d %d\n",i,tot[i],de[i]);
	for(int i=1;i<M;i++) gd[i]=1;
	for(int i=2;i<M;i++){
		if(!gd[i]) continue;
		if(ct[i]==0) ct[i]=1;
		if(ct[i]!=1) continue;
		for(int j=2;i*j<M;j++){
			if(j%i==0) gd[i*j]=0;
			else ct[i*j]++;
		}
	}
	for(int i=1;i<M;i++){
		mt[i]=1ll*tot[i]*tot[i]%MOD;
		dec(mt[i],de[i]);
		mt[i]=1ll*mt[i]*(MOD+1)/2%MOD;
	}
	for(int i=1;i<M;i++){
		for(int j=2;i*j<M;j++) if(gd[j]){
			if(ct[j]%2==0) add(mt[i],mt[i*j]);
			else dec(mt[i],mt[i*j]);
		}
//		if(mt[i]) printf("%d %d\n",i,mt[i]);
		add(ans,1ll*mt[i]*Pow(i,MOD-2)%MOD);
//		if(mt[i]) printf("%d:%d\n",ans,1ll*mt[i]*Pow(i,MOD-2)%MOD);
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 24112
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define rep2(i, a, n) for(ll i = a; i < (ll)(n); i++)
#define memi cout << endl
#define kono(n) cout << fixed << setprecision(n)
#define all(c) (c).begin(), (c).end()
#define pb push_back
#define hina cout << ' '
#define in(n) cin >> n
#define in2(n, m) cin >> n >> m
#define in3(n, m, l) cin >> n >> m >> l
#define out(n) cout << n
const ll mei = (ll)1e9 + 7;

int main(){
  ll a, b, c;
  in3(a, b, c);
  if(c >= a && c <= b)
    out("Yes");
  else
    out("No");
  memi;
}

Measured memory_bytes: 256
from collections import defaultdict
d = defaultdict(int)
for i in range(1,101):
  for j in range(1,101):
    for k in range(1,101):
      a = i**2+j**2+k**2+i*k+k*j+j*i
      d[a] += 1
      
n = int(input())
for i in range(1,n+1):
  print(d[i])

Measured memory_bytes: 11612
#include <stdio.h>


int main(void)
{
  
  int n, m, l;
  scanf("%d %d %d", &n, &m, &l);
  
  int A[n][m];
  int B[m][l];
  long long C[n][l];
  
  int i, j, k;
  
  for( i = 0; i < n; i++ ){
    for( k = 0; k < m; k++ ){
      scanf("%d", &A[i][k] );
    }
  }
  
  for( k = 0; k < m; k++ ){
    for( j = 0; j < l; j++ ){
      scanf("%d", &B[k][j] );
    }
  }
  
  for( i = 0; i < n; i++ ){
    for( j = 0; j < l; j++ ){
      C[i][j] = 0;
      for( k = 0; k < m; k++ ){
        C[i][j] += A[i][k] * B[k][j];
      }
    }
  }
        
  for( i = 0; i < n; i++ ){
    for( j = 0; j < l; j++ ){
      if( j ) printf(" ");
      printf("%lld", C[i][j]);
    }
    puts("");
  }
  
 
  return 0;

 
}       

Measured memory_bytes: 768
def lcs(X, Y):
    #X = " " + X
    #Y = " " + Y
    #c = [[0 for j in xrange(len(Y))] for i in xrange(len(X))]
    c2 = [0 for i in xrange(len(Y) + 1)]
    #maxl = 0
     
    for i in xrange(len(X)):
        c1 = c2 + []
        for j in xrange(len(Y)):
            if X[i] == Y[j]:
                c2[j + 1] = c1[j] + 1
            elif c2[j + 1] < c2[j]:
                c2[j + 1] = c2[j]
    return c2[-1]
n = int(raw_input())
  
for i in xrange(n):
    s1 = raw_input()
    s2 = raw_input()
    print lcs(s1, s2)

Measured memory_bytes: 6464
#include <stdio.h>

int main(void) {
	int a, b, c, temp;
	scanf("%d %d %d",&a,&b,&c);
	if( a > b ){
		temp = a;
		a = b;
		b = temp;
	}
	if( b > c ){
		temp = b;
		b = c;
		c = temp;
	}
	if( a > b ){
		temp = a;
		a = b;
		b = temp;
	}
	printf("%d %d %d\n",a,b,c);
	return 0;
}



Measured memory_bytes: 2664
#include <iostream>
#include <algorithm>
#include <vector>
#include <numeric>

#define rep(i,n) for(long long i=0;i<(long long)(n);i++)

using namespace std;

int main(void)
{
	int N, K, kind;
	long long ans=0;
	auto cmp = [](long long x, long long y){return x > y;};
	cin >> N >> K;
	vector<int> t(N);
	vector<long long> d(N);
	vector<long long> table(N+1, 0);
	vector<long long> table2;
	rep(i, N){
		cin >> t[i] >> d[i];
		if (table[t[i]] < d[i]){
			if (table[t[i]] != 0){
				table2.push_back(table[t[i]]);
			}
			table[t[i]] = d[i];
		}else{
			table2.push_back(d[i]);
		}
	}
	sort(table.begin(), table.end(), cmp);
	sort(table2.begin(), table2.end(), cmp);
	kind = K;
	rep(i, K){
		if (table[i] == 0){
			kind = i;
			break;
		}
	}
	for(int i=1; i<kind; i++){
		table[i] += table[i-1];
	}
	table2.insert(table2.begin(), 0);
	for(int i=1; i<table2.size(); i++){
		table2[i] += table2[i-1];
	}
	rep(i, K){
		if (i >= kind){
			break;
		}
		if (K-i-1 >= table2.size()){
			continue;
		}
		ans = max(ans, table[i]+table2[K-i-1]+(i+1)*(i+1));
	}
	cout << ans << endl;
	return 0;
}

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

ld maxvolume(ld s) 
{ 
    // finding length 
    ld length = s / 3; 
  
    s -= length; 
  
    // finding breadth 
    ld breadth = s / 2; 
  
    // finding height 
    ld height = s - breadth; 
  
    return length * breadth * height; 
} 
int main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ld l;
  cin>>l;
  cout<< fixed << setprecision(12);
  cout<<maxvolume(l)<<endl;

}
// 5
// 7
// 5
// 7
// 7
// 5
// 7
// 5


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


def solve(n):
    i = 1
    ans = N - 1
    while i * i <= n:
        if n % i == 0:
            ans_tmp = ((N // i) - 1) + (i - 1)
            if ans > ans_tmp:
                ans = ans_tmp
        i += 1
    return ans


print(solve(N))


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

int main(){
  int a=1;
  int b=1;
  for(int i=0; i=81; i++){
    cout << a << "x" << b << "=" << a*b << endl;
    if(a>=9 && b>=9)
      break;
    b++;
    if(b>=10){
      b=1;
      a++;
    }
  }
    
  return 0;
}



Measured memory_bytes: 3012
import java.util.Scanner;

class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int W = sc.nextInt();
        int H = sc.nextInt();
        int x = sc.nextInt();
        int y = sc.nextInt();
        int r = sc.nextInt();

        if(x>(W-r) || y>(H-r)){
            System.out.println("No");
        }
        else if(x<r || y<r){
            System.out.println("No");
        }
        else{
            System.out.println("Yes");
        }

        sc.close();
    }
}



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

using namespace std;
using ll = long long;
using vec = vector<ll>;
using mat = vector<vec>;
using pll = pair<ll,ll>;

#define INF (1LL << 60)
#define MOD 1000000007
#define PI 3.14159265358979323846

#define REP(i,m,n) for(ll (i)=(m),(i_len)=(n);(i)<(i_len);++(i))
#define FORR(i,v) for(auto (i):v)
#define ALL(x) (x).begin(), (x).end()
#define PR(x) cout << (x) << endl
#define PS(x) cout << (x) << " "
#define SZ(x) ((ll)(x).size())
#define MAX(a,b) (((a)>(b))?(a):(b))
#define MIN(a,b) (((a)<(b))?(a):(b))
#define REV(x) reverse(ALL((x)))
#define ASC(x) sort(ALL((x)))
#define DESC(x) ASC((x)); REV((x))
#define pb push_back
#define eb emplace_back

int main()
{
    ll N, K, S;
    cin >> N >> K >> S;

    REP(i,0,N) {
        if(S == 1000000000) {
            if(i < K) PS(S);
            else PS(999999999);
        }        
        else {
            if(i < K) PS(S);
            else PS(1000000000);
        } 
         
    }

    return 0;
}

/*



*/

Measured memory_bytes: 3580