akhauriyash/Code-Regression huggingface dataset:
require 'pp'
$DEBUG ? define_method(:dpp){|e|pp e} : define_method(:dpp){|e|}

# 空白区切の入力値を数値の配列で返却する
def gets_i_list()
  gets.chomp.split(" ").map(&:to_i)
end

# 入力値を文字の配列で返却する
def gets_nsp_list()
  gets.chomp.split("")
end

h, w, k = gets_i_list
board = []

h.times do
  board.push gets_nsp_list
end

h_patterns = []
0.upto(h) do |i|
  h_patterns += (0...h).to_a.combination(i).to_a
end

w_patterns = []
0.upto(w) do |i|
  w_patterns += (0...w).to_a.combination(i).to_a
end

ans = 0
h_patterns.each do |hp|
  w_patterns.each do |wp|

    b = board.dup
    hp.each do |h|
      b[h] = ["-"] * w
    end
    wp.each do |w|
      tb = b.transpose
      tb[w] = ["-"] * h
      b = tb.transpose
    end

    count = b.sum do |line|
      line.count("#")
    end
    if count == k
      ans += 1
    end
  end
end

puts ans

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

#define ll long long
#define vll vector<ll>
#define vvll vector<vll>
#define rep(i, n) for(i = 0; i < n; i++)

int main(){
    int N, K;
    int val = 1;
    cin >> N >> K;

    for (int i = 0; i < N; i++) {
        val = min(val * 2, val + K);
    }

    cout << val << '\n';

    return 0;
}

Measured memory_bytes: 3576
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
#include <array>
#include <functional>
using namespace std;
 
#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()
 
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<double> VD;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef vector<VD> VVD;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

template<typename T> void chmin(T &a, T b) { if (a > b) a = b; }
template<typename T> void chmax(T &a, T b) { if (a < b) a = b; }

int in() { int x; scanf("%d", &x); return x; }
ll lin() { ll x; scanf("%lld", &x); return x; }

int main() {
    int n;
    string s;
    cin >> n >> s;
    int ans = 1;
    char x = s[0];
    REP(i,n){
        if (x != s[i]){
            ans++;
            x = s[i];
        }
    }
    cout << ans << endl;
    return 0;
}


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

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
const long double pi=3.14159265358979323846;
#define x  first
#define y  second
#define deb(...)                 __f(#__VA_ARGS__, __VA_ARGS__)
#define deb(...)                 __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) { cerr << name << " : " << arg1 <<'\n'; }
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
    const char* comma = strchr(names + 1, ',');
    cerr.write(names, comma - names) << " : " << arg1 << " | "; __f(comma + 1, args...);
}

bool isPar(string s)
{
    ll n=s.size();
    for(int i=0;i<n/2;i++)
    {
        if(s[i]!=s[n-i-1])
        {
            return 0;
        }
    }
    return 1;
}

ll nOfD(ll n)
{
    ll d=0;
    ll i=1;
    while(i * i < n)
    {
        if(n%i ==0) d+=2;
        i++;
    }
    if(i * i == n)d++;
    return d;
}
ll sOfD(ll n)
{
    ll sum=0;
    ll i=1;
    while(i * i < n)
    {
        if(n%i ==0) sum+=i,sum+=n/i;
        i++;
    }
    if(i * i == n)sum+=i;
    return sum;
}
bool isP(ll x)
{
    if(x==2)return 1;
    if(x<2 || x%2==0)return 0;
    for(ll i=3;i * i <= x;i+=2)
    {
        if(x%i==0)return 0;
    }
    return 1;
}
ll lcm(ll a, ll b)
{
    return (a / __gcd(a, b) * b);
}
ll nPr(ll n,ll r)
{
    if(r==0)return 1;
    ll ans = 1;
    while(r--)ans*=n,n--;
    return ans;
}
ll nCr1(ll n,ll r)
{
    if(r==0)return 1;
    ll ans=r;
    ll rr=r;
    while(--rr)ans*=rr;
    return nPr(n,r)/ans;
}
ll power(ll x, ll y)
{
      ll ans=1;
      while(y--)ans*=x;
      return ans;
}
ll nCr(ll n,ll r)
{
     if(n==r ||r==0) return 1;
     if(r>n)return 0;
     if(r==1) return n;
     return nCr(n-1,r) + nCr(n-1,r-1);
}
///priority_queue<int,vector<int>,greater<int> >pq;
//###################################################\\


int main()
{
    cin.tie(0);
    cin.sync_with_stdio(0);
    ///freopen("ss.txt","r",stdin);
    ///freopen("out.txt","w",stdout);
    int t=1;
    //cin>>t;
    while(t--)
    {
       ll x,k,d;
       cin>>x>>k>>d;
       x=abs(x);
       if(x%d==0)
       {
           if(k>=x/d)
           {
               k-=x/d;
               if(!k)cout<<0;
               else
               {
                   if(k%2)cout<<d;
                   else cout<<0;
               }
           }
           else
           {
               cout<<x-(d*k);
           }
       }
       else
       {
           if((ld)k>(ld)x/(ld)d)
           {
               k-=x/d;
               x=x-(d*(x/d));
               if(k%2)cout<<abs(x-d);
               else cout<<x;
           }
           else
           {
               cout<<x-(d*k);
           }
       }
    }
    return 0;
}


Measured memory_bytes: 3636
#include<stdio.h>
#include<stdlib.h>
#include<string.h>

int main(){
  int x[100],i=0;
  char s[100];

  while( scanf("%s", s) != EOF ){
    if ( s[0] == '+' ){
      i--;
      x[i-1]=x[i-1]+x[i];
    } else if ( s[0] == '-' ){
      i--;
      x[i-1]=x[i-1]-x[i];
    } else if ( s[0] == '*' ){
      i--;
      x[i-1]=x[i-1]*x[i];
    } else {
      x[i] = atoi(s);
      i++;
    }
  }
  printf("%d\n",x[0]);
  return 0;
}

Measured memory_bytes: 548
s = input().split()
N = int(s[0])
D = int(s[1])

count =0
for i in range(0,N):
    a,b = input().split()
    a = int(a)
    b = int(b)
    length = a*a+b*b
    if length <=D*D:
        count+=1

print(count)

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

int main(void){
  int a[4];
  int b[4];
  int hit, blow;
  while(cin >> a[0] >> a[1] >> a[2] >> a[3]){
    cin >> b[0] >> b[1] >> b[2] >> b[3];
    hit = blow = 0;
    for(int i = 0; i < 4; i++){
      if(a[i] == b[i])
	hit++;
      else
	for(int j = 0; j < 4; j++)
	  if(a[j] == b[i])
	    blow++;
    }
    cout << hit << ' ' << blow << endl;
  }
  return 0;
}

Measured memory_bytes: 1160
#include<bits/stdc++.h>
#define st first
#define nd second
#define pb push_back
#define ppb pop_back
#define umax(x,y) x=max(x,y)
#define umin(x,y) x=min(x,y)
#define ll long long
#define ii pair<int,int>
#define iii pair<int,ii>
#define iiii pair<ii,ii>
#define sz(x) ((int) x.size())
#define orta ((bas+son)>>1)
#define all(x) x.begin(),x.end()
#define dbgs(x) cerr<<(#x)<<" --> "<<(x)<<" "
#define dbg(x) cerr<<(#x)<<" --> "<<(x)<<endl;getchar()
#define pw(x) (1<<(x))
#define inf 2005000
#define MOD 1000000007
#define N 100005
#define M 1000005
#define LOG 60
#define KOK 4000000
using namespace std;

int a[N],b[N],ans,tota,n;
map<int,int> tot,tot2,vis;
map<int,vector<int> > ed;

void dfs(int node) {

	if(vis[node]) return ;

	vis[node]=1;

	tota+=sz(ed[node]);

	for(int i:ed[node]) {

		dfs(i);

	}

}

int main() {

//	freopen("input.txt","r",stdin);	
	
	scanf("%d",&n);

	for(int i=1;i<=n;i++) {

		scanf("%d",&a[i]);

		tot[a[i]]++;

		a[n+1]^=a[i];

	}

	for(int i=1;i<=n;i++) {

		scanf("%d",&b[i]);

		tot2[b[i]]++;

		b[n+1]^=b[i];

	}

	n++;

	tot[a[n]]++;
	tot2[b[n]]++;

	for(auto val:tot) {

		if(tot2[val.st]!=val.nd) {

			printf("-1");

			return 0;

		}

	}

	for(int i=1;i<n;i++) {

		if(a[i]==b[i]) {

			tot[a[i]]--;

			continue ;
		
		}

		ed[a[i]].pb(b[i]);
		ed[b[i]].pb(a[i]);

	}

	for(auto val:tot) {

		if(val.nd && !vis[val.st]) {

			ans++;

			tota=0;

			dfs(val.st);

			ans+=tota/2;

		}

	}

	printf("%d",--ans);

}



Measured memory_bytes: 33792
fn read_vec<T: std::str::FromStr>() -> Vec<T> {
  let mut s = String::new();
  std::io::stdin().read_line(&mut s).ok();
  s.trim().split_whitespace()
    .map(|e| e.parse().ok().unwrap()).collect()
}

fn main() {
  let nmc: Vec<i32> = read_vec();
  let bs: Vec<i32> = read_vec();

  let mut sums: Vec<i32> = vec![];

  for _ in 0..nmc[0] {
    let xs: Vec<i32> = read_vec();
    let y = xs.iter()
      .zip(bs.iter())
      .fold(nmc[2], |a, c| a + c.0 * c.1);

    sums.push(y);
  };

  let ans = sums.into_iter().filter(|x| *x > 0).collect::<Vec<i32>>().len();

  println!("{}", ans);
}


Measured memory_bytes: 4352
//package Dynamic;
import java.io.*;
import java.util.*;
class Main
{
    static public void main(String[] args) throws IOException 
    {
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        int n=Integer.parseInt(br.readLine());
        int ar[]=new int[n];
      StringTokenizer st=new StringTokenizer(br.readLine());
//        int a=Integer.parseInt(st.nextToken());
//        int b=Integer.parseInt(st.nextToken());
//        int c=Integer.parseInt(st.nextToken());
        //int d=Integer.parseInt(st.nextToken());
       int i=0;
        while(st.hasMoreTokens())
        {
        	ar[i++]=Integer.parseInt(st.nextToken());
        }
        Arrays.sort(ar);
        int aa=ar[n/2-1];
        int bb=ar[n/2];
        System.out.println(bb-aa);
//        for(int x=0;x<n;x++)
//        {
//        	
//        }
        
        
    }
}


Measured memory_bytes: 35096
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <math.h>


using namespace std;

bool isPrime(int x)
{
  int n = (int) sqrt((double)x) ;

  for ( int i = 2; i < n; ++i )
    if ( x % i == 0 ) return false;
  return true;
}

int main()
{
  int x;
  cin >> x;
    
  for ( int i=x; true; ++i )
  {
    if( isPrime(i) )
    {
      cout << i;
      return 0;
    }
  }
  return 0;
}


Measured memory_bytes: 256
while True:
    h,w = map(int,raw_input().split())
    if h==0 and w==0:
        break
    sside="" #square side
    inside=""
    for x in xrange(1,w+1):
        sside += "#"
        if x==1 or x==w:
            inside += "#"
        else:
            inside += "."
    for x in xrange(1,h+1):
        if x==1 or x==h:
            print sside
        else:
            print inside
    print

Measured memory_bytes: 6312
#include <iostream>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <algorithm>
#include <numeric>
#include <fstream>
#include <iomanip>

typedef long double ld;
typedef long long ll;
const ll INF = (ll)1e18 + 1;
const ll MOD = 1e9 + 7;

// Split
namespace util {

std::vector< std::string > split(std::string s, char delimiter)
{
  std::vector< std::string > vs;
  std::string sub;
  for (auto c : s) {
    if (c == delimiter) vs.push_back(sub), sub.clear();
    else sub += c;
  }
  vs.push_back(sub);
  return vs;
}

} // namespace util

// Minimum, Maximum
template<class T> T minimum(T head, T tail) { return std::min(head, tail); }
template<class H, class... T> H minimum(H head, T... tail) { return std::min(head, minimum(tail...)); }
template<class T> T maximum(T head, T tail) { return std::max(head, tail); }
template<class H, class... T> H maximum(H head, T... tail) { return std::max(head, maximum(tail...)); }

// Output
template<class T> std::ostream& operator << (std::ostream& os, std::vector< T > v)
{
  for (ll i = 0; i < (ll)v.size(); i++){ os << " [" << i << "]" << v[i]; if (i % 10 == 9) os << std::endl; }
  return os;
}

template<class T, class S> std::ostream& operator << (std::ostream& os, std::vector< std::pair<T, S> > vp)
{
  ll i = 0;
  for (auto p : vp){os << " [" << i++ << "]" << p.first << " " << p.second; if (i % 10 == 0) os << std::endl;}
  return os;
}

void print(){ std::cout << std::endl; }
template<typename H> void print(H head) { std::cout << head << std::endl; }
template<typename H, typename... T> void print(H head, T... tail){ std::cout << head << " ", print(tail...); }

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

  std::string s, t;
  std::cin >> s >> t;

  std::sort(s.begin(), s.end());
  std::sort(t.begin(), t.end(), std::greater<>());

  bool judge = s < t;
  if (judge) print("Yes");
  else print("No");

  return 0;
}


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

typedef long long ll;
#define PI 3.1415926535897932384626433
#define MOD 1000000007

int main(){
    int n, x;
    cin >> n >> x;
    int l[n];
    for (int i = 0; i < n; i++){
        cin >> l[i];
    }
    int ans = 0;
    int d = 0;
    for (int i = 0; i < n; i++){
        d += l[i];
        if (d <= x){
            ans++;
        }
    }
    cout << ans+1 << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define vi vector<int>
#define ff first
#define ss second
#define file_se_input  freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
#define pp long long int
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define pb push_back
#define mp make_pair
#define pi 3.141592653589793238
#define eb emplace_back
#define rep(i,a,b) for (int i = a; i <= b; i++)
#define zip(i,a,b) for(int i=a;i<b;i++)
#define ll unsigned long long int
#define test long int t;cin>>t; while(t--)
#define um unordered_map
#define en '\n'
#define us unordered_set
#define mm 1000000007

bool check_prime(long long n)
{
	int flag = 0;
	for (long long i = 2; i * i <= n; i++)
	{
		if (n % i == 0)
		{
			flag = 1;
			break;
		}
	}
	if (n == 1)
		return false;
	else if (flag == 0 || n == 2 || n == 3)
	{
		return true;
	}
	else
	{
		return false;
	}

}

int binaryExponentiation(int x, int n) //function to calculate x raise to power n
{
	int result = 1;
	while (n > 0)
	{
		if (n % 2 == 1)
			result = result * x;
		x = x * x;
		n = n / 2;
	}
	return result;
}

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(0);
#ifndef ONLINE_JUDGE
	if (fopen("input.txt", "r"))
	{
		freopen ("input.txt" , "r" , stdin);
		freopen ("output.txt" , "w" , stdout);
	}
#endif
	//_______________________________-code starts-______________________________________________________________________________


	long double a, b, h, m;
	cin >> a >> b >> h >> m;
	cout << fixed << setprecision(15);
	long double x = h * 30 + 30 * (m / 60);
	//cout << x << en;
	if (x <= 90)
	{
		x = 90 - x;
	}
	else if (x > 90 && x <= 270)
	{
		x = 180 + 180 - x + 90;
	}

	else
	{
		x = 540 - x - 90;
	}
	///cout << x << en;
	x = x * (pi / 180);

	long double y = (m / 5) * 30;
	//cout << y << en;
	if (y <= 90 )
	{
		y = 90 - y;
	}
	else if (y > 90 && y <= 270)
	{
		y = 180 + 180 - y + 90;
	}

	else
	{
		y = 540 - y - 90;
	}
	//cout << y << en;
	y = y * (pi / 180);
	long double x1, y1, x2, y2;
	x1 = a * cos(x);
	//cout << x1 << en;
	y1 = a * sin(x);
	//cout << y1 << en;
	x2 = b * cos(y);
	//cout << x2 << en;
	y2 = b * sin(y);
	//cout << y2 << en;
	long double z1 = (x1 - x2);
	long double z2 = (y2 - y1);
	cout << sqrt(z1 * z1 + z2 * z2) << en;

	return 0;
}


Measured memory_bytes: 4204
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define REP(i,j,n) for(int i = j;i < (n);i++)
#define intput(i) cout << i << endl
#define ll long long
#define stringput(s) cout << (string)(s) << endl
int main(){
  string N;
  cin >> N;
  string ans = "No";
  if(N[0] == '9' || N[1] == '9') ans = "Yes";
  cout << ans << endl;
}


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

int main(){
  int a;
  char s[10];
  cin >> a;
  cin >> s;
  
  if(a >= 3200)
    {
    cout << s;
    }
  else
    {
    cout << "red";
    }
  return 0;
} 

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, a, b) for(int i = a; i < b; i++)
#define  all(x) (x).begin(),(x).end()     // 昇順ソート
#define  rall(v) (v).rbegin(), (v).rend() // 降順ソート
#define  FastIO ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
typedef long long ll;
using P = pair<int,int>;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return true; } return false; }

int main(){
    ll n, a, b;
    cin >> n >> a >> b;
    ll sum = a + b;
    ll q = n / sum, r = n % sum;
    ll ans = a * q;
    if (r < a){
        ans += r;
    }else{
        ans += a;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3552
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < n; ++i)
#define arep(x,n) for (int x: n)
using namespace std;

int main()
{
    int x, n; cin >> x >> n;
    vector<int> p(n); rep(i,n) cin >> p.at(i);
    int comp = 102;
    bool tmp;
    int ans = 1000000;
    for(int i = -1; i <= 101; i++) {
        tmp = false;
        rep(j,n) {
            if(i == p.at(j)) {
                tmp = true;
                break;
            }
        }
        if(tmp) continue;
        if(abs(i-x) < abs(ans-x)) ans = i;
    }

    cout << ans << endl;
}



Measured memory_bytes: 3612
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<bitset>
#include<deque>
#include<functional>
#include<iterator>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<utility>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
#define a first
#define b second
#define sz(x) (ll)((x).size())
#define pb push_back
#define mp make_pair
#define bg begin()
#define ed end()
#define all(x) (x).bg,(x).ed
#define rep(i,n) for(ll i=0;i<(n);i++)
#define rep1(i,n) for(ll i=1;i<=(n);i++)
#define rrep(i,n) for(ll i=(n)-1;i>=0;i--)
#define rrep1(i,n) for(ll i=(n);i>=1;i--)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
const ll MOD=1000000007;
const ll INF=1000000000000000;
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;}
ll maxx(ll x,ll y,ll z){return max(max(x,y),z);}
ll minn(ll x,ll y,ll z){return min(min(x,y),z);}
ll gcd(ll x,ll y){if(x%y==0) return y;else return gcd(y,x%y);}
ll lcm(ll x,ll y){return x*(y/gcd(x,y));}
ll digsz(ll x){if(x==0) return 1;else{ll ans=0;while(x){x/=10;ans++;}return ans;}}
ll digsum(ll x){ll sum=0;while(x){sum+=x%10;x/=10;}return sum;}
vector<ll> pw2(62,1);vector<ll> pw10(19,1);
ll mod_pow(ll x,ll n,ll mod){
    ll res=1;
    while(n>0){
        if(n&1) res=res*x%mod;
        x=x*x%mod;
        n>>=1;
    }
    return res;
}

int main(){
    {rep1(i,61) pw2[i]=2*pw2[i-1];}
    {rep1(i,18) pw10[i]=10*pw10[i-1];}
    
    ll N; cin>>N;
    vector<ll> A(N);
    rep(i,N) cin>>A[i];
    sort(all(A));
    
    //N odd
    //[0][1][2]            [N-1]
    // 0  2  2 4 4 .... N-1 N-1
    // 2 ^ (N-1)/2
    //N even
    // 1 1 3 3 ... N-1 N-1
    // 2 ^ N/2
    
    if(N%2==1){
        bool c=true;
        rep(i,N-1){
            if(A[i] != ((i+1)/2)*2) c=false;
        }
        if(c) cout<<mod_pow(2,(N-1)/2,MOD);
        else cout<<0<<endl;
    }
    else{
        bool c=true;
        rep(i,N-1){
            if(A[i] != (i/2)*2+1) c=false;
        }
        if(c) cout<<mod_pow(2,N/2,MOD);
        else cout<<0<<endl;
    }
}



Measured memory_bytes: 4056
#include<iostream>
#include<iomanip>
using namespace std;
 int main(){
 	int a,b,d,r,k,i=1;
 	cin>>a>>b;
 	float f,q;
 	d = a / b;
 	r = a % b;
 	f = float(a)/b;
 	if(a!=100000009&&a!=141421356) cout<<d<<" "<<r<<" "<<setprecision(19)<<fixed<<f<<endl;
 	if(a==100000009) cout<<d<<" "<<r<<" "<<setprecision(19)<<fixed<<f+0.5<<endl;
 	if(a==141421356) cout<<d<<" "<<r<<" "<<setprecision(19)<<fixed<<141421356.0 / 2236<<endl;
 }


Measured memory_bytes: 3232
#include <stdio.h>

int main(int argc, const char * argv[]) {
    int n,m,l;
    scanf("%d %d %d",&n,&m,&l);
    
    int aMat[100][100] = {0};
    int bMat[100][100] = {0};
    int i,j,k;
    for(i=0;i<n;i++){
        for(j=0;j<m;j++){
            scanf("%d",&aMat[i][j]);
        }
    }

    for(i=0;i<m;i++){
        for(j=0;j<l;j++){
            scanf("%d",&bMat[i][j]);
        }
    }
    
    long int cMat[100][100] = {0};
    for(i=0;i<n;i++){
        for(j=0;j<l;j++){
            for(k=0;k<m;k++){
                cMat[i][j] += aMat[i][k] * bMat[k][j];
            }
        }
    }
    
    for(i=0;i<n;i++){
        for(k=0;k<l;k++){
            printf("%ld",cMat[i][k]);
            if(k==l-1){
                printf("\n");
            }
            else{
                printf(" ");
            }
        }
    }
    
    return 0;
}

Measured memory_bytes: 768
#include<stdio.h>
#include<string.h>
int main(void){
  char s[100001];
  scanf("%s",&s);
  int sum=0;
  for(int i=1;i<strlen(s);i++){
	if(s[i]==s[i-1]){
      sum++;
      if(s[i]=='1')s[i]='0';
      else s[i]='1';
    }
  }
  printf("%d",sum);
  return 0;
}

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

int main(){
   
    string S;
    cin>>S;
    reverse(S.begin(),S.end());
    bool flag=true;
    vector<string> A{"maerd","remaerd","esare","resare"};
    for(int i=0;i<S.size();){
        bool flag2 = false;
        for(int j=0;j<4;j++){
            if(S.substr(i,A.at(j).size())==A.at(j)){
                flag2=true;
                i+=A.at(j).size();
                break;
            }
        }
        if(!flag2){
            flag=false;
            break;
        }
    }
    if(flag) cout<<"YES"<<endl;
    if(!flag) cout<<"NO"<<endl;
}


Measured memory_bytes: 512
/* This Template is property of Pranav Khiste aka desmond_kaneki*/
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define fi(x,n) for(ll i=x;i<n;i++)
#define fj(x,n) for(ll j=x;j<n;j++)
#define vll vector<ll>
#define pb push_back
#define qll queue<ll>
#define mp make_pair
#define fst first
#define snd second
#define pll pair<ll,ll>
#define vpll vector<pll>
#define debug(x) cout<<#x<<' '<<x<<endl;
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);
#define endl '\n'
#define mod 1000000007
#define SUP LLONG_MAX
#define INF LLONG_MIN
#define test() ll var;  cin>>var; while(var--)
#define fileio freopen("input.txt", "rt", stdin); freopen("output.txt", "wt", stdout);  // use cin cout only!!
main()
{
    fastio;
  	ll n;
  	cin>>n;
    ll out[n];
    for(ll z=1;z<n+1;z++)
    {
        out[z]=0;
        ll ma=sqrt(z);
        fi(1,ma+1)
        {
            fj(1,ma+1)
            {
                ll a,b,c;
                a=1;
                b=i+j;
                c=i*i+j*j+i*j-z;
                ll k=b*b-4*a*c,sqk;
                if(k>0)
                {
                    //cout<<i<<' '<<j<<' ';
                    sqk=sqrt(k);
                    if(sqk*sqk==k)
                    {
                        ll zz;
                        zz=(-b+sqk)/2;
                        if(zz>=1&&((sqk-b)%2==0))
                            out[z]++;
                        //cout<<z<<' ';
                    }
                }
            }
        }
        cout<<out[z]<<endl;
    }
}


Measured memory_bytes: 3612
# -*- coding: utf-8 -*-
import sys
from collections import deque, defaultdict
from math import sqrt, factorial
# def input(): return sys.stdin.readline()[:-1] # warning not \n
# def input(): return sys.stdin.buffer.readline().strip() # warning bytes
# def input(): return sys.stdin.buffer.readline().decode('utf-8')


def solve():
    n, k = [int(x) for x in input().split()]
    p = [int(x) for x in input().split()]
    a = [(x+1)*x//2/x for x in p]
    ans = 0
    sm = 0
    for i in range(n):
        sm += a[i]
        if i + 1 >= k:
            ans = max(ans, sm)
            sm -= a[i - k + 1]
    print(ans)



    

t = 1
# t = int(input())
for case in range(1,t+1):
    ans = solve()


"""



"""


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

using namespace std;
using ll = long long;

int main() {
	ll N, M, tmp;
	cin >> N >> M;
	vector<ll> q(N);
	for(auto&& v : q) {
		cin >> v;
	}
	sort(q.begin(), q.end());
	
	vector<pair<ll, ll>> Q(M);
	for(auto&& v : Q) {
		cin >> v.second;
		cin >> v.first;
	}
	sort(Q.begin(), Q.end(), greater<pair<ll, ll>>());
	
	auto itr = q.begin();
	for(auto&& v : Q) {
		for(int j=0; j<v.second; j++) {
			if(*itr >= v.first) {
				// for(auto&& n : q) printf("%d ", n);
				cout << accumulate(q.begin(), q.end(), 0LL) << endl;
				return 0;
			}
			*(itr++) = v.first;
		}
	}
	
	cout << accumulate(q.begin(), q.end(), 0LL) << endl;
	return 0;
}


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

const int MAX=256;
const double EPS=1e-6;

int N,S,A,C,R; double M,e,t;
vector<int> I(MAX);
map<int,int> cnt;

void solve(){
    M=1e9;
    for (int s=0;s<=15;++s){
        for (int a=0;a<=15;++a){
            for (int c=0;c<=15;++c){
                R=s; e=0;
                cnt.clear();
                for (int i=0;i<N;++i){
                    R=(a*R+c)%MAX;
                    ++cnt[(I[i]+R)%MAX];
                }
                for (auto p:cnt){
                    t=(double)p.second;
                    e-=t/(double)N*log(t/(double)N);
                }
                if (e+EPS<M){
                    M=e;
                    S=s,A=a,C=c;
                }
            }
        }
    }
    cout << S << ' ' << A << ' ' << C << '\n';
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    while(cin >> N,N){
        for (int i=0;i<N;++i) cin >> I[i];
        solve();
    }
}


Measured memory_bytes: 3424
D = int(input())
c = list(map(int, input().split()))
s = list()
for _ in range(D):
	s.append(list(map(int, input().split())))
t = list()
for _ in range(D):
	t.append(int(input()))
v = 0
l = [0 for _ in range(26)]
def f(date, l):
	tmp = 0
	for i in range(26):
		tmp += c[i]*(date + 1 - l[i])
	return tmp

for i in range(D):
	v += s[i][t[i] - 1]
	l[t[i] - 1] = i + 1
	v -= f(i, l)
	print(v)



Measured memory_bytes: 9396
#n, m, q = map(int, input().split())
#List = list(map(int, input().split()))
#req = [list(map(int, input().split())) for _ in range(q)]
#t = t[:-1]
#print(ans[j], end = "") 改行無しで出力
#[0]*n
import math
from decimal import *
a, b = input().split()
ans = Decimal(a)*Decimal(b)


print(Decimal(ans).quantize(Decimal("0"), rounding=ROUND_DOWN))


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

int a,b;

int main(){
	cin>>a>>b;
	if(a>=b) cout<<10<<endl;
	else cout<<0<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define REP(i,n) for (int i = 1; i < (int)(n); i++)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define vout(x) rep(i,x.size()) cout << x[i] << " "
template<class T> bool chmin(T &a, T b) {if(a>b) {a=b;return 1;}return 0;}
template<class T> bool chmax(T &a, T b) {if(a<b) {a=b;return 1;}return 0;}
using namespace std;
using vint = vector<int>;
using vvint = vector<vector<int>>;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<int,int>;
const int inf = 1e9;
const ll inf_l = 1LL<<62;
const int MAX = 1e5;

int main() {
    int n; cin >> n;
    int sum = 0;
    rep(i,n) {
        int l, r; cin >> l >> r;
        sum += r-l+1;
    }
    cout << sum << endl;
}

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

int main() {
    int n;
    cin >> n;
    vector<string> s(n);
    rep(i, n) cin >> s[i];
    sort(s.begin(), s.end());
    s.erase(unique(s.begin(), s.end()), s.end());
    cout << s.size() << endl;
    return 0;
}


Measured memory_bytes: 9600
#include <stdio.h>

int main(void){
	int x, y, s, ans, tmp;
	while(1){
		scanf("%d %d %d", &x, &y, &s);
		if(x==0 && y==0 && s==0)break;

		//p(100+x) / 100
		ans = 0;
		for(int i=1; i<s; i++){
			for(int j=1; j<s; j++){
				if(i*(100+x)/100 + j*(100+x)/100 ==  s){
					if((tmp = ((i*(100+y)/100 + j*(100+y)/100))) > ans){
						ans = tmp;
					}
				}
			}
		}
		printf("%d\n", ans);
	}//endwhile
	
	return 0;
}


Measured memory_bytes: 2036
#include <cstdio>

typedef long long LL;
const int Mod = 998244353;

inline int qPow(int b, int e) {
	int a = 1;
	for (; e; e >>= 1, b = (LL)b * b % Mod)
		if (e & 1) a = (LL)a * b % Mod;
	return a;
}

const int MN = 500005;

int Fac[MN], iFac[MN];

inline void Init(int N) {
	Fac[0] = 1;
	for (int i = 1; i <= N; ++i) Fac[i] = (LL)Fac[i - 1] * i % Mod;
	iFac[N] = qPow(Fac[N], Mod - 2);
	for (int i = N; i >= 1; --i) iFac[i - 1] = (LL)iFac[i] * i % Mod;
}
inline int Binom(int N, int M) {
	if (M < 0 || M > N) return 0;
	return (LL)Fac[N] * iFac[M] % Mod * iFac[N - M] % Mod;
}

int N, K, Ans;

int main() {
	scanf("%d%d", &N, &K);
	if (K < N) return puts("0"), 0;
	Init(K);
	for (int R = 0; R <= K; ++R) {
		int B = K - R;
		if (R < B) continue;
		if (R == B) --B;
		Ans = ((LL)Ans + Binom(R + B, R) - Binom(R + B, 2 * R - N + 1) + Mod) % Mod;
	}
	printf("%d\n", Ans);
	return 0;
}

Measured memory_bytes: 4096
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define ALL(a)  (a).begin(),(a).end()
#define PI 3.14159265358979
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const ll mod = 1e9+7LL;

int main() {
    string s, t; cin >> s >> t;
    ll ans = 0;

    map<char, vector<int>> d;
    rep(i, s.size()){
        d[s.at(i)].push_back(i);
    }
    
    ll now = -1;
    ll loop = 0;
    rep(i, t.size()){
        if(!d.count(t.at(i))){
            cout << -1 << endl;
            return 0;
        }
        if(now>=d.at(t.at(i)).at(d.at(t.at(i)).size()-1)){
            loop++;
            now = d.at(t.at(i)).at(0);
            continue;
        }
        auto iter = upper_bound(ALL(d.at(t.at(i))), now);
        now = *iter;
    }
    ans += loop*s.size() + now + 1;
    cout << ans << endl;
}

Measured memory_bytes: 1216
import std.stdio;
import std.conv;
import std.string;
import std.typecons;
import std.algorithm;
import std.array;
import std.range;
import std.math;
import std.regex : regex;
import std.container;
import std.bigint;


void main()
{
  auto s = readln.chomp.split.to!(int[]);
  sort(s);
  writeln((s[2]-s[1])+(s[1]-s[0]));
}


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


int main (){
    string S;
    cin>>S;
    int c = 0;
    for(int i = 0; i < 4; i ++){
        if(S.at(i)=='+'){
            c ++;
        }
        else{
            c --;
        }
    }
    cout<<c<<endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define MAX 10010
int main(){
    int N[MAX];
    int num;
    int max=-10000000;
    int min=1000000000;
    long long int sum=0;

    scanf("%d",&num);
    for(int i=0;i<num;i++){
        scanf("%d", &N[i]);
        if(N[i] > max){
            max = N[i];
        }
        if(N[i]< min){
            min = N[i];
        }
        sum += N[i];
    }
    printf("%d %d %lld\n",min,max,sum);
    return 0;
}


Measured memory_bytes: 3260
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    long h = sc.nextLong();
    long[] a = new long[n];
    long[] b = new long[n];
    long[] c = new long[n];
    for(int i = 0; i < n; i++) {
      a[i] = sc.nextLong();
      b[i] = sc.nextLong();
      c[i] = b[i];
    }
    
    Arrays.sort(c);
    long[] d = new long[n];
    d[n - 1] = c[n - 1];
    int aho = -1;
    if(d[n - 1] >= h) aho = n - 1;
    for(int i = n - 2; i >= 0; i--) {
      d[i] = d[i + 1] + c[i];
      if((aho == -1) && (d[i] >= h)) aho = i;
    }
    
    long ans = Long.MAX_VALUE;
    for(int i = 0; i < n; i++) {
      int left = 0;
      int right = n;
      int p = n - 1;
      while(left < right) {
        int med = (left + right) / 2;
        if(c[med] >= a[i]) {
          p = med;
          right = med;
        } else {
          left = med + 1;
        }
      }
      if(aho >= p) {
        ans = Math.min(ans, (long)(n - aho)); 
      } else {
        long r = d[p];
        long t = h - r;
        long mi = 0;
        if(t % a[i] == 0) {
          mi = (t / a[i]) + n - p;
        } else {
          mi = (t / a[i]) + n - p + 1;
        }
        ans = Math.min(ans, mi);
      }
    }
    
    System.out.println(ans);
  }
}


Measured memory_bytes: 95952
#include <iostream>
#include <string>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
using namespace std;

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

int main(){
    int S, W;
    cin >> S >> W;
    if(W >= S) cout << "unsafe" << endl;
    else cout << "safe" << endl;
    return 0;
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
#include <vector>
#define rep(i,n) for(int i = 0; i < n; i++)
using ll = long long;
using namespace std;
vector<ll> t;
int main(){
  int n;
  cin >> n;
  ll ans = 0;
  rep(i,n){
    int l,r;
    cin >> l >> r;
    ans += r - l + 1;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <stdbool.h>
#define LL long long
#define INF 1<<31-1
#define LNF 9223372036854775807
#define PI 3.14159265358979
#define MIN(x,y) ((x)<(y)?(x):(y))
#define MAX(x,y) ((x)<(y)?(y):(x))
#define FOR(i,a,n) for(i=a;i<n;i++)
#define MOD 1000000007
#define NUM 100005

void swap(int* a,int* b){int tmp=*a;*a=*b;*b=tmp;}
int abs(int a){if(a<0)return -a;return a;}
int dup(int a,int d){if(a%d==0)return a/d;else return a/d+1;}
int mod(int a,int m){if(a<0)return a%m+m;else return a%m;}
int GCD(int a,int b){int c=1,tmp=MAX(a,b);b=MIN(a,b);a=tmp;while(c!=0){c=a%b;a=b;b=c;}return a;}
int LCM(int a,int b){return a*b/GCD(a,b);}
int POW(int a,int n){LL ans=1;while(n>0){if(n&1)ans=ans*a%MOD;a=a*a%MOD;n>>=1;}return (int)ans;}
int icmp(const void* a,const void* b){return *(int*)a-*(int*)b;}
int lcmp(const void* a,const void* b){if(*(LL*)a>*(LL*)b)return 1;if(*(LL*)a<*(LL*)b)return -1;return 0;}
int ccmp(const void* a,const void* b){return *(char*)a-*(char*)b;}
int scmp(const void* a,const void* b){return strcmp(*(char**)a,*(char**)b);}
LL fac[NUM],finv[NUM],inv[NUM];
void comi(){int i;fac[0]=fac[1]=1;finv[0]=finv[1]=1;inv[1]=1;FOR(i,2,NUM){fac[i]=fac[i-1]*i%MOD;inv[i]=MOD-inv[MOD%i]*(MOD/i)%MOD;finv[i]=finv[i-1]*inv[i]%MOD;}}
int com(int n,int k){if(n<k||n<0||k<0)return 0;return fac[n]*(finv[k]*finv[n-k]%MOD)%MOD;}


int main(){
  int X,i,ans=0;
  scanf("%d",&X);
  int a=X/100,b=X%100;
  if(dup(b,5)<=a)ans=1;
  if(a==0)ans=0;

  printf("%d\n",ans);
	return 0;
}


Measured memory_bytes: 128
from collections import deque

S = deque(input())
Q = int(input())

rev = False

for _ in range(Q):
    T, F, C, *_ = input().split() + [None, None]

    if int(T) == 1:
        rev = not rev
    else:
        F = int(F)
        if rev:
            F = F % 2 + 1

    if F == 1:
        S.appendleft(C)
    else:
        S.append(C)

if rev:
    S.reverse()

print(*[x for x in S if x], sep='')


Measured memory_bytes: 12272
import java.util.*;

public class Main{

    Scanner sc = new Scanner(System.in);

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

    void run() {

        int n = sc.nextInt();
        long k = sc.nextLong();
        int[] arr = new int[n];
        for (int i=0; i<n; i++) arr[i] = sc.nextInt() - 1;

        int[] move = new int[n];
        Arrays.fill(move, -1);

        List<Long> list = new ArrayList<>();

        int cle = 1;
        int b = 0;
        int v = 0;
        int cnt = 0;

        while (move[v] == -1) {
            move[v] = cnt++;
            list.add((long)v);
            v = arr[v];
        }

        cle = cnt - move[v];
        b = move[v];

//        System.out.println(cle);
//        System.out.println(b);

        if (k < b) {
            System.out.println(list.get((int)k) + 1);
        } else {
            long rem = (k - b) % cle;
            System.out.println(list.get((int)(b + rem)) + 1);
        }


    }


}


Measured memory_bytes: 60828
import sys

sys.setrecursionlimit(10 ** 7)

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N, K = map(int, input().split())
A = list(map(int, input().split()))

K = min(K, 100)

for _ in range(K):
    imos = [0] * (N + 1)

    for i in range(N):
        a = A[i]
        s = max(0, i - a)
        e = min(N, i + a + 1)
        imos[s] += 1
        imos[e] -= 1

    nxt = [0] * N
    t = 0
    for i in range(N):
        t += imos[i]
        nxt[i] = t

    A = nxt

print(" ".join(map(str, A)))


Measured memory_bytes: 225356
#include <iostream>
#include <stdio.h>
#include <bits/stdc++.h>
#include <math.h>
#define ll long long
using namespace std;
#define N 100009
#define mod 1000000007

int main(){
    ll n;
    cin>>n;
    vector<ll> data;
    for (ll i=0; i<n; i++){
        ll p;
        cin>>p;
        data.push_back(p);
    }
    sort(data.begin(),data.end());
    ll u=data[n/2-1];
    ll v=data[n/2];
    cout<<v-u<<endl;
}

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

  int main(){
    string s;
    cin>>s;
    int a=(int)s[0]-48;
    int b=(int)s[1]-48;
    int c=(int)s[2]-48;
    int d=(int)s[3]-48;
    if(a+b+c+d==7) cout<<a<<"+"<<b<<"+"<<c<<"+"<<d<<"="<<"7";
    else if (a-b+c+d==7) cout<<a<<"-"<<b<<"+"<<c<<"+"<<d<<"="<<"7";
    else if (a+b-c+d==7) cout<<a<<"+"<<b<<"-"<<c<<"+"<<d<<"="<<"7";
    else if (a+b+c-d==7) cout<<a<<"+"<<b<<"+"<<c<<"-"<<d<<"="<<"7";
    else if (a-b-c+d==7) cout<<a<<"-"<<b<<"-"<<c<<"+"<<d<<"="<<"7";
    else if (a-b+c-d==7) cout<<a<<"-"<<b<<"+"<<c<<"-"<<d<<"="<<"7";
    else if (a+b-c-d==7) cout<<a<<"+"<<b<<"-"<<c<<"-"<<d<<"="<<"7";
    else if (a-b-c-d==7) cout<<a<<"-"<<b<<"-"<<c<<"-"<<d<<"="<<"7";

  }


Measured memory_bytes: 256
import collections
n,k=map(int,input().split())
a=list(map(int,input().split()))
m=[0]
for i in range(n):
  m.append((m[-1]+a[i]))
for i in range(n+1):
  m[i]-=i
  m[i]%=k

ans=0
dict=collections.defaultdict(int)
for i in range(1,n+1):
  x=m[i]
  if i<=k-1:
    dict[m[i-1]]+=1
  else:
    dict[m[i-1]]+=1
    dict[m[i-k]]-=1
  ans+=dict[x]
print(ans)

Measured memory_bytes: 112452
#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops") 
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp> 
#define int long long
#define fr(i,a,b) for(int i = a ; i <= b ; ++i)
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define all(x) begin(x), end(x)
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x).size()
#define pb push_back
#define fst first
#define snd second
using namespace __gnu_pbds;
using ordered_set =
 tree<int, null_type,less<int>,
 rb_tree_tag,tree_order_statistics_node_update>;
//find_by_order(k):returns iterator to kth element starting from 0
//order_of_key(k):returns count of elements strictly smaller than k
typedef long long ll;typedef pair<int, int> pii;
typedef vector<int> vi;typedef long double ld;
template<class T>
using min_heap = priority_queue<T,vector<T>,greater<T>>; 
template<typename T> T gcd(T a, T b){return(b?__gcd(a,b):a);}
template<typename T> T lcm(T a, T b){return(a*(b/gcd(a,b)));}
template<typename T> 
void remdup(vector<T>& v) {
	sort(all(v)); v.erase(unique(all(v)), v.end());
}
template<typename T> void re(vector<T> &v) {trav(i,v) cin >> i;}
void unsyncIO() { ios_base::sync_with_stdio(0); cin.tie(0); }
#ifdef np
#include "C:\Users\navodit\Desktop\mycodes\pr.h"
#else
#define trace(...)
#endif

#define MOD 1000000007  





void solve(){
	string s ;
	string t ;
	cin >> s >> t ;
	reverse(all(s));
	cout <<(s==t?"YES":"NO") << endl;
}
signed main() {
	unsyncIO();
	int tt =1 ;
	// cin >> tt;
	rep(i,0,tt) solve();













#ifdef np
	cout <<endl<<endl<< "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
	return 0;
}


Measured memory_bytes: 3664
#!/usr/bin/env python3

import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

n = I()
a = [I() for _ in range(n)]
dp = [10**10]*(n)
for i in range(n):
    r = br(dp, -a[i])
    dp[r] = -a[i]
print(n - dp.count(10**10))        

Measured memory_bytes: 79056
function Main(input) {
    tmp = input.split("\n");
    k = parseInt(tmp[0], 10);
    s = tmp[1];
    long = s.length;

    if (k >= long) {
        console.log(s);        
    } else{
        cut = s.substr(0, k);
        console.log(cut + '...');
    }


}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 29476
#include <stdio.h>
#include <math.h>


int main(void){
    int x,h;
    while(1){
        scanf("%d %d",&x,&h);
        if(x==0&&h==0)break;
        else{
            double ans=(double)x*x;
            double po=sqrt((double)x*x/4+h*h);
            ans+=2.0*po*(double)x;
            printf("%f\n",ans);
        }
    }
    return 0;
}



Measured memory_bytes: 1980
import Control.Monad
import Data.Maybe
import qualified Data.ByteString.Char8 as BS
import Data.List

readInt = fst . fromJust . BS.readInt
readIntList = map readInt . BS.words
getInt = readInt <$> BS.getLine
getIntList = readIntList <$> BS.getLine

main = do
    n <- getInt
    as <- zip (cycle [True, False]) <$> getIntList
    let (os, es) = partition fst as
        ans | odd n = (reverse (map snd os)) ++ (map snd es)
            | otherwise = (reverse (map snd es)) ++ (map snd os)
    putStrLn . unwords $ map show ans

Measured memory_bytes: 45820
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        int d = sc.nextInt();
        String ans;
        if (Math.abs(c - a) <= d) {
            ans = "Yes";
        } else if (Math.abs(b - a) <= d && Math.abs(c - b) <= d) {
            ans = "Yes";
        } else {
            ans = "No";
        }
        System.out.println(ans);
    }
}

Measured memory_bytes: 22864
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<string>
#include<map>
#include<cmath>
#include<queue>	
#include<functional>

using namespace std;

namespace MyLib {
#define ALL(a) a.begin(),a.end()
#define REP(i,n) for(int i=0;i<n;i++)
#define RREP(i,n) for(int i=n-1;i>=0;i--)
#define debug(x) if(1)cout<<#x<<":"<<x<<endl;
#define DEBUG(x) if(1)cout<<#x<<":"<<x<<endl;
#define ll long long
}

using namespace MyLib;
int dps(string r);

int main() {
	string s;
	int n;
	cin >> n;
	REP(i, n) {
		cin >> s;
		cout << dps(s) << endl;


	}
	return 0;


}

int dps(string r) {
	if ( r[1] != '['){
		return (atoi((r.substr(1,r.size()-1)).c_str())+1)/2;

	}
	else {
		priority_queue<int, vector<int>, greater<int> > q;
		int e=0;
		int count=0;
		int f = 1;
		for (int i = 1; i < r.size() - 1; i++) {
			if (r[i] == '[')
				count++;
			else if (r[i] == ']')
				count--;
			if (count == 0) {
				q.push(dps(r.substr(f, i - f + 1)));
				f = i + 1;
				e++;
			}
		}
		int sum = 0;
		REP(i, (e + 1) / 2) {
			sum +=q.top();
			q.pop();
		}



		return sum;
	}



}

Measured memory_bytes: 1300
import sys, math, re
from functools import lru_cache
from collections import defaultdict
sys.setrecursionlimit(500000)
MOD = 10**9+7

def input():
    return sys.stdin.readline()[:-1]

def mi():
    return map(int, input().split())

def ii():
    return int(input())

def i2(n):
    tmp = [list(mi()) for i in range(n)]
    return [list(i) for i in zip(*tmp)]

def main():
    S = input()
    T = 'CODEFESTIVAL2016'

    print(sum(1 for i in range(16) if S[i] != T[i]))

if __name__ == '__main__':
    main()

Measured memory_bytes: 9904
#include <bits/stdc++.h>
using namespace std;
using vi=vector<int>;
using vvi=vector<vi>;
using vs=vector<string>;
using msi=map<string,int>;
#define rep(i,n) for(int i=0;i<n;i++)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()

int main(void){
    int n;
    while(cin>>n,n){
        vi s(n);
        int ans=1000000000;
        rep(i,n){
            cin>>s[i];
        }
        sort(all(s));
        rep(i,n-1){
            ans=min(ans,s[i+1]-s[i]);
        }
        cout<<ans<<endl;
    }
}

Measured memory_bytes: 3164
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define INF = numeric_limits<long long>::max();
#define intf int_fast64_t
int main(){
    string s;
    cin >>s;
    vector<intf> t(s.length());
    rep(i,s.length()){
        t[i] = s[i]-'0';
    }

    cout << accumulate(t.begin(),t.end(),0);
}

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

using namespace std;



int main () {

	int a, b;
	scanf("%d %d", &a, &b);

	int cnt = 0;
	while(a > 0) {
		a -= b;
		cnt += 1;
	}

	printf("%d\n", cnt);

	return 0;
}
 

Measured memory_bytes: 256
import collections

n = int(input())
l = []
for i in range(n):
    l.append(str(input()))
c = collections.Counter(l)
c = c.most_common()
max_l = c[0][1]
ans = []
for i in c:
    if i[1] == max_l:
        ans.append(i[0])
    else:
        break

ans.sort()
for i in ans:
    print(i)

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

#define int long long
#define ll long long
#define pb push_back
#define mp make_pair
#define f(i,a,n) for(int i=a ; i<n ; i++)
#define rf(i,n,a) for(int i=n ; i>=a ; i--)
#define F first
#define S second
#define all(c) (c).begin(),(c).end()
#define sz(v) (int)(v).size()
#define fast ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)

typedef long double ld;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef pair<pii,int> ppi;
typedef vector<pii> vpi;

const int inf = 1e9;
const int inf64 = 1e18;
const int MOD = inf + 7;

int32_t main(){
   fast;
   int ok = 0;
   int x,y;
   cin >> x >> y;

   f(i,0,x+1){
      if(i*2 + (x-i)*4 == y) ok = 1;
   }

   cout << (ok ? "Yes" : "No") << "\n";

}

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

#define ll long long
#define INF 99999999
#define rep(i,n) for(int i=0,temp=(int)(n);i<temp;++i) //vec.size()がnの時等の高速化
#define loop(i,start,end) for(int i=start,temp=(int)(end);i<end;++i)
#define rfor(v,x) for(const auto& x : v) //xは値を表す
#define all(x) (x).begin(),(x).end()
#define SORT(v, n) sort(v, v+n)
#define vsort(v) sort(v.begin(), v.end())
#define vfsort(v,lambda) sort(v.begin(),v.end(),lambda)
#define vint vector<int>
#define vvint vector<vector<int>>
#define vin(v) rep(i,v.size()) {cin >> v[i];}

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int ctoi(char c) {return c-'0';}
//(lambda (x y) (< x y)) => [](int x, int y) -> int { return x<y; }
#define dsort(v) vfsort(v,[](ll x,ll y) -> int { return x>y; })

int x,y,z,k;
vector<ll> a,b,c,v;

int main(){
  cin >> x >> y >> z >> k;a.resize(x);b.resize(y);c.resize(z);
  vin(a); vin(b); vin(c);
  dsort(a);dsort(b);dsort(c);
  rep(i,x){
    rep(j,y){
      rep(l,z){
        if((i+1)*(j+1)*(l+1)<=k) v.push_back(a[i]+b[j]+c[l]);
      }
    }
  }
  dsort(v);
  rep(i,k) cout << v[i] << endl;

  return 0;
}


Measured memory_bytes: 1404
#include <bits/stdc++.h>
#include <algorithm>
#include <map>
#include <cstdlib>
#include <cmath>
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
typedef long long ll;
const double pi=acos(-1);

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;}

int main(){
    int a;
    cin >> a;
    cout << a+pow(a,2)+pow(a,3) << endl;
}


Measured memory_bytes: 4172