akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<string>
#include<cstdio>
#include<cstring>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<deque>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
using namespace std;

typedef long long ll;
typedef unsigned long long ul;
typedef unsigned int ui;
typedef long double ld;
const int inf=1e9+7;
const ll INF=1LL<<60 ;
const ll mod=1e9+7 ;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<int, int> P;
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
#define fr first
#define sc second
#define all(c) c.begin(),c.end()
#define pb push_back
#define debug(x)  cout << #x << " = " << (x) << endl;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
//#define int long long

void solve() {
	string s; cin >> s;
    int n = (int)s.size();
    int ans = 0;
    int m = 0;
    if(n & 1) {
        if(n == 1) m = 0;
        else m = (n - 2) / 2;
    } else {
        m = (n - 1) / 2;
    }
    for(int i = 0; i <= m; ++i) {
        if(s[i] != s[n - 1 - i]) {
            ++ans;
        }
    }
    cout << ans << endl;
}

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	//cout << fixed << setprecision(10);
	//init();
	solve();
	//cout << "finish" << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main
{
	public static void main(String[] args)
	{
		Scanner s=new Scanner(System.in);
		
		int a=s.nextInt();
		int b=s.nextInt();
		
		int c=6-(a+b);
		
		System.out.println(c);
		
		s.close();
	}
}


Measured memory_bytes: 21844
#include <iostream>
#include <stdio.h>
#include <string.h>

using namespace std;

int main(){
    string a,c;
    string temp;
    string temp2;
    string temp3;
    string temp4;
    int len_a;
    int len_c;
    int i,j;
    int k =0;
    
    cin >> a;
    len_a = a.length();
    
    for ( i=0 ; i < len_a; i++){
        if (0x41 <= a[i] && a[i] <= 0x5a){
            a[i] = a[i] + 0x20;
        }
    }
    
    temp2 = " ";
    
    for (;;){
        getline(cin, temp);
        if (temp == "END_OF_TEXT"){
            c = c + temp2;
            break;
        }
        c = c + temp2 + temp;
    }
    
    len_c = c.length();
    
    for ( i=0 ; i < len_c; i++){
        if (0x41 <= c[i] && c[i] <= 0x5a){
            c[i] = c[i] + 0x20;
        }
    }
    
    for (j = 0; j < len_c ; j++){ 
        if (a[0] == c[j]){
            temp3 = c[j-1];
            temp4 = c[j+len_a];
            if (temp3==" " && temp4 ==" "){
                if (a == c.substr(j,len_a)){
                    k=k+1;
                }
            }
        }
    }
    
    cout << k << endl;
    
    return 0;
}

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

// ----------- define --------------
#define int long long
#define vi vector<int>
#define vc vector<char>
#define ii pair<int,int>
#define fi first
#define sc second
#define stoi stoll
#define all(x) (x).begin(),(x).end()
#define get_bit(x, k) ((x >> k) & 1)
// ---------------------------------

struct edge {
  int u, v, w;
  edge() {}
  edge(int u, int v, int w):
    u(u), v(v), w(w) {}
};

bool chmax(int &a, int b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}

void MAIN() {
  int n, m;
  cin >> n >> m;
  vector<edge> edges(m);
  for (auto &i : edges) {
    cin >> i.u >> i.v >> i.w;
  }
  vector<int> dis(n + 1, -1e15);
  dis[1] = 0;
  for (int i = 1; i < n; i++)
  for (auto &j : edges) {
    if (dis[j.u] != -1e15) {
      chmax(dis[j.v], dis[j.u] + j.w);
    }
  }
  vector<int> tmp(all(dis));
  for (int i = 1; i < n; i++)
  for (auto &j : edges) {
    if (tmp[j.u] != -1e15) {
      chmax(tmp[j.v], tmp[j.u] + j.w);
    }
  }
  if (dis[n] == tmp[n]) cout << dis[n] << '\n';
  else cout << "inf" << '\n';
}

signed main() {
  ios::sync_with_stdio(0); cin.tie(0);
  int T = 1;
  // cin >> T;
  while (T--) MAIN();
}


Measured memory_bytes: 3696
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0, i##_len = (n); i < i##_len; ++i)
#define rep2(i, x, n) for(int i = x, i##_len = (n); i < i##_len; ++i)
#define all(n) begin(n), end(n)
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vl = vector<ll>;
using vs = vector<string>;
using vc = vector<char>;
using vb = vector<bool>;
using vd = vector<double>;
vi dir = {-1, 0, 1, 0, -1, -1, 1, 1, -1};

int main() {
  int n;
  cin >> n;
  vi x(n), y(n);
  rep(i, n) cin >> x[i] >> y[i];
  double ans = 0;
  rep(i, n - 1) rep2(j, i + 1, n) ans +=
      sqrt(pow(x[i] - x[j], 2) + pow(y[i] - y[j], 2));
  ans /= n;
  ans *= 2;
  printf("%.10f\n", ans);
}

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

using namespace std;

int main(){
    int K;
    cin >> K;
    if(K==0){
        cout << -1 << endl;
        return 0;
    }
    int a[K];
    a[0] = 7%K;
    if(a[0] % K == 0){
        cout << 1 << endl;
        return 0;
    }
    for(int i=1;i<K;i++){
        a[i] = (10*a[i-1] + 7)%K;
        if(a[i]==0){
            cout << i+1 << endl;
            return 0;
        }
    }


    cout << -1 << endl;
    return 0;

}

Measured memory_bytes: 7508
#include <stdio.h>
#include <math.h>
#include <vector>
#include <algorithm>

using namespace std;

bool LF_PRIME_SEQUENCE(const int &n, vector<int> &vPrime){
    if(n < 2){
        return false;
    }
    vPrime.clear();
    vPrime.push_back(2);
    for (int i = 2; i * i <= n; i++){
        int iPrimeType = 1;
        for(int j = 0; j < vPrime.size(); j++){
            if(i % vPrime[j] == 0){
                iPrimeType = 0;
                break;
            }
            if(i < vPrime[j] * vPrime[j]){
                break;
            }
        }

        if(iPrimeType == 1){
            vPrime.push_back(i);
        }
    }
    return true;
}

int main(){
    int n;
    scanf("%d", &n);
    vector<int> vPrime;
    if(!LF_PRIME_SEQUENCE(n, vPrime)){
        return 1;
    }
    printf("%d:", n);
    for(int i = 0; i < vPrime.size() && n != 1; i++){
        while (n % vPrime[i] == 0){
            printf(" %d", vPrime[i]);
            n /= vPrime[i];
        }
    }
    if (n != 1){
        printf(" %d\n", n);        
    } else {
        printf("\n");
    }
    return 0;
}


Measured memory_bytes: 2784
#include <iostream>
#include <stdio.h>
#include <string.h>
#include <vector>
#include <algorithm>
#include <sstream>
#include <cstdlib>
#include <map>

using namespace std;

int main()
{
  int x, y, z;
  cin>>x>>y>>z;
  cout<<z<<" "<<x<<" "<<y<<endl;
}


Measured memory_bytes: 256
/*
* Note: This template uses some c++11 functions , so you have to compile it with c++11 flag.
*       Example:-   $ g++ -std=c++11 c++Template.cpp
*
* Author : Akshay Pratap Singh
* Handle: code_crack_01
*
*/
 
/********   All Required Header Files ********/
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <queue>
#include <deque>
#include <bitset>
#include <iterator>
#include <list>
#include <stack>
#include <map>
#include <set>
#include <functional>
#include <numeric>
#include <utility>
#include <limits>
#include <time.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>

using namespace std;

/*******  All Required define Pre-Processors and typedef Constants *******/
#define SCD(t) scanf("%d",&t)
#define SCLD(t) scanf("%ld",&t)
#define SCLLD(t) scanf("%lld",&t)
#define SCC(t) scanf("%c",&t)
#define SCS(t) scanf("%s",t)
#define SCF(t) scanf("%f",&t)
#define SCLF(t) scanf("%lf",&t)
#define MEM(a, b) memset(a, (b), sizeof(a))
#define FOR(i, j, k, in) for(int i=j ; i<k ; i+=in)
#define RFOR(i, j, k, in) for(int i=j ; i>=k ; i-=in)
#define REP(i, j) FOR(i, 0, j, 1)
#define RREP(i, j) RFOR(i, j, 0, 1)
#define all(cont) cont.begin(), cont.end()
#define rall(cont) cont.end(), cont.begin()
#define FOREACH(it, l) for (auto it = l.begin(); it != l.end(); it++)
#define IN(A, B, C) assert( B <= A && A <= C)
#define MP make_pair
#define PB push_back
#define INF (int)1e9
#define EPS 1e-9
#define PI 3.1415926535897932384626433832795
#define MOD 1000000007
#define read(type) readInt<type>()
typedef long long int ll;
typedef unsigned long long int  ull;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<pii> vii;
typedef vector<ll> vll;
typedef vector<vi> vvi;

bool isPrime(int p, vi &primes){

  int m = (int)sqrt(p) + 1;

  for(auto i : primes){
   if( i > m ) return true; 
   if( p%i == 0 ) return false;
  }

  return true;
}

int main(){

  int Q; cin >> Q;

  vi primes;
  vi data(100001, 0);
  primes.push_back(2);

  for(int i=3; i<data.size(); i+=2){
    if( isPrime(i, primes) ) primes.push_back(i);
  }

  vi prime_sum(100001, 0);
  for( auto p : primes ) {
    prime_sum[p] = 1;
  }

  for(int i=3; i<100001; i+=2){

    if( prime_sum[i]>0 and prime_sum[(i+1)/2]>0 ){
      data[i] = data[i-2]+1;
    } else {
      data[i] = data[i-2];
    }

    // cout << i << " " << data[i] << endl;

  }

  while(Q--){

    int l, r;
    cin >> l >> r;
    cout << data[r] - data[l-2] << endl;

  }

  return 0;
}


Measured memory_bytes: 1536
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <string.h>
#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define MAX(a, b) ((a) > (b) ? (a) : (b))

int main() {
	char moji[101][120];
	int N;
	scanf("%d", &N);
	for (int i = 0; i < N; i++) {
		scanf("%s", moji[i]);
	}
	for (int i = 0; i < N; i++) {
		
		if(i<N-1){
			int len = strlen(moji[i]);
			if (moji[i][len - 1] != moji[i + 1][0])
			{
				printf("No");
				return 0;
			}
		}
		
		for (int j = i + 1; j < N; j++) {
			if ( !strcmp(moji[i], moji[j])) {
				printf("No");
				return 0;
			}

		}
	}


	printf("Yes");
	return 0;
}


Measured memory_bytes: 128
n,m,k=map(int,input().split())
A=list(map(int,input().split()))
B=list(map(int,input().split()))

a=[0]
b=[0]

for i in range(n):
    a.append(a[i]+A[i])
for i in range(m):
    b.append(b[i]+B[i])
    
c=0
idx=m

for i in range(n+1):
    while 1:
        if idx<0:
            break
        if a[i]+b[idx]>k:
            idx-=1
            continue
        else:
            c=max(i+idx,c)
            break
else:
    print(c)

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

#define rep(i,n) for(long long int (i)=0;(i)<(int)(n);(i)++)
#define rrep(i,a,b) for(long long int i=(a);i<(b);i++)
#define rrrep(i,a,b) for(long long int i=(a);i>(b);i--)
#define all(v) (v).begin(), (v).end()
#define pb(q) push_back(q)
#define P pair<int,int>
#define Abs(a,b) max(a,b)-min(a,b)
#define YES(condition) if(condition){cout << "YES" << endl;}else{cout << "NO" << endl;}
#define Yes(condition) if(condition){cout << "Yes" << endl;}else{cout << "No" << endl;}
#define Cout(x) cout<<(x)<<endl

typedef long long ll;

using namespace std;

const int INF = 1e9,MOD = 1e9 + 7;
const ll LINF = 1e18;

//while(x!=0){
            //sum+=x%10;
           // x/=10;
        //}
        //各桁の和

//pair<int,int> p[100000];
//P r[100000];
//cin >> tmp;
//p[i]=make_pair(tmp,i);
//cout << p[i].second+1 << endl;//ペアの右側つまりiを出力

//s.find(w[i])==string::npos
//findの使い方

//for(int i=0;i<n;i++){
   // b[i]=x%2;
    //x/=2;
  //}二進数

long long int n=1,cnt=0,ans=0,a,b,c,cmp,data,m,h,x,y,xcmp=0,ycmp=0,sum=0;

string s,w;

vector<int> z;

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

       cin >> a >> b;
      //Cout(a);
       //Cout(b);
       int flo[50][50];
       rep(i,10){
           rep(j,10){
               if(i==j){
                   flo[i][j]=0;
               }
               else{
                   flo[i][j]=INF;
               }
           }
       }
       rep(i,10){
           rep(j,10){
               cin >> c;
              //cout << b << " ";
               flo[i][j]=c;
           }
       }
       
       rep(i,10){
           rep(j,10){
               rep(k,10){
                   flo[j][k]=min(flo[j][k],flo[j][i]+flo[i][k]);
               }
           }
       }
       rep(i,a){
           
       }
       rep(i,a){
           rep(j,b){
             cin >> x;
              // Cout(x);
              
              if(x!=-1 && x!=1){
                  ans+=flo[x][1];
              }
           }
       }
        //Cout(x);
       Cout(ans);
     // Cout(flo[8][1]);
return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
int min(int a,int b){return a<b?a:b;}
int main(void){
    long long k,max=2,min=2,x,y;
    scanf("%lld",&k);
    long long a[k];
    for (int i=0; i<k; i++){
        scanf("%lld",&a[i]);
    }
    for (int i=k-1; i>=0; i--){
        x=((min+a[i]-1)/a[i])*a[i];
        y=(max/a[i])*a[i];
        if (x>y){
            printf("-1\n");
            return 0;
        }
        
        
        
        min=x;
        max=y+a[i]-1;
        
    }
    printf("%lld %lld\n",min,max);
    return 0;
}

Measured memory_bytes: 896
#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")

#include "bits/stdc++.h"

using namespace std;

#define pb push_back
#define F first
#define S second
#define f(i,a,b)  for(int i = a; i < b; i++)
#define endl '\n'
using ll = long long;
#define int ll
using db = long double;
using ii = pair<int, int>;

const int N = 1e5 + 5, LG = 19, MOD = 1e9+7;
const int SQ =320;
const long double EPS = 1e-7;
int n;
ll a[N], A, B;
int prv[2][N];
int dp1[N], dp2[N];
int sum1[N], sum2[N];
int32_t main(){
#ifdef ONLINE_JUDGE
    ios_base::sync_with_stdio(0);
    cin.tie(0);
#endif

  cin >> n >> A >> B;

  f(i,1,n+1){
    cin >> a[i];
  }
  prv[0][1] = prv[1][1] = 1;
  f(i,2,n+1){
    if(a[i]-a[i-1]>=A)prv[0][i] = prv[0][i-1];
    else prv[0][i] = i;
    if(a[i]-a[i-1]>=B)prv[1][i] = prv[1][i-1];
    else prv[1][i] = i;
  }

  dp1[1] = dp2[1] = sum1[1] = sum2[1] = 1;
  int ans = 0;
  if(prv[0][n]==1)ans++;
  if(prv[1][n]==1)ans++;
  f(i,2,n+1){
    int r1 = (upper_bound(a+1,a+i-1,a[i]-A)-a);
    int r2 = (upper_bound(a+1,a+i-1,a[i]-B)-a);
    int l1 = prv[1][i-1], l2 = prv[0][i-1];
    ///the tail has to be more than <= r and >= l
    if(l1<=r1){
      dp1[i] = sum2[r1] - sum2[l1-1];
      if(dp1[i]<0)dp1[i]+=MOD;
    }
    if(l2<=r2){
      dp2[i] = sum1[r2] - sum1[l2-1];
      if(dp2[i]<0)dp2[i]+=MOD;
    }
    sum1[i] = sum1[i-1] + dp1[i]; if(sum1[i]>=MOD)sum1[i]-=MOD;
    sum2[i] = sum2[i-1] + dp2[i]; if(sum2[i]>=MOD)sum2[i]-=MOD;

    if(prv[0][n] <= i){
      ans+=dp1[i];  if(ans>=MOD)ans-=MOD;
    }
    if(prv[1][n] <= i){
      ans+=dp2[i];  if(ans>=MOD)ans-=MOD;
    }
  }

  cout<<ans<<'\n';

  return 0;
}


Measured memory_bytes: 5760
#include <algorithm>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <memory>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <assert.h>

using namespace std;

typedef long long ll;

#define sz size()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(c) (c).begin(), (c).end()
#define rep(i,a,b) for(ll i=(a);i<(b);++i)
#define per(i,a,b) for(ll i=b-1LL;i>=(a);--i)
#define clr(a, b) memset((a), (b) ,sizeof(a))
#define ctos(c) string(1,c)
#define print(x) cout<<#x<<" = "<<x<<endl;

#define MOD 1000000007

int main(){
  string s1;
  string s2;
  cin>>s1;
  cin>>s2;
  ll flag = 1;
  rep(i,0,s1.sz){
    if(s1[i]!=s2[i])flag = 0;
  }
  if(flag==1){
      cout << "Yes" << endl;
  }
  else{
      cout << "No" << endl;
  }
  return 0;
}

Measured memory_bytes: 3624
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using vl = vector<ll>;
using Map = map<ll,ll>;
using T = tuple<ll,ll,ll>;
using vvl = vector<vector<ll>>;
#define all(v) v.begin(), v.end()
#define prt(v) cout<<v<<"\n";
#define fi(v) get<0>(v)
#define se(v) get<1>(v)
#define th(v) get<2>(v)
#define endl "\n"
template <typename T> bool chmax(T &a, const T &b){if (a<b){a=b;return 1;}return 0;}
template <typename T> bool chmin(T &a, const T &b){if (a>b){a=b;return 1;}return 0;}
const ll INF=1LL<<60;
const ll MOD=1000000007;


signed main(void){
    cin.tie(0);cout.tie(0);ios::sync_with_stdio(false);
    ll N;
    cin >> N;
    ll M;
    cin >> M;
    vector<ll> A(M,0);
    vector<ll> B(M,0);
    for(ll i=0;i<M;++i){
        cin>>A[i]>>B[i];
    }
    vector<vector<ll>> G(N+1, vector<ll>(0));
    for(ll i=0;i<M;++i){
        G[A[i]].emplace_back(B[i]);
        G[B[i]].emplace_back(A[i]);
    }
    ll now=1;
    vector<bool> check(N+1,0);check[1]=1;
    deque<ll> ans;ans.emplace_back(1);
    while(1){
        bool k=0;
        for(auto p: G[now]){
            if(!check[p]){
                ans.emplace_back(p);
                now=p;check[p]=1;
                k=1;break;
            }
        }
        if(!k)break;
    }
    now=1;
    while(1){
        bool k=0;
        for(auto p: G[now]){
            if(!check[p]){
                ans.emplace_front(p);
                now=p;check[p]=1;
                k=1;break;
            }
        }
        if(!k)break;
    }

    prt(ans.size())
    for(auto p: ans){
        cout<<p<<" ";
    }cout<<endl;
    return 0;
}


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

using namespace std;
using ll = long long;


int main() {
	int N;
	cin >> N;
	vector<int> B(N-1, 0);

	for (int i = 0; i < N-1; ++i) {
		cin >> B[i];
	}

	int ans = B[N - 1 - 1] + B[0];
	for (int i = N-1-1; i != 0; --i) {
		ans += min(B[i], B[i-1]);
	}
	cout << ans << endl;
	return 0;
}

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

int main() {
  int x1, x2, x3, x4, x5;
  cin >> x1 >> x2 >> x3 >> x4 >> x5;

  if (x1 == 0)
    cout << 1 << endl;
  else if (x2 == 0)
    cout << 2 << endl;
  else if (x3 == 0)
    cout << 3 << endl;
  else if (x4 == 0)
    cout << 4 << endl;
  else if (x5 == 0)
    cout << 5 << endl;

  return 0;
}

Measured memory_bytes: 3584
#include<cstdio>
#include<iostream>
#include<fstream>
#include<cmath>
#include<cstring>
#include<algorithm>
using namespace std;
#define Set(a) memset(a,0,sizeof(a))
#define F(i,a,b) for(register int i=a,i##end=b;i<=i##end;++i)
#define UF(i,a,b) for(register int i=a,i##end=b;i>=i##end;--i)
#define openf(a) freopen(#a".in","r",stdin);freopen(#a".out","w",stdout)
#define re register
#define ri re int
#define il inline
typedef long long ll;
typedef unsigned long long ull;
template<typename T> inline T rd(T& x)
{
	T f=1;x=0;char c=getchar();
	for(;!isdigit(c);c=getchar()) if(c=='-') f=-1;
	for(; isdigit(c);c=getchar()) x=(x<<3)+(x<<1)+(T)(c-'0');
	x*=f;
	return x;
}
ll rd(){ll x;rd(x);return x;}
inline int max(int a,int b){return a>b?a:b;}
inline int min(int a,int b){return a<b?a:b;}
const int inf=1<<30;

ll n;
int main()
{
	cin>>n;
	ll ans=1;
	for(re ll i=2;i*i<n;++i) if((n-1)%i==0) {ans+=2;if(n==i*i+1) --ans;}
	for(re ll i=2;i*i<=n;++i) if(n%i==0)
	{
		ll n0=n;
		while(n0%i==0) n0/=i;
		if(n0%i==1) ++ans;
		if(i*i==n) continue;
		n0=n;ll i0=n/i;
		while(n0%i0==0) n0/=i0;
		if(n0%i0==1) ++ans;
	}
	if(n!=2) ++ans;
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
n,m,l=map(int, input().split(" "))

A = [list(map(int, input().split(" ")))for i in range(n)]
B = [list(map(int, input().split(" ")))for i in range(m)]

ans=[[0 for i in range(l)] for j in range(n)]

for i in range(n):
    for j in range(l):
        tmp=0
        for k in range(m):
            tmp+=A[i][k]*B[k][j]
        ans[i][j]=tmp

#print(ans)

for row in ans:
    for i,num in enumerate(row):
        if(i):
            print("",end=" ")
        print(num,end="")
    print()


Measured memory_bytes: 7148
#pragma comment(linker, "/stack:20000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx")

#include <stdio.h>
#include <bits/stdc++.h>

using namespace std;

#include <x86intrin.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
template <typename T> using ordered_set = tree<T, null_type, std::less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define all(x) x.begin(), x.end()

#define mp make_pair
#define in insert
#define er erase
#define con continue
#define pb push_back
#define sc scanf
#define pr printf
#define ub upper_bound
#define lb lower_bound
#define s second
#define f first
#define int long long

const long long infl = 1e18; 
const int N = 3e5 + 300, N2 = 2e3, inf = 1e9 + 200;

vector <int> g;
int n, m, k;
int a[N];
string ss;

main (){
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	cin >> n >> k;
	set <int> S;
	for (int i = 0; i < n; i++){
		cin >> a[i];
	}
	for (int i = 0; i < k; i++){
		S.in(a[i]);
	}
	int res = 0;
	for (int r = k, l = 0; r < n; r++, l++){
		int ok1 = 0, ok2 = 0;
		if (*S.begin() == a[l]) ok1 = 1;
		S.er(a[l]);
		S.in(a[r]);
		if (*S.rbegin() == a[r]) ok2 = 1;
		if (!(ok1 && ok2)){
			res++;
		}
	}
 	int ok = 0;
	int pre = -1;
	int cnt = 0;
	for(int i = 0; i < n; ++i) {
		if(pre < a[i]) {
			++cnt;
		} else {
			cnt = 1;
		}
		pre = a[i];
		if(cnt == k) {
			--res;
			ok = 1;
		}
	}
	cout << res + ok + 1;
	return 0;
}











Measured memory_bytes: 11264
#include <iostream>
#include <string>
#include <cmath>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<iomanip>
#define _USE_MATH_DEFINES
#include <math.h>
#include <functional>
using namespace std;

#define rep(i,x) for(ll i=0;i<x;i++)
#define repn(i,x) for(ll i=1;i<=x;i++)

typedef long long ll;
const ll INF = 1e17;
const ll MOD = 1000000007;
const ll MAX = 1000001;

ll max(ll a, ll b) {
	if (a > b) { return a; }
	return b;
}

ll min(ll a, ll b) {
	if (a > b) { return b; }
	return a;
}

ll gcd(ll a, ll b) {
	if (b == 0) { return a; }
	if (a < b) { return gcd(b, a); }
	return gcd(b, a%b);
}

ll lcm(ll a, ll b) {
	return a / gcd(a, b) *b;
}

struct edge {
	ll ind;
	ll to;
	ll d;
};


///////////////////////////



int main() {
	ll P, Q, R;
	cin >> P >> Q >> R;

	cout << min(P + Q, min(Q + R, R + P));


	system("PAUSE");
}

Measured memory_bytes: 504
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

from fractions import gcd

A,B,C,D = map(int,input().split())

dx = abs(A-C)
dy = abs(B-D)

g = gcd(dx,dy)
answer = (dx + dy) - g
print(answer)

Measured memory_bytes: 5048
#include <algorithm>
#include <iostream>
#include <string>
#define repi(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,a) repi(i,0,a)

std::string S;
int cnt[3];

int main()
{
  std::cin >> S;

  rep( i, S.size() )
    ++cnt[S[i]-'a'];

  int mi = *std::min_element( cnt, cnt+3 );

  rep( i, 3 )
  {
    if( cnt[i]-mi >= 2 )
    {
      std::cout << "NO" << std::endl;

      return 0;
    }
  }

  std::cout << "YES" << std::endl;

  return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#define rep(i, e, n) for (int i = e; i < (n); ++i)
using namespace std;
typedef long long ll;
using P = pair<int,int>;
const int inf=1000000007;


int main(){
  int n;
  cin >> n;
  vector<int> val(n+10,0);
  ll ans=0;

  rep(i,1,n+1){
    ll a;
    cin >> a;
    if(a+i<=n) val[a+i]++;
    if(i-a>0) ans +=val[i-a];
//    cout << i+a << ' ' << val[i-a] << endl;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3956
#include <bits/stdc++.h>
typedef long long ll;
#define REP(i, n) for(int i = 0; i < n; i++)
#define REP2(i, a, b) for(int i = a;i <= b;i++)
#define REPR(i, a, b) for(int i = a; i >= b; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define MOD 1000000007
#define PI 3.14159265358979323846
#define vi vector<int>
#define vll vector<ll>
#define vi2 vector<vector<int>>
#define eb emplace_back
#define fi first
#define se second
#define ALL(v) v.begin(), v.end()
#define sz(x) int(x.size())
using namespace std;
using P = pair<ll,ll>;
const int dx[]{0, 1, 0, -1, -1, -1, 1, 1}, dy[]{1, 0, -1, 0, -1, 1, -1, 1};
#define INT(name) int name;cin >> name;
#define VEC(type,name,n) vector<type> name(n);REP(i,n) cin >> name[i];

template<class T> inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template<class T> inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}

int main()
{
  INT(N);
  INT(X);
  INT(T);

  cout << ((N-1)/X+1)*T << endl;
}

Measured memory_bytes: 3592
#include "bits/stdc++.h"
using namespace std;
 
int main(void) {
	string s, t;
	cin >> s >> t;

	sort(s.begin(), s.end());
	sort(t.begin(), t.end());
	reverse(t.begin(), t.end());

	if(s<t) cout << "Yes" << endl;
	else cout << "No" << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,m,sum=0,d;
  int p[1100];
  while(1){
    sum = 0;
    cin >> n >> m;
    if(n==0 && m==0) break;
    for(int i=0; i<n; i++) {
      cin >> p[i];
      //sum += p[i];
    }
    sort(p,p+n);
    reverse(p,p+n);
    for(int i=1; i<=n/m; i++) p[i*m-1]=0;
    for(int i=0; i<n; i++) sum += p[i];
    /*for(int i=1; i<n+m; i++){
      d = m*i-1;
      sum -= p[d];
    }
    cout << sum << endl;*/
    cout << sum << endl;
  }
  return 0;
}



Measured memory_bytes: 3108
#include<stdio.h>

#define N 100000

int binarySearch(int *,int ,int);

int main(){
  int i,n,j,S[N],q,c,count = 0;

  scanf("%d",&n);

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

  scanf("%d",&q);

  for(j = 0;j < q;j++){
    scanf("%d",&c);
    if(binarySearch(S,c,n)) count++;
  }

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

  return 0;

}

int  binarySearch(int A[],int key,int n){
  int left = 0,mid,right;
  right = n;
  while (left < right){
    mid = (left + right) / 2;
    if (A[mid] == key){
        return 1;
    }
    else if(key < A[mid]){
      right = mid;
    }
    else if(key > A[mid]){
      left = mid + 1;
    }
  }
  return 0;
}



Measured memory_bytes: 2092
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        try (Scanner in = new Scanner(System.in)) {
            String A = in.next();
            String X = in.next();
            String C = in.next();

            System.out.println("A" + X.charAt(0) + "C");
        }
    }
}


Measured memory_bytes: 26952
a, b, c = map(int, input().split())
if a==b:
  if a!=c:
    print ("Yes")
  else:
    print("No")
elif b==c:
  if b!=a:
    print ("Yes")
  else:
    print("No")
elif c==a:
  if c!=b:
    print ("Yes")
  else:
    print("No")
else:
  print ("No")
  

Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
const int M = 1e9 + 7;


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

	int s; cin >> s;
	vector<int> dp(s + 1, 1);
	dp[1] = dp[2] = 0;
	for (int i = 6; i <= s; ++i) {
		for (int j = 3; j <= i - 3; ++j) {
			dp[i] = ((long long) dp[i] + dp[j]) % M;
		}
	}
	cout << dp[s] << endl;
	return 0;
}

Measured memory_bytes: 3584
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <set>
using namespace std;
int main() {
	int k;
	string s;
	cin >> k >> s;
	int n = s.length();
	if(n <= k) cout << s;
	else{
		for(int i = 0; i < k; i++){
			cout << s[i];
		}
		cout << "...";
	}
	return 0;
}

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

int main(){
    int n;
    scanf("%d",&n);
    while(n--){
        long long a, b;
        scanf("%lld%lld",&a,&b);
        long long ua = min(a-1, (a*b-1)/(b+1));
        long long ub = min(b-1, (a*b-1)/(a+1));
        long long ans = 0;
        long long ss = 0, ee = 1100000000, sq = -1;
        while(ss <= ee){
            long long mid = (ss + ee) / 2;
            if(mid * mid <= (a * b - 1)){
                sq = mid;
                ss = mid + 1;
            }else{
                ee = mid - 1;
            }
        }
        if(ua <= sq){
            ans += ua;
        }else{
            ans += sq + min(max(((a*b-1) / (sq+1)) - b, 0LL), ua - sq);
        }
        if(ub <= sq){
            ans += ub;
        }else{
            ans += sq + min(max(((a*b-1) / (sq+1)) - a, 0LL), ub - sq);
        }
        printf("%lld\n", ans);
    }
}


Measured memory_bytes: 256
def solve(n, a, b):
    negatives = [b[i] - a[i] for i in range(n) if a[i] < b[i]]
    positives = [a[i] - b[i] for i in range(n) if a[i] > b[i]]
    s = sum(negatives)
    positives.sort(reverse=True)
    
    if s == 0:
        return 0
    
    accum = 0
    for i, a in enumerate(positives):
        accum += a
        if accum >= s:
            return len(negatives) + i + 1

    return -1

def main():
    n = int(input())
    a = [int(s) for s in input().split()]
    b = [int(s) for s in input().split()]

    print(solve(n, a, b))


main()


Measured memory_bytes: 20084
#include <bits/stdc++.h>
using namespace std;
#define _USE_MATH_DEFINES
 
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
 
// DON'T USE THESE MACROS DURING ICPC PRACTICE
#define For(i,n) for (int i=0; i<n; i++)
#define FOR(i,a,b) for (int i=a; i<=b; i++)
#define Down(i,n) for (int i=n-1; i>=0; i--)
#define DOWN(i,a,b) for (int i=b; i>=a; i--)
 
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pdd;
typedef complex<ld> pt;
typedef vector<pt> pol;
typedef vector<int> vi;
 
const char nl = '\n';
const int INF = 0x3f3f3f3f;
const ll INFLL = 0x3f3f3f3f3f3f3f3f;
const ll MOD = 1e9+7;
const ld EPS = 1e-10;
mt19937 rng(chrono::high_resolution_clock::now().time_since_epoch().count());
 
 
 
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0); cout.tie(0);
  cout << fixed << setprecision(10);

  int n;
  cin >> n;

  string s;
  cin >> s;

  int dp[n][n];
  memset(dp, 0, sizeof dp);
  dp[0][0] = 1;
  for (int i=1; i<n; i++) {
    if (s[i-1] == '<') {
      ll cur = 0;
      for (int j=1; j<=i; j++) {
        cur += dp[i-1][j-1];
        dp[i][j] = cur % MOD;
      }
    } else {
      ll cur = 0;
      for (int j=i-1; j>=0; j--) {
        cur += dp[i-1][j];
        dp[i][j] = cur % MOD;
      }
    }
  }
  
  ll ans = 0;
  for (int i=0; i<n; i++) {
    ans += dp[n-1][i];
  }
  cout << ans % MOD << nl;

  return 0;
}

Measured memory_bytes: 35456
#include<iostream>
#include<cstring> 
#include<cstdio>
#include<algorithm>
#include<stack>
using namespace std;
int a,b,c;
int main()
{
	scanf("%d%d%d",&a,&b,&c);
	printf("%d\n",min(b/a,c));
	return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

void solve()
{
	int a, b, c;
	cin >> a >> b >> c;
	int ans = 0;
	for (int i = a; i <= b; ++i)
	{
		if (c % i == 0)
		{
			++ans;
		}
	}
	cout << ans << endl;
}

int main()
{
	solve();
	return(0);
}

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

int di[]={-1,0,1,0};
int dj[]={0,-1,0,1};

int main(){
    int h,w;
    cin>>h>>w;
    vector<string>s(h);
    rep(i,h)cin>>s[i];
    int ans=0;
    rep(si,h)rep(sj,w){
        if(s[si][sj]=='#')continue;
        vector<vector<int>>dist(h,vector<int>(w,1e9));
        queue<pair<int,int>>q;
        auto update=[&](int i,int j,int x){
            if(dist[i][j]!=1e9)return;
            dist[i][j]=x;
            q.push(make_pair(i,j));
        };
        update(si,sj,0);
        while(!q.empty()){
            int i=q.front().first;
            int j=q.front().second;
            q.pop();
            rep(dir,4){
                int ni=i+di[dir];
                int nj=j+dj[dir];
                if(ni<0||ni>=h||nj<0||nj>=w)continue;
                if(s[ni][nj]=='#')continue;
                update(ni,nj,dist[i][j]+1);
            }
        }
        rep(i,h)rep(j,w){
            if(dist[i][j]==1e9)continue;
            ans=max(ans,dist[i][j]);
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#define MAX 100001
int main()
{
  int youko1,youko2,haire1[MAX],haire2[MAX],i,j,k=1,l=1,samec=0;
  //char c1,c2;
  scanf("%d",&youko1);
  //printf("%d\n",youko1);
  for(i=1;i<=youko1;i++)
    {
      scanf("%d",&haire1[i]);
      //printf("%d\n",haire1[i]);
      //haire1[i]=atoi(&c1);
    }
  scanf("%d",&youko2);
  for(j=1;j<=youko2;j++)
    {
      scanf("%d",&haire2[j]);
      //printf("%d\n",haire2[i]);
      //haire2[i]=atoi(&c2);
    }
  while(k<=youko2)
    {
      //printf("100\n");
      while(l<=youko1)
	{
	  //printf("100\n");
	  // printf("%d %d\n",l,haire2[k]);
	  if(haire2[k]==haire1[l])
	    {
	      //printf("100\n");
	      samec++;
	      break;
	    }
	  else
	    {
	      l++;
	    }
	}
      l=1;
      k++;
    }
  printf("%d\n",samec);
  return 0;
}

/*
  if(youko1>youko2)
  {
  ooki=youko1;
  }
  else
  {
  ooki=youko2;
  }
  for(k=1;k<=ooki;k++)
  {
  strcmp(haire1[i]);
  }
*/



Measured memory_bytes: 2108
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod = 1e9 + 7;
int main()
{
	int n,a,fg=1;
	cin>>n;
	for(int i=1;i<=n;i++){
        cin>>a;
        if(a%2==0){
            if(a%3!=0&&a%5!=0) fg=0;
        }
	}
	if(fg==1)printf("APPROVED");
	else printf("DENIED");
	return 0;
}


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 ull = unsigned long long;
using p  = pair<int, int>;
using vec_int = vector<int>;
using vec_str = vector<string>;
#define INF (1<<29)

int main()
{
    ull N = 0;
    string S;
#if 1
	cin >> N;
	ull K;
	cin >> K;
#endif
#if 0
	cin >> S;
#endif
#if 0
    vec_str v(N);
    //vec_int v(N);
    rep(i, N) cin >> v[i];
#endif

#if 0
    p pp = make_pair(1, 2);
    //cout << pp.first << endl;
    //cout << pp.second << endl;
#endif
    
    ull ans = 0;
    ull x = 0;
    ull t = N / K;
    N = N - K * t;
    
    while( 1 ) {
        if( N > K ) {
            x = N - K; 
        }
        else {
            x = K - N;
        }
    
        if( N <= x ) {
            ans = N;
            break;
        }
        
        N = x;
    }

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

Measured memory_bytes: 384
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;

class Program
{
    static void Main(string[] args)
    {
        int N = int.Parse(Console.ReadLine());
        var a = Console.ReadLine().Split().Select(int.Parse).OrderByDescending(i=>i).ToArray();
        int d = 0;
        for (int i = 0; i < N; i++)
        {
            d += a[i] * (int)Math.Pow(-1, i);
        }
        Console.WriteLine(d);
    }
}

Measured memory_bytes: 13396
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<math.h>
using namespace std;
typedef long long ll;
#define int long long
typedef vector<int> VI;
#define fore(i,a) for(auto &i:a)
#define REP(i,n) for(int i=0;i<n;i++)
#define eREP(i,n) for(int i=0;i<=n;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define eFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define SORT(c) sort((c).begin(),(c).end())
#define rSORT(c) sort((c).rbegin(),(c).rend())
#define LB(x,a) lower_bound((x).begin(),(x).end(),(a))
#define UB(x,a) upper_bound((x).begin(),(x).end(),(a))
#define INF 1000000000
#define LLINF 9223372036854775807
#define mod 1000000007
//vector<vector<int> > dp;
//vector<vector<vector<int> > > vvvi;
//dp=vector<vector<int> >(N, vector<int>(M,0));
//vector<pair<int,int> > v;
//v.push_back(make_pair(x,y));



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



	int x, y ,z;
	cin >> x >> y>>z;

	if (y >= z)
		cout << "delicious" << endl;
	else if (x >= (z - y))
		cout << "safe" << endl;
	else
		cout << "dangerous" << endl;
	return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
long long n,r[10001],l[10001],ans;
int main()
{
    cin>>n;
    for(int i=1;i<=n;i++)
    {
    	cin>>r[i]>>l[i];
    }
    for(int i=1;i<=n;i++)
    {
    	if(r[i]>l[i]) swap(r[i],l[i]);
    	ans+=l[i]-r[i]+1;
    }
    cout<<ans;
    return 0;
}


Measured memory_bytes: 256
//#include "/usr/local/bits"
#include <bits/stdc++.h>
using namespace std;    
#define ll long long
#define pb push_back
#define mp make_pair
//#include <ext/pb_ds/assoc_container.hpp> 
//#include <ext/pb_ds/tree_policy.hpp> 
//using namespace __gnu_pbds; 
  
//#define ordered_set tree<pair<int,int>, null_type,less< pair<int,int> >, rb_tree_tag,tree_order_statistics_node_update> 
//find_by_order(k) - k is the kth element of the set
//order_of_key(k) - Number of elements striclty samller than k
void build(ll segt[],ll arr[],ll l,ll r,ll ind)
{
    if(l==r)
    {
        segt[ind]=arr[l];
        return;
    }
    ll mid=l+(r-l)/2;
    build(segt,arr,l,mid,2*ind+1);
    build(segt,arr,mid+1,r,2*ind+2);
    segt[ind]=min(segt[2*ind+1],segt[2*ind+2]);
}
//llim-lower limit of array,rlim-upper limit of array
//l,r- range of query
ll sum(ll segt[],ll llim,ll rlim,ll l,ll r,ll ind)
{
    //cout<<llim<<" "<<rlim<<endl;
    if(l<=llim && rlim<=r)
    {
        //cout<<"here "<<segt[ind]<<" "<<ind<<endl;
        return segt[ind];
    }
    if(r<llim || rlim<l)
    {
        return 1e18;
    }
    ll mid=llim+(rlim-llim)/2;
    return min(sum(segt,llim,mid,l,r,2*ind+1),sum(segt,mid+1,rlim,l,r,2*ind+2));
}
void update(ll segt[],ll llim,ll rlim,ll diff,ll upind,ll ind)
{
    if(upind<llim || upind>rlim)
        return;
    segt[ind]=min(segt[ind],diff);
    if(llim==rlim)
    {
        segt[ind]=diff;
        return;
    }
    if(llim!=rlim)
    {
        ll mid=llim+(rlim-llim)/2;
        update(segt,llim,mid,diff,upind,2*ind+1);
        update(segt,mid+1,rlim,diff,upind,2*ind+2); 
    }
}
ll modularExponentiation(ll x,ll n,ll M=1000000007)
{
    if(n==0)
        return 1;
    else if(n%2 == 0)        //n is even
        return modularExponentiation((x*x)%M,n/2,M);
    else                             //n is odd
        return (x*modularExponentiation((x*x)%M,(n-1)/2,M))%M;
 
}
ll modInverse(ll A,ll M=1000000007)
{
    return modularExponentiation(A,M-2,M);
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); 
    ll n;
    cin>>n;
    cout<<1000*(n/500)+5*((n%500)/5)<<endl;
}






















Measured memory_bytes: 256
#include<stdio.h>
#include<cstring>

char str[201];
char a[101], b[101];

void shorten(char str[]) {//文字列を2文字分短くする//
	int i,n;

	n = strlen(str);
	   
	str[n - 1] = '\0';
	str[n - 2] = '\n';
 }

void splid(char str[], int x) {//文字列を二つに分ける//

	int i;

	for (i = 0; i < x / 2; i++) {
		a[i] = str[i];
		b[i] = str[x / 2 + i];

	}
	a[x / 2] = '\n';
	b[x / 2] = '\n';
}

int main() {
	int len;

	scanf("%s", str);

	while (strlen(str) > 0) {
		shorten(str);
		len = strlen(str);
		splid(str, len);
		if (strcmp(a, b) == 0) {
			printf("%d", len-1);
			return 0;
		}
		
	}	

	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
typedef long long int ll;
typedef long double ld;
using namespace std;
const long long int INF = 1e18;
const long long int MOD = 1e9+7;

typedef pair<ll, ll> pairs;
typedef vector<pairs> p;

struct edge{
    ll to, cost;
};


ll gcd(ll a,ll b){
    if(b == 0){
        return a;
    }else{
        return gcd(b, a%b);
    }
}

ll lcm(ll a, ll b){
    return a / gcd(a, b) * b;
}

ll keta(ll N){
    int tmp{};
    while( N > 0 ){
        tmp += ( N % 10 );
        N /= 10;
    }
    N = tmp;
    return N;
}

// 素数
vector<bool> IsPrime;
void sieve(size_t max){
    if(max+1 > IsPrime.size()){
        IsPrime.resize(max+1,true);
    } 
    IsPrime[0] = false;
    IsPrime[1] = false;

    for(size_t i=2; i*i<=max; ++i){
        if(IsPrime[i]){
            for(size_t j=2; i*j<=max; ++j){
                IsPrime[i*j] = false;
            }
        }
    }
}

// べき乗の余り
ll modpow(ll a, ll n, ll mod){
    ll res = 1;
    while(n){
        if(n & 1){
            (res *= a) %= mod;
        }else{
            (a *= a) %= mod;
        }
        n >>= 1;
    }
    return res;
}

// 回文
bool kai(string S){
    bool flag = true;
    for(ll i=0;i<S.size()/2;++i){
        if(S[i] != S[S.size()-i-1]){
            flag = false;
            break;
        }
    }
    return flag;
}
// ---------------------------------------------

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

    ll ans = 0;
    for(ll i=1;i<n;++i){
        ans += i;
    }
    cout<<ans<<endl;

    return 0;
}

Measured memory_bytes: 3640
const main = input => {
  const [a, b] = input.trim().split(' ')
  if (a === 'H') {
    b === 'H' ? console.log('H') : console.log('D')
  } else {
    b === 'H' ? console.log('D') : console.log('H')
  }
}

// 標準入力
main(require("fs").readFileSync("/dev/stdin", "utf8"))


Measured memory_bytes: 29584
#include <cstdio>
#include <cstring>
#include <cmath>
#include <utility>
#include <iostream>
#include <functional>
#include <bitset>
#include <algorithm>
#include <vector>
#include <forward_list>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <tuple>
#include <numeric>
 
#define rep(i,n) for(int i = 0; i < (int)n; i++)
#define rrep(i, s, g) for ((i) = (s); (i) < (g); ++(i))
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
const ll MOD = 1e9 + 7;
const ll INF = (1ll << 60);

 
int main(void){
  
  //vector<vector<char>> maze(h, vector<char>(w));
  //vector<vector<ll>> warp(h, vector<ll>(w, INF));
  
  string s,t;
  int count=1001;
  cin >> s >> t;
  rep(i,s.size()-t.size()+1){
    int cou = 0;
    rep(j,t.size()){
      if(s[i+j]!=t[j]) cou ++;
    }
    count = min(cou,count);
  }
  
  cout << count << endl;
}


Measured memory_bytes: 3644
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
    int a,b,k; cin>>a>>b>>k;
    int count=0,ans;
    for(int i=min(a,b);i>=0;i--){
        if(a%i==0&&b%i==0) count++;
        if(count==k){
            ans=i;
            break;
        }
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
n, m, c = map(int, input().split())
numsB = list(map(int, input().split()))

count = 0

for i in range(n):
    total = c
    numsA = list(map(int, input().split()))
    for j in range(m):
        total += numsA[j] * numsB[j]
    if total > 0:
        count += 1

print(count)

Measured memory_bytes: 3060
#include <iostream>
#include<bits/stdc++.h>
#define rep(k,i,n) for(int i=k;i<n;++i)
using namespace std;
int main(void){
    // Your code here!
    int A,B;
    cin>>A>>B;
    if(A<10 && B<10){
        cout<<A*B<<endl;
    }else{
        cout<<-1<<endl;
    }
}


Measured memory_bytes: 256
a, b, c = map(int, input().split())
if a >= b >= c:
    print(c, b, a)
elif a >= c >= b:
    print(b, c, a)
elif b >= a >= c:
    print(c, a, b)
elif b >= c >= a:
    print(a, c, b)
elif c >= b >= a:
    print(a, b, c)
elif c >= a >= b:
    print(b, a, c)



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

int div(int A, int B, int mod_p) {
  stack<int> q_stack;
  int a = B, b = mod_p, r;
  while (b) {
    q_stack.push(a / b);
    r = a % b; a = b; b = r;
  }
  long u = 1, v = 0;
  while (!q_stack.empty()) {
    int q = q_stack.top(); q_stack.pop();
    long u1 = v, v1 = u-q*v; u = u1 % mod_p; v = v1 % mod_p;
  }
  return (long)A * (u + mod_p) % mod_p;
}
 
int num_com(int n, int k, int mod_p) {
  int k2 = min(k, n - k);
  long nmr = 1, dnm = 1;
  for (int i = 1; i <= k2; i++) {
    nmr *= n + 1 - i; nmr %= mod_p;
    dnm *= i; dnm %= mod_p;
  }
  return div(nmr, dnm, mod_p);
}

int main() {
  int DIV = 1e+9 + 7;
  long N, M, K; cin >> N >> M >> K;
  long a = N*(N+1)*(N-1) / 6 % DIV; a = a * M * M % DIV;
  long b = M*(M+1)*(M-1) / 6 % DIV; b = b * N * N % DIV;
  int res = (a + b) * num_com(N * M - 2, K - 2, DIV) % DIV;
  cout << res << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll mod = 1000000007;
const ll inf = (1 << 30) - 1;
const ll infll = (1LL << 61) - 1;

ll N, W, w, a, b;

#include <bits/stdc++.h>
using namespace std;

string to_string(string s)
{
    return '"' + s + '"';
}

string to_string(const char *s)
{
    return to_string((string)s);
}

string to_string(bool b)
{
    return (b ? "true" : "false");
}

template <typename A, typename B>
string to_string(pair<A, B> p)
{
    return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}

template <typename A>
string to_string(A v)
{
    bool first = true;
    string res = "{";
    for (const auto &x : v)
    {
        if (!first)
        {
            res += ", ";
        }
        first = false;
        res += to_string(x);
    }
    res += "}";
    return res;
}

void debug_out() { cerr << endl; }

template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T)
{
    cerr << " " << to_string(H);
    debug_out(T...);
}

int main()
{
    cin >> N >> W;
    vector<vector<ll>> v(4);
    for (int i = 0; i < 4; i++)
    {
        v[i].push_back(0);
    }
    cin >> w >> a;
    v[0].push_back(a);
    for (int i = 1; i < N; i++)
    {
        cin >> a >> b;
        v[a - w].push_back(b);
    }
    for (int i = 0; i < 4; i++)
    {
        sort(v[i].begin(), v[i].end());
        reverse(v[i].begin() + 1, v[i].end());
        for (int j = 1; j < v[i].size(); j++)
        {
            v[i][j] += v[i][j - 1];
        }
    }
    ll ans = 0, w1 = v[0].size(), w2 = v[1].size(), w3 = v[2].size(), w4 = v[3].size();
    for (int i = 0; i < w1; i++)
    {
        for (int j = 0; j < w2; j++)
        {
            for (int k = 0; k < w3; k++)
            {
                ll sum = 0, weight = 0;
                weight = w * i + (w + 1) * j + (w + 2) * k;
                if (weight > W)
                    continue;
                ll l = min(w4 - 1, (W - weight) / (w + 3));
                sum += v[0][i];
                sum += v[1][j];
                sum += v[2][k];
                sum += v[3][l];
                ans = max(sum, ans);
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
from collections import defaultdict
S = input()
N = len(S)
d = defaultdict(list)
for i in range(N):
    d[S[i]].append(i)
ans = [-1,-1]
for s in d:
    l = []
    for i in range(len(d[s])):
        l.append([d[s][i]-2*i,i])
    l.sort()
    for i in range(len(l)-1):
        if l[i+1][1]<=l[i][1] or l[i+1][0]==l[i][0]:
            ans = [d[s][l[i+1][1]]+1,d[s][l[i][1]]+1]
ans.sort()
print(*ans)

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

int main() {
	int t;
	scanf("%d",&t);
	while (t--) {
		ll a,b,c,d;
		scanf("%lld%lld%lld%lld",&a,&b,&c,&d);
		ll n=(a+b)/(min(a,b)+1);
		if (n==1) {
			if (a>=b) {
				for(int i=c;i<=d;i++) {
					if (i&1) putchar('A');
					else putchar('B');
				}
			} else {
				for(int i=c;i<=d;i++) {
					if (i&1) putchar('B');
					else putchar('A');
				}
			}
			putchar('\n');
			continue;
		}
		ll x=max((a*n-b)/(n*n-1),0ll);
		ll y=max((b*n-a)/(n*n-1),0ll);
		ll x1=a-n*x-y;
		ll y1=b-n*y-x;
//		cerr<<x<<' '<<x1<<' '<<y1<<' '<<y<<endl;
//		string s1=string(n,'A')+'B';
//		string s2='A'+string(n,'B');
//		string s="";
//		for(int i=1;i<=x;i++) s+=s1;
//		for(int i=1;i<=x1;i++) s+='A';
//		for(int i=1;i<=y1;i++) s+='B';
//		for(int i=1;i<=y;i++) s+=s2;
//		cerr<<s<<endl;
		if (c<=x*(n+1)) {
			int l1=c,l2=min(x*(n+1),d);
			for(int i=l1;i<=l2;i++) {
				if (i%(n+1)) putchar('A');
				else putchar('B');
			}
		}
		if (c<=x*(n+1)+x1&&x*(n+1)<d) {
			int l2=max(c,x*(n+1)+1),r2=min(x*(n+1)+x1,d);
			for(int i=l2;i<=r2;i++) {
				putchar('A');
			}
		}
		if (c<=x*(n+1)+x1+y1&&x*(n+1)+x1<d) {
			int l3=max(c,x*(n+1)+x1+1),r3=min(x*(n+1)+x1+y1,d);
			for(int i=l3;i<=r3;i++) {
				putchar('B');
			}
		}
		if (x*(n+1)+x1+y1<d) {
			int l4=max(c,x*(n+1)+x1+y1+1),r4=d;
			for(int i=l4;i<=r4;i++) {
				if ((i-x*(n+1)-x1-y1)%(n+1)!=1) putchar('B');
				else putchar('A');
			}
		}
		putchar('\n');
	}
	return 0;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,a,n4=0,n2=0;
  cin>>n;
  for(int i=0;i<n;i++){
    cin>>a;
    if(a%4==0)
      n4++;
    else if(a%2==0)
      n2++;
  }
  if(n/2<=n4+n2/2)
    cout<<"Yes";
  else
    cout<<"No";
}

Measured memory_bytes: 256