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

void fmin(int&a,int b)
{
    if(b<a)a=b;
}
int s[46][46],dp[46][46][46][46];
char str[46];

inline int read()
{
    register int res=0,flag=1;
    register char ch=getchar();
    while(!isdigit(ch))
    {
        if(ch=='-')
        {
            flag=-1;
        }
        ch=getchar();
    }
    while(isdigit(ch))
    {
        res=(res<<3)+(res<<1)+(ch^48);
        ch=getchar();
    }
    return res*flag;
}

inline int get(register int i,register int j,register int k,register int l)
{
    if(i>k||j>l)return 0;
    return s[k][l]-s[i-1][l]-s[k][j-1]+s[i-1][j-1];
}

int main()
{
    register int n,m,i,j,k,l,x,y,xx,yy,ans;
    n=read();
    m=read();
    for(i=1;i<=n;++i)
    {
        scanf("%s",str+1);
        for(j=1;j<=m;++j)
        {
            if(str[j]=='P')
            {
                xx=i;
                yy=j;
            }
            s[i][j]=s[i-1][j]+s[i][j-1]-s[i-1][j-1]+(str[j]=='#');
        }
    }
    memset(dp,0x3f,sizeof(dp));
    ans=dp[0][0][0][0];
    dp[1][1][n][m]=0;
    for(i=1;i<=xx;++i)
    {
        for(j=1;j<=yy;++j)
        {
            for(k=n;k>=xx;--k)
            {
                for(l=m;l>=yy;--l)
                {
                    fmin(ans,dp[i][j][k][l]+min(min(get(i,j,xx,yy),get(i,yy,xx,l)),min(get(xx,j,k,yy),get(xx,yy,k,l))));
                    for(x=i;x<=k;++x)
                    {
                        for(y=j;y<=l;++y)
                        {
                            if(xx<=x&&yy<=y)fmin(dp[i][j][x][y],dp[i][j][k][l]+get(i,y+1,x,l)+get(x+1,j,k,y));
                            if(xx<=x&&y<=yy)fmin(dp[i][y][x][l],dp[i][j][k][l]+get(i,j,x,y-1)+get(x+1,y,k,l));
                            if(x<=xx&&y<=yy)fmin(dp[x][y][k][l],dp[i][j][k][l]+get(i,y,x-1,l)+get(x,j,k,y-1));
                            if(x<=xx&&yy<=y)fmin(dp[x][j][k][y],dp[i][j][k][l]+get(i,j,x-1,y)+get(x,y+1,k,l));
                        }
                    }
                }
            }
        }
    }
    printf("%d\n",ans);
}

Measured memory_bytes: 17920
n = int(input())
b = list(map(int, input().split()))

a = [-float('inf') for i in range(n)]
a[0] = a[1] = b[0]

for i in range(1, n - 1):
    if b[i] < a[i]:
        a[i] = b[i]
    a[i + 1] = b[i]

print(sum(a))

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#include <boost/range/irange.hpp>
using namespace std::literals;
using namespace std;

namespace xmaho
{
inline namespace input
{
template<typename T>
T get_value(std::istream& is = std::cin);
template<typename C>
C get_container(std::istream& is = std::cin, typename C::size_type length = std::numeric_limits<typename C::size_type>::max());
}
}
using namespace xmaho;

int main()
{
  double r;
  cin >> r;
  cout << 2. * r * 3.14159 << endl;
  return 0;
}

class initalization
{
  class custom_numpunct: public std::numpunct<char>
  {
  public:
    using numpunct::numpunct;
  protected:
    std::string do_truename() const override { return "Yes"; }
    std::string do_falsename() const override { return "No"; }
  };

public:
  initalization()
  {
    std::ios_base::sync_with_stdio(false);
    std::cin.tie(nullptr);
    std::cout.imbue(std::locale(std::cout.getloc(), new custom_numpunct{}));
    std::cout << std::boolalpha << std::fixed << std::setprecision(15);
  }
} initalize;

template<typename T>
T xmaho::input::get_value(std::istream& is)
{ T v {}; is >> v; return v; }

template<typename C>
C xmaho::input::get_container(std::istream& is, typename C::size_type length)
{
  C v {};
  if (length != std::numeric_limits<typename C::size_type>::max())
    v.reserve(length);
  typename C::value_type e {};
  for (auto i {length}; i != 0 && is >> e; --i)
    v.push_back(std::move_if_noexcept(e));
  return v;
}


Measured memory_bytes: 3832
import java.util.*;

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();
        if ((b - a) == (c - b)){
            System.out.print("YES");
        }
        else System.out.print("NO");
    }
}

Measured memory_bytes: 23252
from math import factorial
from collections import Counter
 
def conb(n):
    if n <= 1:
        return 0
    else:
        return factorial(n) // factorial(n-2) // factorial(2) 

n = int(input())
S = [''.join(sorted(list(input()))) for i in range(n)]

print(int(sum([conb(i) for i in Counter(S).values()])))

Measured memory_bytes: 19724
#include <iostream>
#include <cstring>
#include <cmath>
#include <vector>
#include <algorithm>
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <set>
#include <map>
#include <iterator>
#include <stack>
#include <string.h>
#include <cstdlib>
#include <queue>
#include <list>
#include <string>

using namespace std;

int main()
{
    int ma,mb,da,db;
    cin >> ma >> da;
    cin >> mb >> db;
    
    if(ma == mb){
        cout << 0 << endl;
    }
    else {
        cout << 1 << endl;
    }
}


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

using namespace std;

#define lli long long int
#define REP(i,s,n) for(int i=s;i<n;i++)
#define MOD 1000000007
#define NUM 2520
#define INF (1LL<<50)
#define DEBUG 0
#define mp(a,b) make_pair(a,b)

int main(){

	lli n;
	cin>>n;

	vector<lli> c(n-1),s(n-1),f(n-1);
	REP(i,0,n-1)cin>>c[i]>>s[i]>>f[i];

	for(lli i=0;i<n;i++){
		lli x=0;
		if(DEBUG)cout<<"i"<<i<<endl;
		for(lli j=i;j<n-1;j++){
			if(DEBUG)cout<<"j="<<j<<"x="<<x<<endl;
			if(x <= s[j]) x = s[j];
			else{
				lli y = x-s[j];
				lli nowY = (y/f[j]);
				if(y%f[j]!=0)nowY++;
				nowY *= f[j];
				x = nowY + s[j];
				if(DEBUG)cout<<"y="<<x<<endl;
				if(DEBUG)cout<<"nowY"<<nowY<<endl;
			}
			if(DEBUG)cout<<"x="<<x<<"cj="<<c[j]<<endl;
			x+=c[j];
		}
		cout<<x<<endl;
	}


	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<atcoder/all>
#pragma GCC optimization ("Ofast")
#pragma GCC optimization ("unroll-loops")
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<n;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define all(v) v.begin(),v.end()
#define P pair<int,int>
#define len(s) (int)s.size()
 
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;
}
constexpr int mod = 1e9+7;
constexpr long long inf = 3e18;

signed main(){
	cin.tie(0);ios::sync_with_stdio(false);
	int N,Q;cin>>N>>Q;
	atcoder::fenwick_tree<int> bit(N);
	rep(i,N){
		int a;cin>>a;bit.add(i,a);
	}
	while(Q--){
		int t;cin>>t;
		if(!t){
			int p,x;cin>>p>>x;bit.add(p,x);
		}else {
			int l,r;cin>>l>>r;
			cout<<bit.sum(l,r)<<"\n";
		}
	}
}

Measured memory_bytes: 8260
import java.util.*;

public class Main {
public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int n=sc.nextInt();
		int m=sc.nextInt();
		int c=sc.nextInt();
		int b[]=new int[m];
		int a[][]=new int[n][m];
		int count=0;
		int total=0;

		for(int i=0;i<m;i++){
			b[i]=sc.nextInt();
		}

		for(int i=0;i<n;i++){
			for(int s=0;s<m;s++){
				a[i][s]=sc.nextInt();
			}
		}

		for(int i=0;i<n;i++){
			total=0;
			for(int s=0;s<m;s++){
				total+=a[i][s]*b[s];
			}
			if(total+c>0){
				count++;
			}
		}

		System.out.println(count);

	}
}


Measured memory_bytes: 22864
#include<stdio.h>
#include<string.h>
int main()
{
    char s[3];
    int n,i,t,p,c=0;
    gets(s);
    n=strlen(s);
    for(i=0;i<n;i++)
    {
        if(s[i]=='o')
        {
            c=c+1;
        }
    }
    p=700+(c*100);
    printf("%d\n",p);
    return 0;

}


Measured memory_bytes: 128
#include<iostream>
#include<set>
#include<vector>
#include<array>
#include<algorithm>
#include<chrono>

uint64_t xor64(void) {
  static uint64_t x = 88172645463325252ULL;
  x = x ^ (x << 7);
  return x = x ^ (x >> 9);
}

auto b_cl = std::chrono::system_clock::now();
inline double get_time() {
  auto e_cl = std::chrono::system_clock::now();
  double msec = std::chrono::duration_cast<std::chrono::milliseconds>(e_cl - b_cl).count();
  return msec;
}

int main() {
  std::cin.tie(0); std::ios::sync_with_stdio(false);
  int D; std::cin >> D;
  int c[26];
  for(auto& ci: c) std::cin >> ci;
  std::vector<std::array<int,26>> s(D);
  for(int d = 0; d < D; ++d) {
    for(auto& si: s[d]) std::cin >> si;
  }
  std::vector<int> t(D);
  for(int i = 0; i < D; ++i) t[i] = i%26;
  std::set<int> last[26];
  for(auto& li: last) li.insert(-1); // sentinel
  int ans = 0;
  for(int d = 0; d < D; ++d) {
    int t1 = t[d];
    ans += s[d][t1];
    last[t1].insert(d);
    for(int i = 0; i < 26; ++i) {
      ans -= c[i]*(d - *last[i].rbegin());
    }
  }
  for(auto& li: last) li.insert(D); // sentinel
  
  // additional score when t[d] = i compare to t[d] = -1
  auto sum_up = [](int d) { return d*(d-1)/2; };
  auto score = [&](int d, int i)->int {
    int res = s[d][i];
    auto it = last[i].lower_bound(d);
    int nd = *it;
    int pd = *--it;
    int diff = sum_up(d-pd) + sum_up(nd-d) - sum_up(nd-pd);
    res -= c[i]*diff;
    return res;
  };
  int lm = 0, renew = 0;
  int sc[26];
  auto one_day = [&](int d) {
    int pi = t[d];
    last[pi].erase(d);
    for(int i = 0; i < 26; ++i) sc[i] = score(d, i);
    int mi = std::max_element(sc, sc+26) - sc;
    if(mi != pi) {
      t[d] = mi;
      ans += sc[mi] - sc[pi];
      ++renew;
    }
    last[mi].insert(d);
  };
  
  // hill climbing
  int range = 16;
  for(int rep = 0;; ++rep) {
    if((xor64()>>25)%2) {
      one_day(xor64()%365);
    } else {
      // swap
      int d1 = xor64()%D, d2 = xor64()%D;
      while(d1 < d2-range || d2 < d1-range || t[d1] == t[d2]) {
          d1 = xor64()%D; d2 = xor64()%D;
      }
      int pi1 = t[d1], pi2 = t[d2];
      last[pi1].erase(d1);
      int diff = score(d1, pi2) - score(d1, pi1);
      last[pi2].insert(d1);
      last[pi2].erase(d2);
      diff += score(d2, pi1) - score(d2, pi2);
      if(diff > 0) {
        last[pi1].insert(d2);
        t[d1] = pi2;
        t[d2] = pi1;
        lm = 0;
      } else {
        last[pi2].insert(d2);
        last[pi2].erase(d1);
        last[pi1].insert(d1);
      }
    }
    if(rep%100 == 0) {
      int x = get_time();
      if(x > 1980) break;
      //if(x > 200) range = 25;
      //if(x > 400) range = 20;
      //if(x > 700) range = 15;
      //if(x > 1000) range = 10;
    }
  }
  for(auto ti: t) std::cout << ti+1 << "\n";
  return 0;
}


Measured memory_bytes: 3680
#include<bits/stdc++.h>
using namespace std;
//Optimisations
#pragma GCC target ("avx2")
#pragma GCC optimization ("unroll-loops")
#pragma GCC optimize("O2")
//shortcuts for functions
#define pb push_back
#define mp make_pair
#define ff first 
#define ss second
#define all(v) v.begin(),v.end()
#define prec(n) fixed<<setprecision(n)
#define n_l '\n'
// make it python 
#define gcd __gcd
#define append push_back
#define str to_string
// utility functions shortcuts
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define sswap(a,b) {a=a^b;b=a^b;a=a^b;}
#define swap(a,b) {auto temp=a; a=b; b=temp;}
#define init(dp) memset(dp,-1,sizeof(dp));
#define set0(dp) memset(dp,0,sizeof(dp));
#define bits(x) __builtin_popcount(x)
#define SORT(v) sort(all(v))
#define endl "\n"
#define forr(i,n) for(ll i=0;i<n;i++)
// declaration shortcuts
typedef long long int ll;
#define int ll
// Constants
constexpr int dx[] = {-1, 0, 1, 0, 1, 1, -1, -1};
constexpr int dy[] = {0, -1, 0, 1, 1, -1, 1, -1};
constexpr ll INF = 1999999999999999997; 
constexpr int inf= INT_MAX;
constexpr int MAXSIZE = int(1e6)+5;
constexpr auto PI  = 3.14159265358979323846L;
constexpr auto oo  = numeric_limits<int>::max() / 2 - 2;
constexpr auto eps = 1e-6;
constexpr auto mod = 1000000007;
constexpr auto MOD = 1000000007;
constexpr auto MOD9 = 1000000009;
constexpr auto maxn = 100006;
//void IOfile(){
//freopen(file_name, reade_mode, stdin);
//freopen(file_name, write_mode, stdout);
//}
void fastio(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
}
int32_t main(){
	fastio();
	char a;
	cin >> a;
	a++;
	cout << a;
}

Measured memory_bytes: 3660
#include <bits/stdc++.h>
#define foi(i,k,n) for (int i = (int)k; i < (int)n; ++i)

using namespace std;
using ii = pair<int,int>;
using ll = long long;

constexpr int MAXN = 5 + 2000;
vector<int> g[MAXN];
int n, dist[MAXN], ans[MAXN];

void bfs(int s) {
  queue<int> q; q.push(s);
  memset(dist, -1, sizeof dist);
  dist[s] = 0;
  while (!q.empty()) {
    int u = q.front(); q.pop();
    assert(dist[u] >= 0);
    for (int v : g[u]) {
      if (dist[v] == -1) {
        dist[v] = 1 + dist[u];
        q.push(v);
      }
    }
  }
  for (int x = 1 + s; x <= n; ++x) {
    if (dist[x] == -1) continue;
    ++ans[dist[x]];
  }
}

int main() {
  ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
  int x,y; cin >> n >> x >> y;
  for (int i = 1; i <= n - 1; ++i) {
    g[i].push_back(1+i);
    g[1+i].push_back(i);
  }
  g[x].push_back(y);
  g[y].push_back(x);
  for (int i = 1; i <= n; ++i) bfs(i);
  for (int i = 1; i <= n-1; ++i) cout << ans[i] << '\n';
  return 0;
}


Measured memory_bytes: 512
#include "bits/stdc++.h"
using namespace std;
#define INF 1000000000
#define rep(i, n) for(int i = 0; i < n; i++)
#define ALL(x) (x).begin(), (x).end()  //昇順
#define RALL(x) (x).rbegin(), (x).rend() // 降順
const long long mod = 1e9+7;
typedef priority_queue<int> PQ;
typedef vector<long long> Vl;
typedef vector<int> VI;  // VI a(n);
typedef vector<string> VS;  
typedef vector<char> VC; 
typedef vector<VS> VSS;
typedef vector<VC> VCC;    
typedef vector<VI> VVI;   // VVI a(n,vector<int>(m)) n * m 
typedef vector<Vl> VVl;
typedef pair<int, int> PII;
typedef map<int, int> MP;   //MP a;
typedef vector<pair<int, int> > PS;
typedef long long ll;  //ll とdoubleは違う
template <class T>  // chmax(max, a);
bool chmax(T &a, const T &b)
{
    if (a < b)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <class T> //chmin(min,a)
bool chmin(T &a, const T &b)
{
    if (b < a)
    {
        a = b;
        return 1;
    }
    return 0;
}
template<typename T>   // operator << (cout,a);
ostream& operator << (ostream& os, vector<T>& v) {
    os << "{";
    rep(i, (int)v.size()) { os << v[i] << (i < v.size() - 1 ? ", " : ""); }
    os << "}";
    return os;
}


int main(){
    int x,y,n,r,g,m,p,h,k,max=-10000000,min=1000000000,ans=0,sum=0;
    string s,t;
    bool f=true;
    cin >> n;
    VI a(n);
    VI b(2*n);
    rep(i,n){
        cin >> a[i];
	}
    int left = n, right = left+1;
    for(int i=0;i<n;i++){
        if(i%2 == (n-1)%2)
            b[left--] = a[i];
        else
            b[right++] = a[i];
    }
    for(int i=left+1;i<right;i++){
        if(i!=right-1)
            cout << b[i] << " ";
        else
        {
            cout << b[i];
        }
        

    }

    return 0;
}

Measured memory_bytes: 4480
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
#define fr(i,n) for(int i=0;i<(n);++i)
#define Fr(i,n) for(int i=1;i<=(n);++i)
#define ifr(i,n) for(int i=(n)-1;i>=0;--i)
#define iFr(i,n) for(int i=(n);i>0;--i)

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    istream& in(cin);
    ostream& out(cout);
    ll n,k,a,z{};
    in>>n>>k;
    vector<ll> m,p;
    fr(i,n){
        in>>a;
        if(a>0) p.emplace_back(a);
        else if(a<0) m.emplace_back(-a);
        else ++z;
    }
    sort(p.begin(),p.end());
    sort(m.begin(),m.end());
    ll M=(ll)p.size()*m.size(),P=(ll)p.size()*(p.size()-1)/2+(ll)m.size()*(m.size()-1)/2;
    if(k<=M){
        k=M-k+1;
        ll l=0,r=1e18,mid;
        while(r-l>1){
            mid=(l+r)>>1;
            ll s{};
            for(auto&i:m) s+=upper_bound(p.begin(),p.end(),mid/i)-p.begin();
            if(s<k) l=mid;
            else r=mid;
        }
        cout<<-r<<endl;
    }
    else if(k<=n*(n-1)/2-P) return puts("0"),0;
    else{
        k=k-n*(n-1)/2+P;
        ll l=0,r=1e18,mid;
        while(r-l>1){
            mid=(l+r)>>1;
            ll s{};
            fr(i,m.size()){
                if(m[i]*m[i]>mid) break;
                s+=upper_bound(m.begin(),m.end(),mid/m[i])-m.begin()-i-1;
            }
            fr(i,p.size()){
                if(p[i]*p[i]>mid) break;
                s+=upper_bound(p.begin(),p.end(),mid/p[i])-p.begin()-i-1;
            }
            if(s<k) l=mid;
            else r=mid;
        }
        cout<<r<<endl;
    }
}

Measured memory_bytes: 2420
#include <bits/stdc++.h>
#define hell 1000000007
#define fast ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define pb push_back
#define ll long long int
#define pi 3.1415926536
using namespace std;
void solve()
{ll t,n,x,y,z,d=0,p=INT_MAX,q,l=INT_MAX,mini=0,prev;
  cin>>n;
  vector<ll> v(n),a(n);
  for(ll i=0;i<n;i++)
  cin>>v[i],a[i]=v[i];
  sort(a.begin(),a.end());
  for(ll i=0;i<n;i++)
  {
  	if(v[i]!=a[i])
  	d++;
  	if(d>2)
  	{
  		cout<<"NO";
  		return;
	  }
  }
  cout<<"YES";
}

int main()
{
  fast
ll t=1;

while(t--)
{solve();
 //cout<<ma<<endl;
}
return 0;}

Measured memory_bytes: 256
using System;
class Qsort
{
    public static void Main()
    {
        string[] str = Console.ReadLine().Split(' ');
        long n = long.Parse(str[0]);
        long x = long.Parse(str[1]);

        string[] str0 = Console.ReadLine().Split(' ');
        long sum = 0;
        long count = 1;


        for (int i = 0; i < n; i++)
        {
            long l = long.Parse(str0[i]);
            sum += l;
            if (sum > x)
            {
                break;
            }
            count++;
        }
        Console.WriteLine(count);


    }


}

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

using namespace std;
using ll = long long;
using ld = long double;

#define int long long
signed main(){
//int main() {
//    ios_base::sync_with_stdio(false);
//    cin.tie(NULL);
    int n,k;
    cin >> n >> k;

    vector<int> a(n);
    for(int i = 0; i < n; i++) cin >> a[i];
    int mx=0;
    for(int i = 0; i < n; i++) mx=max(mx,a[i]);

    int r=mx;
    int l=0;

    while(r-l>1) {
        int mid=l+(r-l)/2;
        int cnt=0;
        for(int i = 0; i < n; i++) {
            int add=(a[i]+mid-1)/mid;
            cnt+=(add-1);
        }

        if(cnt>k)  l=mid;
        else       r=mid;
    }

    cout << r << "\n";
    return 0;
}

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

typedef double db;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;
typedef vector<ll> vll;
typedef vector<int> vi;
typedef complex<double> com;

#define endl '\n'
#define eb emplace_back
#define pb push_back
#define F first
#define S second
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define unique_sort(x) (sort(x.begin(), x.end()), x.resize(distance(x.begin(), unique(x.begin(), x.end()))))
#define fast_io() ios_base :: sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define dbg(x) cout << #x << " = " << x << '\n'
#define dbg2(x,y) cout<<#x<<" = "<<x<<" & "<<#y<<" = "<<y<<endl;

ll n,a[100005];
ll dp[100005];

ll func(ll ind)
{
	if(ind==(n-1))
		return 0;
	if(ind>=n)
		return INT_MAX;

	if(dp[ind]!=-1)
		return dp[ind];

	ll left = abs(a[ind]-a[ind+1]) + func(ind + 1);

	ll right = INT_MAX;

	if(ind+2<n)
	{
		right = abs(a[ind]-a[ind+2]) + func(ind + 2);
	}

	return dp[ind] = min(left,right);

}

void test()
{
	cin>>n;

	memset(dp,-1, sizeof(dp));

	for(ll i=0;i<n;i++)
	{
		cin>>a[i];
	}

	cout<<func(0);
}

int main()
{   
fast_io();
cout << fixed << setprecision(15);
int t = 1;

//cin>>t;

for(int i = 0; i < t; i++)
{
	test();
}
return 0;
}

Measured memory_bytes: 4992
#include <iostream>
#include<algorithm>
#include<string>
#include <cmath>
#include <vector>
#include <map>
#include <cstdio>
#pragma region Macros
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<=n;i++)
#define int long long
#define all(x) (x).begin(),(x).end()
#define swap(a,b) (a += b,b = a - b,a -= b)
#define CEIL(a,b) ((a+b-1)/b)
int GCD(int a, int b) // assuming a,b >= 1
{
	if (a < b)
		swap(a, b);
	if (b == 0)
		return a;
	if (a % b == 0)
		return b;
	return GCD(b, a % b);
}
int LCM(int a, int b) // assuming a,b >= 1
{
	return  a * b / GCD(a, b);
}
inline bool BETWEEN(int x, int min,int max) {
	if (min <= x && x <= max)
		return true;
	else
		return false;
}
using namespace std;
#pragma endregion
signed main() {
	char S,T;
	cin >> S>>T;
	if(S>T)
		cout << ">" << endl;
	if (T > S)
		cout << "<";
	if (T == S)
		cout << "=";
}

Measured memory_bytes: 256
use proconio::*;

#[fastout]
fn main() {
    input! {
        mut a: usize,
        mut b: usize,
        mut c: usize,
    }

    std::mem::swap(&mut a, &mut b);
    std::mem::swap(&mut a, &mut c);
    println!("{} {} {}", a, b, c);
}


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

class Main {

    public static void main(String[] args) {

	Scanner stdin = new Scanner(System.in);

	while ( stdin.hasNext() ) {
	    int n = stdin.nextInt();
	    if ( n > 0 ) {
		boolean first = true;
		int weight = 1;
		while ( n > 0 ) {
		    if ( n % 2 == 1 ) {
			if ( first ) {
			    System.out.print( weight );
			} else {
			    System.out.print( " " + weight );
			}
			first = false;
		    }
		    n /= 2;
		    weight *= 2;
		}
		System.out.println();
	    } else {
		System.out.println( 0 );
	    }
	}
	
    }
    
}

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

int main() {
  int A, B;
  cin >> A >> B;
  
  int ans = 0;
  
  for (int i = A; i <= B; i++) {
    int tmp1, tmp2, tmp3, tmp4;
    tmp1 = i / 10000;
    tmp2 = (i / 1000) % 10;
    tmp3 = (i / 10) % 10;
    tmp4 = i % 10;
  
    if (tmp1 == tmp4 && tmp2 == tmp3) {
      ans++;
    }
  }
  
  cout << ans << endl;
}


Measured memory_bytes: 3620
#define zero(n)(fabs(n)<.01)
main(n,a,b,c,d,p,q,r,D,f){
	for(scanf("%d",&n);n;n--){
		scanf("%d%d%d%d",&a,&b,&c,&d);//fx=ax3+bx2+cx+d
		if(a<0)a=-a,b=-b,c=-c,d=-d;   //won't lose generality
		p=3*a,q=2*b,r=c,D=q*q-4*p*r;  //f'x=3ax2+2bx+c D: f'x=0?
		if(D>0){
			double x1=(-q-sqrt(D))/p/2,x2=(-q+sqrt(D))/p/2;
			double y1=a*x1*x1*x1+b*x1*x1+c*x1+d;
			double y2=a*x2*x2*x2+b*x2*x2+c*x2+d;
			if(!zero(y1)&&!zero(y2)&&y1*y2>0)goto one;
			puts(
				zero(x1)?(
					d==0?"1 0":
					"2 1"
				):zero(x2)?(
					d==0?"0 1":
					"1 2"
				):x1>0?(
					d>0?"2 1":
					d<0?"3 0":
					"2 0"
				):x2<0?(
					d>0?"0 3":
					d<0?"1 2":
					"0 2"
				):(
					d>0?"2 1":
					d<0?"1 2":
					"1 1"
				)
			);
		}else if(D==0)puts(
			d>0?"0 1":
			d<0?"1 0":
			"0 0"
		);else{one:
			puts(d>0?"0 1":d<0?"1 0":"0 0");
		}
	}
	exit(0);
}

Measured memory_bytes: 584
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>

#define INF 1e6

using namespace std;

int N,W;
int w,v;
int dp[1001];

int main(void){
	int tem=1;
	int vmax,wmax;
	while(true){
		vmax=0;
		memset(dp,-1,sizeof(dp));
		cin >> W >> N;
		if(!W)
			break;
		dp[0]=0;
		for(int i=0;i<N;i++){
			scanf("%d,%d",&v,&w);
			for(int j=W-w;j>=0;j--){
				if(dp[j]>=0)
					dp[j+w]=max(dp[j+w],(dp[j]+v));
			}
		}
		for(int i=0; i<=W; i++){
			if(dp[i]>vmax){
			vmax=dp[i];
			wmax=i;
			}
		}
		cout << "Case "<<tem<<':'<<endl;
		cout <<  vmax << endl << wmax <<endl;
		tem++;
	}
	return 0;
}

Measured memory_bytes: 1248
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define repp(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define repm(i,n) for(int (i)=(n);(i)>=0;(i)--)
typedef long long lint;

int main(){
  lint N,ans=0,a,b;
  cin >>N; lint M[N];lint S[N];
  rep(i,N){cin >> M[i];
  S[i]=M[i];
  }
  sort(M,M+N);
  a=M[N/2];
  b=M[N/2-1];
  if(N==2){
    cout<<a<<endl;
    cout<<b<<endl;
    return 0;
  }
  rep(i,N){
    if(S[i]<=b)cout <<a<<endl;
    else cout <<b<<endl;
  }
 }



  


Measured memory_bytes: 5248
# -*- coding: utf-8 -*-
import sys
from collections import deque
import copy

N,K=map(int, sys.stdin.readline().split())

 #階乗　前計算
mod=10**9+7
fact, inv_fact = [1], [1]
fact_tmp = 1
for i in range(1, K+1):
    fact_tmp *= i
    fact_tmp %= mod
    fact.append(fact_tmp)
    inv_fact.append(pow(fact_tmp, mod-2, mod))

def npr(n,r):
	if n < 0 or r < 0 or n < r:	return 0
	else:	return (fact[n] * inv_fact[n-r]) %mod



nl=[ [] for i in range(N+1) ]	#隣接リスト
C=[ 0 for i in range(N+1) ]	#入次数: 頂点に入ってくる辺数
 
for i in range(N-1):
	a,b=map(int, sys.stdin.readline().split())
	nl[a].append(b)
	C[a]+=1
	nl[b].append(a)
	C[b]+=1


start=1
Visit=[ None for i in range(N+1) ] 
Visit[start]=1
 
p=None		#Parent
q=deque()
q.append( (p,start) )

ans=K

while q:
	p,current=q.popleft()
	flag=0
	for to in nl[current]:
		if Visit[to] is None:
			Visit[to]=1
			q.append( (current,to) )
			flag=1
	if p is None and flag:
		ans*=npr(K-1,C[current])
	elif p is not None and flag:
		ans*=npr(K-2,C[current]-1)
	ans%=mod
		

print ans


Measured memory_bytes: 55196
k,s=input().split()
k,s=int(k),int(s)
c=0
for i in range(k+1):
    s1=s-i
    if s1<0:
        break
    for j in range(k+1):
        s2=s1-j
        if s2<0:
            break
        if 0<=s2<=k:
            c+=1

print(c)


Measured memory_bytes: 2940
import math


def vec(p1, p2):
    return (p2[0] - p1[0], p2[1] - p1[1])


def l(v):
    return math.sqrt(v[0]**2 + v[1]**2)


def check(a, b, c, x, r):
    m = 1 - x/r
    return max([a, b, c]) * m >= x*2


def main():
    x = [0] * 3
    y = [0] * 3
    P = [None] * 3
    for i in range(3):
        x, y = map(int, input().split())
        P[i] = (x, y)
    v0 = vec(P[0], P[1])
    v1 = vec(P[0], P[2])
    v2 = vec(P[1], P[2])
    a = l(v0)
    b = l(v1)
    c = l(v2)
    r = abs(v0[0] * v1[1] - v0[1] * v1[0]) / (a + b + c)
    lo = 0.0
    hi = r
    while hi - lo >= 1e-10:
        mid = (hi + lo) / 2
        if check(a, b, c, mid, r):
            lo = mid
        else:
            hi = mid
    print(lo)


if __name__ == "__main__":
    main()


Measured memory_bytes: 38256
#include <algorithm>
#include <iostream>
#include <vector>
#include <math.h>
#include <set>
#include <map>
#include <string>
#include <stack>
#include <queue>
#include <iomanip>
#include <numeric>
#include <tuple>
#include <bitset>
#include <complex>
#include <unistd.h>
#include <cassert>
#include <cctype>
#include <random>
#define _USE_MATH_DEFINES
#define _GLIBCXX_DEBUG
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> plglg;
typedef tuple<int, int, int> tiii;
typedef tuple<ll, ll, ll> tlglglg;
typedef complex<double> xy_t;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
double pi = 3.141592653589793;
ll mod = 1000000007;
int intmax = 2147483647;
int intmin = -2147483648;
ll llmax = 9223372036854775807;
ll llmin = -9223372036854775807;
int iinf = intmax / 8;
ll inf = llmax / 8;
double eps = 1e-11;

int main() {
    int N;
    cin >> N;
    int r[N];
    for (int i = 0; i < N; i++) {
        cin >> r[i];
    }
    double pos[N];
    pos[0] = r[0];
    double ans = 2 * r[0];
    for (int i = 1; i < N; i++) {
        double maxpos = r[i];
        for (int j = 0; j < i; j++) {
            double d = r[i] + r[j];
            double h = abs(r[i] - r[j]);
            double x = pos[j] + sqrt(d * d - h * h);
            if (maxpos < x) {
                maxpos = x;
            }
        }
        pos[i] = maxpos;
        if (pos[i] + r[i] > ans) {
            ans = pos[i] + r[i];
        }
    }
    cout << fixed;
    cout << setprecision(8);
    cout << ans << endl;
}



Measured memory_bytes: 3280
#include <iostream>
#include <algorithm>
#include <string>
#include <cmath>
#include <ctype.h>
#include <map>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include <cctype>
#include <queue>
#define REP(i,n) for(int i=0;i<(int)n;++i)
#define REP1(j,n) for(int j=0;j<(int)n;++j)
#define REPD(i,n) for(int i=n;i>=0;--i)
#define REPD1(j,n) for(int j=n;j=>0;--j)
#define REPS(i,n) for(int i=1;i<=(int)n;++i)
#define REPS1(j,n) for(int j=1;j<=(int)n;++j)
#define rep(i,a,n) for(int i=a;i<=(int)n;++i)
#define SZ(x) ((int)(x).size())	//size() unsigned -> int
#define DescSort(a) sort(a.begin(),a.end(),std::greater<int>())

using namespace std;
typedef long long ll;
const ll INF=1e9+7;

int main(void) {
	ll n;
	vector<ll> num(100005);
	cin >> n;
	num[0] = 1;
	for(int i=1;i<=n;++i) {
		num[i] = num[i - 1] * i % INF;
	}
	cout << num[n] << endl;
	return 0;
}

Measured memory_bytes: 1024
n,m,x=map(int,input().split())
L=[]
for i in range(n):
    A=list(map(int,input().split()))
    L.append(A)

C=10**7

for i in range(1<<n):
    c=0
    R=[0]*m
    for j in range(n):
        if i&(1<<j):
            c+=L[j][0]
            for k in range(m):
                R[k]+=L[j][k+1]
    if min(R)>=x:
        C=min(c,C)

if C==10**7:
    print(-1)
else:
    print(C)

Measured memory_bytes: 9220
#include <bits/stdc++.h>
        
using namespace std;
        
typedef long long ll;
#define mp make_pair
#define pub push_back
#define x first
#define y second
#define all(a) a.begin(), a.end()
#define y1 dsfgsdfgsdfgsdfgsdfgsdfg
#define y0 asdfasdf3rcdt234d5c23xd234dx43

struct zap{
	ll sum1, sum2, sum3, k2, k3;
	zap() {}
	zap(ll a, ll b, ll c, ll d, ll e){
		sum1 = a;
		sum2 = b;
		sum3 = c;
		k2 = d;
		k3 = e;
	}
};

int n, m;
int a[100007];
vector<zap> q[100007];
ll d1[100007];
ll d2[100007];


const bool is_testing = 0;
int main() { 
    srand('D' + 'E' + 'N' + 'I' + 'S' + 'S' + 'O' + 'N' + time(NULL));
    //mt19937 rnd(time(NULL));
    //ios_base::sync_with_stdio(0); cin.tie(0);
    if (is_testing) {
        freopen("input.txt", "r", stdin);
        //freopen("output.txt", "w", stdout);
    } else {
        //freopen("cpr.in", "r", stdin);
        //freopen("cpr.out", "w", stdout);
    }
    scanf("%d %d", &n, &m);
    for (int i = 0; i < n; i++) scanf("%d", &a[i]);
    for (int i = 0; i < n - 1; i++){
    	int c = a[i + 1] - a[i];
    	if (c < 0) c += m;
    	if (c <= 1){
    		d1[1] += c;
    	} else {
    		int r = a[i + 1];
    		int l = a[i + 1] - c + 2;

    		if (l >= 1){
    			d1[1] += c;
    			d2[l]--;
    			d2[r + 1]++;
    			d1[r + 1] += c - 1;
    		} else {
    			l += m;
    			d2[l]--;
    			d2[1]--;
    			d1[1] += c - (m - l + 1);
    			d1[r + 1] += c - 1;
    			d2[r + 1]++;
    		}
    	}

    }
    ll ans = (ll)1e18 + 7;

    ll now = 0;
    ll bal = 0;

    for (int i = 1; i <= m; i++){
    	bal += d2[i];
    	now += bal + d1[i];
    	ans = min(ans, now);
    }

    cout << ans;
}

Measured memory_bytes: 4480
#include <bits/stdc++.h>
using namespace std;
using int64 = long long;
#define int int64
#define rep(i, n) for(int i=0; i<n; i++)
#define FOR(i, a, b) for(int i=a; i<b; i++)
#define SORT(x) sort(x.begin(), x.end())
#define GSORT(x) sort(x.begin(), x.end(), greater<int>())
#define mk make_pair
#define fi first
#define se second
#define pb push_back
#define ALL(x) x.begin(), x.end()
#define V(T) vector<T>
typedef pair<int, int> P;
typedef pair<P, P> PP;
typedef vector<int> vi;
typedef vector<vi> vvi;
int max(int a, int b) {if(b>a) return b; else return a;}
int min(int a, int b) {if(b<a) return b; else return a;}


signed main() {
    int N;
    string S;
    cin >> N >> S;

    vi rsum(N+1, 0), gsum(N+1, 0), bsum(N+1, 0);
    rep(i, N) {
        rsum[i+1] = rsum[i];
        gsum[i+1] = gsum[i];
        bsum[i+1] = bsum[i];
        if(S[i]=='R') rsum[i+1]++;
        else if(S[i]=='G') gsum[i+1]++;
        else bsum[i+1]++; 
    }

    int res = 0;
    rep(i, N-2) {
        for(int j=i+1; j<N-1; j++) {
            if(S[i]==S[j]) continue;
            if(S[i]!='R' && S[j]!='R') {
                res += rsum[N] - rsum[j];
                if(j+(j-i)<N && S[j+(j-i)]=='R') res--;
            }
            if(S[i]!='G' && S[j]!='G') {
                res += gsum[N] - gsum[j];
                if(j+(j-i)<N && S[j+(j-i)]=='G') res--;
            }
            if(S[i]!='B' && S[j]!='B') {
                res += bsum[N] - bsum[j];
                if(j+(j-i)<N && S[j+(j-i)]=='B') res--;
            }
        }
    }

    cout << res << endl;

    return 0;
}

Measured memory_bytes: 3740
#include <stdio.h>
int main(){
	int N, M;
	scanf(" %d %d", &N, &M);

	int estGcd = M / N;
	int residue = M % N;

	while ((estGcd) && (residue % estGcd)) {
		estGcd--;
		residue += N;
	}
	printf("%d\n", estGcd);
	return 0;
}

Measured memory_bytes: 128
n = gets.to_i
h = gets.chomp.split(" ").map(&:to_i)
cnt = 0
n.times do |i|
  while h[i] != 0
    j = i
    while j <= n-1
      if h[j] > 0
        j += 1
      else
        break
      end
    end
    if i <= j-1
      i.upto(j-1) do |k|
        h[k] -= 1
      end
      cnt += 1
    end
  end
end
puts cnt


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

int main() {
  string s;
  cin>>s;
  int n=s.size();
  string ans="Yes";
  string t=s;
  reverse(t.begin(),t.end());
  if(s!=t) ans="No";
  string u=s.substr(0,(n-1)/2);
  string v=u;
  reverse(v.begin(),v.end());
  if(u!=v) ans="No";
  string w=s.substr((n+3)/2-1,(n-1)/2);
  string x=w;
  reverse(x.begin(),x.end());
  if(w!=x) ans="No";
  cout<<ans<<endl;
}

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

int main()
{
    int n; std::cin >> n;
    std::vector<int> v(n);
    for (int i = 0; i < n; i++)
    {
        std::cin >> v[i];
    }
    std::sort(v.begin(), v.end());
    size_t dd = n / 2;
    std::cout << (v[dd] - v[dd-1]) << std::endl;
    return 0;
}


Measured memory_bytes: 640
import java.io.IOException;
import java.io.InputStream;
import java.util.*;
import java.lang.*;


public class Main{
	static final long MOD = 1000000007;
	public static void main(String[] args) {
		FastScanner sc = new FastScanner();
		long a = sc.nextLong();
		long b = sc.nextLong();
		long c = sc.nextLong();
		if (c - a - b >= 0 && 4 * a * b < (c - a - b) * (c - a - b)) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}
}

class FastScanner {
	private final InputStream in = System.in;
	private final byte[] buffer = new byte[1024];
	private int ptr = 0;
	private int buflen = 0;
	private boolean hasNextByte() {
		if (ptr < buflen) {
			return true;
		} else {
			ptr = 0;
			try {
				buflen = in.read(buffer);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (buflen <= 0) {
				return false;
			}
		}
		return true;
	}
	private int readByte() {
		if (hasNextByte()) {
			return buffer[ptr++];
		} else {
			return -1;
		}
	}
	private static boolean isPrintableChar(int c) {
		return 33 <= c && c <= 126;
	}
	public boolean hasNext() {
		while (hasNextByte() && !isPrintableChar(buffer[ptr])) {
			ptr++;
		}
		return hasNextByte();
	}
	public String next() {
		if (!hasNext()) {
			throw new NoSuchElementException();
		}
		StringBuilder sb = new StringBuilder();
		int b = readByte();
		while (isPrintableChar(b)) {
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}
	public long nextLong() {
		if (!hasNext()) {
			throw new NoSuchElementException();
		}
		long n = 0;
		boolean minus = false;
		int b = readByte();
		if (b == '-') {
			minus = true;
			b = readByte();
		}
		if (b < '0' || '9' < b) {
			throw new NumberFormatException();
		}
		while (true) {
			if ('0' <= b && b <= '9') {
				n *= 10;
				n += b - '0';
			} else if (b == -1 || !isPrintableChar(b)) {
				return minus ? -n : n;
			} else {
				throw new NumberFormatException();
			}
			b = readByte();
		}
	}
	public int nextInt() {
		long nl = nextLong();
		if (nl < Integer.MIN_VALUE || Integer.MAX_VALUE < nl) {
			throw new NumberFormatException();
		}
		return (int) nl;
	}
	public double nextDouble() {
		return Double.parseDouble(next());
	}
}


Measured memory_bytes: 22612
#include <bits/stdc++.h>
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
using ll = long long;
using P = pair<int, int>;
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; }

string n;

int main() {
    cin >> n;
    int nlen = n.length()-1;
    if(n.at(nlen) == '3') {
        cout << "bon" << endl;
    }else if(n.at(nlen) == '0' || n.at(nlen) == '1' || n.at(nlen) == '6' || n.at(nlen) == '8') {
        cout << "pon" << endl;
    }else {
        cout << "hon" << endl;
    }
}

Measured memory_bytes: 3636
import sys

sys.setrecursionlimit(10**7)
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return map(int,sys.stdin.readline().rstrip().split())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))  #空白あり
def LI2(): return list(map(int,sys.stdin.readline().rstrip()))  #空白なし
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())  #空白あり
def LS2(): return list(sys.stdin.readline().rstrip())  #空白なし


A,B,C = MI()
print('Yes' if A < C < B or B < C < A else 'No')


Measured memory_bytes: 61988
N,K = map(int, input().split())
ary1 = sorted([int(input()) for x in range(N)])
min1 = 10**9+1
for i in range(K-1,N):
  dist1 = ary1[i]-ary1[i-K+1]
  if dist1 < min1:
    min1 = dist1
    
print(min1)

Measured memory_bytes: 8280
import sys
if sys.argv[-1] == 'ONLINE_JUDGE':
    import os, zlib, base64
    open('solve.pyx', 'wb').write(zlib.decompress(base64.b85decode("c${TYO>cuR480@qAH2g<SksD5J4|Tok8~W85Fi=^lxC{7Uq74hU0=X{&(AMTO53&2Xd%xxXSJz7>bCE!gI2XS<-(vOg8X%LXU;vhylGT3lX}ZdrAE@IQs{2RE9GR(EkmL<t_%ZNs1oq^`kGMW(1(Ga6!i>F7X}`H7r5y^)s+#F<9Kdtv{BTL6HF9?=_=i%VE`DDGzbO~GDv*+Uh77|Wh7Au1V>|0yp(l`$OpW=ry#82-wQ%&5*=L<I3nkS91mLMeyjnxoC_Mo3uVbQ@U1`8@2@<^5lK3Aat{slZ0e;f-VC71YKCFZGT@9(su?&&4({63n|X#@)0TYNZqu@}piynS!l;c`8{%8;w6tA`FP1qj<+5Xskk~=E1`badh}FFHdOq<Z@*POwP?JBF$%S|<lLNOc5Aw%s(BC5>_v-Un{8mi7T;8d_YO*KO;Xw>(82E=B9iEFXbHIzhll}vB`qr2")))
    os.system('cythonize -i -3 -b solve.pyx')
import solve

Measured memory_bytes: 9888
a=int(input())
b=[list(map(int,input().split())) for i in range(a)]
c=[[0,0,0]for i in range(a)]
c[0]=b[0]
for i in range(1,a):
  c[i][0]=max(c[i-1][1],c[i-1][2])+b[i][0]
  c[i][1]=max(c[i-1][0],c[i-1][2])+b[i][1]
  c[i][2]=max(c[i-1][1],c[i-1][0])+b[i][2]
  
print(max(c[-1]))

Measured memory_bytes: 47384
use proconio::{input,fastout};

const A: u8 = 'a' as u8;

#[fastout]
fn main() {
  input!{mut n: usize};
  let mut name: Vec<u8> = Vec::new();
  while n != 0 {
    n -= 1;
    name.push((n % 26) as u8);
    n /= 26;
  }
  println!("{}",
    name
    .into_iter()
    .rev()
    .map(|c| (A + c) as char)
    .collect::<String>()
  );
}

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

int main(){
  int m,n,l;
  cin >> m >> n >> l;

  long long a[100][100] = {0};
  long long b[100][100] = {0};
  long long c[100][100] = {0};
 
  rep(i,m){
    rep(j,n){
      cin >> a[i][j];
    }
  }

  rep(i,n){
    rep(j,l){
      cin >> b[i][j];
    }
  }

  rep(i,m){
    rep(j,l){
      rep(k,n){
        c[i][j] += a[i][k] * b[k][j];
      }
    }
  }

  rep(i,m){
    rep(j,l){
       if(j != l-1)cout << c[i][j] << " ";
       else cout << c[i][j];
    }
    cout << endl;
  }


    
}


Measured memory_bytes: 3352
#include <iostream>
#include <cstdio>
#include <vector>

using namespace std;

typedef long long ll;

typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<ll> vll;

typedef vector<vb> vmb;
typedef vector<vll> vmll;

const int INF = 1e9;

int tdkp01(vmll &dp, vmb &save, vi &wei, vi &val, int n, int i, int j)
{
    if (j <= 0)
        return 0;

    if (i == n)
        return INF;

    if (save[i][j])
        return dp[i][j];

    save[i][j] = true;
    return dp[i][j] = min(tdkp01(dp, save, wei, val, n, i + 1, j),
                          tdkp01(dp, save, wei, val, n, i + 1, j - val[i]) + wei[i]);
}

int kp01(vmll &dp, vmb &save, vi &wei, vi &val, int n, int k, int vsum)
{
    vsum++;
    while (vsum--)
        if (tdkp01(dp, save, wei, val, n, 0, vsum) <= k)
            return vsum;

    return 0;
}

int main()
{
    if (fopen("Test.INP", "r"))
        freopen("Test.INP", "r", stdin);

    int n, k;
    cin >> n >> k;

    vi wei(n), val(n);
    int vsum = 0;
    for (int i = 0; i < n; ++i)
    {
        cin >> wei[i] >> val[i];
        vsum += val[i];
    }

    vmll dp(n + 1);
    vmb save(n + 1);
    for (int i = 0; i <= n; ++i)
    {
        dp[i].assign(vsum, 0);
        save[i].assign(vsum, 0);
    }

    cout << kp01(dp, save, wei, val, n, k, vsum);
    return 0;
}


Measured memory_bytes: 80640
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();
		if((a < b) && (b < c)) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}
}

Measured memory_bytes: 26216
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <cstring>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <bitset>
#include <stack>
#include <cmath>
#define ll long long
#define LINF 0x3f3f3f3f3f3f3f3f
#define INF 0x3f3f3f3f
#define PI 3.14159265
using namespace std;
const int MAX = 1e5 + 10;
const ll MOD = 1e9 + 7;
int N, M, K, Q;
int A[MAX];
int idx[MAX];

ll fexp(ll b, ll e) {
	if (e == 0) return 1;
	if (e == 1) return b;
	ll tmp = fexp(b, e / 2);
	return tmp * tmp % MOD * fexp(b, e % 2) % MOD;
}

vector<ll> cal_comb(ll n, ll k) {
	vector<ll> ret;
	ret.push_back(1);
	ll init = 1;
	ll deno = 1;
	for (ll i = 1; i <= k; ++i) {
		init = init * (n - i + 1) % MOD;
		deno = deno * i % MOD;
		ret.push_back(init*fexp(deno, MOD - 2) % MOD);
	}
	return ret;
}


int main()
{
	int i, j, k;
	scanf("%d", &N);
	int fr, ba;
	for (i = 1; i <= N + 1; ++i) {
		scanf("%d", &A[i]);
		if (idx[A[i]]) {
			fr = idx[A[i]] - 1;
			ba = N + 1 - i;
		}
		else idx[A[i]] = i;
	}

	auto vt = cal_comb(N + 1, N + 1);
	auto vt2 = cal_comb(fr + ba, fr + ba);

	for (i = 1; i <= N + 1; ++i) {
		ll fix = 0;
		if (fr + ba >= i - 1) fix = vt2[i - 1];
		printf("%lld\n", ((vt[i] - fix) + MOD) % MOD);
	}
}


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

#define REP(i,m,n) for(int i=(m); i<(int)(n); i++)
#define RREP(i,m,n) for(int i=(int)(n-1); i>=m; i--)
#define rep(i,n) REP(i,0,n)
#define rrep(i,n) RREP(i,0,n)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define aut(r,v) __typeof(v) r = (v)
#define each(it,o) for(aut(it,(o).begin()); it!=(o).end(); ++it)
#define reach(it,o) for(aut(it,(o).rbegin()); it!=(o).rend(); ++it)
#define fi first
#define se second
#define debug(...) {cerr<<"[L"<<__LINE__<<"] "; _debug(__VA_ARGS__);}

template<typename T1, typename T2> ostream& operator<<(ostream& o, const pair<T1, T2>& p)
{return o<<"("<<p.first<<", "<<p.second<<")";}
template<typename T>string join(const vector<T>&v, string del=", ")
{stringstream s;rep(i,v.size())s<<del<<v[i];return s.str().substr(del.size());}
template<typename T>ostream& operator<<(ostream& o, const vector<T>&v)
{if(v.size())o<<"["<<join(v)<<"]";return o;}
template<typename T>ostream& operator<<(ostream& o, const vector<vector<T> >&vv)
{int l=vv.size();if(l){o<<endl;rep(i,l){o<<(i==0?"[ ":",\n  ")<<vv[i]<<(i==l-1?" ]":"");}}return o;}
template<typename T>ostream& operator<<(ostream& o, const set<T>& st)
{vector<T> v(st.begin(),st.end());o<<"{ "<<join(v)<<" }";return o;}
template<typename T1, typename T2>ostream& operator<<(ostream& o, const map<T1, T2>& m)
{each(p,m){o<<(p==m.begin()?"{ ":",\n  ")<<*p<<(p==--m.end()?" }":"");}return o;}
inline void _debug(){cerr<<endl;}
template<class First, class... Rest>
void _debug(const First& first, const Rest&... rest){cerr<<first<<" ";_debug(rest...);}

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

const double PI = (1*acos(0.0));
const double EPS = 1e-9;
const ll INF = 0x3f3f3f3f;
const ll INFL = 0x3f3f3f3f3f3f3f3fLL;
const ll mod = 1e9 + 7;

inline void finput(string filename) {
    freopen(filename.c_str(), "r", stdin);
}

ll n, k;
vvl prodMM(vvl m1, vvl m2){
    vvl ret(n, vl(n,0));
    rep(i,n) rep(j,n) rep(k,n){
        ret[i][j] += m1[i][k] * m2[k][j];
        ret[i][j] %= mod;
    }
    return ret;
}

int main(){
    ios_base::sync_with_stdio(0);
    // finput("./input");

    cin >> n >> k;
    vvi A(n, vi(n));
    rep(i,n) rep(j,n) cin >> A[i][j];

    vvl M(n, vl(n, 0)); // 係数行列
    rep(i,n) rep(j,n) if(A[i][j]) M[j][i] = 1;
    vvl U(n, vl(n, 0)); // kth power
    rep(i,n) U[i][i] = 1;
    while(k>0){
        if(k&1) U = prodMM(U,M);
        M = prodMM(M,M);
        k >>= 1;
    }

    ll ans = 0;
    rep(i,n) rep(j,n) ans += U[i][j];
    ans %= mod;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 384
#include<iostream>
using namespace std;
int main() {
	int a, b, c, okiba;
	cin >> a >> b >> c;
	if (a > b ) {
		okiba = a;
		a = b;
		b = okiba;
	}
	if (b > c) {
		okiba = b;
		b = c;
		c = okiba;
	}
	if (a > b) {
		okiba = a;
		a = b;
		b = okiba;
	}
	cout << a << " " << b << " " << c << endl;
}


Measured memory_bytes: 3084
#include <bits/stdc++.h>
#define pb          emplace_back
#define ll          long long
#define fi          first
#define se          second
#define mp          make_pair

using namespace std;

typedef pair<int, int> pii;
const int N = int(2e5) + 7;
const int inf = int(1e9) + 7;

pii operator + (const pii& x, const pii& y) {
    if(x.fi < y.fi) return x;
    if(x.fi == y.fi && x.se > y.se) return x;
    return y;
}

struct TSegment {
    vector<int> l, h;
    vector<pii> st;
    int n;
    TSegment() {}
    void Init(int _n) {
        n = _n;
        l.resize(n << 2 | 1), h.resize(n << 2 | 1), st.resize(n << 2 | 1, mp(inf, inf));
        Build(1, 1, n);
    }
    void Build(int x, int low, int high) {
        l[x] = low, h[x] = high;
        if(l[x] == h[x]) return;
        int mid = (low + high) >> 1;
        Build(x << 1, low, mid);
        Build(x << 1 | 1, mid + 1, high);
    }
    void Update(int x, int pos, int val) {
        if(l[x] > pos || h[x] < pos) return;
        if(l[x] == h[x] && l[x] == pos) {
            st[x] = mp(val, pos); return;
        }
        Update(x << 1, pos, val);
        Update(x << 1 | 1, pos, val);
        st[x] = st[x << 1] + st[x << 1 | 1];
    }
    pii Find(int x, int low, int high) {
        if(l[x] > high || h[x] < low) return mp(inf, inf);
        if(l[x] >= low && h[x] <= high) return st[x];
        return Find(x << 1, low, high) + Find(x << 1 | 1, low, high);
    }
} it[2];

int n, cnt, p[N];
struct TNode {
    int x, y, px, py, l, r;
    TNode() {}
    TNode(int x, int y, int px, int py, int l, int r): x(x), y(y), px(px), py(py), l(l), r(r) {}
    bool operator<(const TNode& o)const& {return x > o.x;}
};
priority_queue<TNode> pq;
typedef pair<pii, pii> ii;

ii Get(int l, int r) {
    pii x = it[l & 1].Find(1, l, (r & 1) == (l & 1)? r - 2: r - 1);
    pii y = it[!(l & 1)].Find(1, x.se, r);
    return mp(x, y);
}

int32_t main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0), cout.tie(0);
    #define Task        "test"
    if(fopen(Task".inp", "r")) {
        freopen(Task".inp", "r", stdin);
        freopen(Task".out", "w", stdout);
    }
    cin >> n; it[0].Init(n), it[1].Init(n);
    for(int i = 1; i <= n; ++i) {
        cin >> p[i];
        it[i & 1].Update(1, i, p[i]);
    }
    ii top = Get(1, n);
    pq.push(TNode(top.fi.fi, top.se.fi, top.fi.se, top.se.se, 1, n));
    while(pq.size()) {
        TNode cur = pq.top(); pq.pop();
        cout << cur.x << ' ' << cur.y << ' ';
        ///chia day (l, px - 1) (px + 1, py - 1) (py + 1, r)
        if(cur.px - 1 > cur.l) {
            top = Get(cur.l, cur.px - 1);
            pq.push(TNode(top.fi.fi, top.se.fi, top.fi.se, top.se.se, cur.l, cur.px - 1));
        }
        if(cur.px + 1 < cur.py - 1) {
            top = Get(cur.px + 1, cur.py - 1);
            pq.push(TNode(top.fi.fi, top.se.fi, top.fi.se, top.se.se, cur.px + 1, cur.py - 1));
        }
        if(cur.py + 1 < cur.r) {
            top = Get(cur.py + 1, cur.r);
            pq.push(TNode(top.fi.fi, top.se.fi, top.fi.se, top.se.se, cur.py + 1, cur.r));
        }
    }
}


Measured memory_bytes: 28404
#include<bits/stdc++.h>
using namespace std;
int main(){
    char str[101],answer[101];
    gets(str);
    int lens=strlen(str),i,lena=0;
    for(i=0;i<lens;i++){
        switch(str[i]){
            case '0':answer[lena]='0';lena++;break;
            case '1':answer[lena]='1';lena++;break;
            case 'B':if(lena!=0) lena--;break;
        }
    }
    for(i=0;i<lena;i++)printf("%c",answer[i]);
    printf("\n");
    return 0;
}

Measured memory_bytes: 256