akhauriyash/Code-Regression huggingface dataset:
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <queue>
#include <string>
#include <set>
#include <map>
#define REP(i,n) for(ll i = 0; i < (ll)n; i++)
#define INF 1000000000000000
using namespace std;
typedef long long ll;
typedef double db;
typedef string str;

int main(){
  ll n;
  cin >> n;
  set<ll> st;
  ll cnt = 0;
  REP(i,n){
    ll a; cin >> a;
    if(st.find(a)==st.end()){
      st.insert(a);
    }else{
      cnt++;
    }
  }
  if(cnt%2==0){
    cout << st.size() << endl;
  }else{
    cout << st.size()-1 << endl;
  }
  return 0;
}


Measured memory_bytes: 4992
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <cassert>

using namespace std;

int N;
long long A[200001];
long long sum_A[200001];

long long diff(int start, int end, int i){
  i = max(min(i, end), start);
  long long right = sum_A[end - 1] - sum_A[i - 1];
  long long left = sum_A[i - 1] - (start == 0 ? 0 : sum_A[start - 1]);
  return abs(right - left);
}
  


int find_pos(int start, int end){
  int l = start + 1;
  int r = end - 1;
  while(1){
    if(r - l <= 3){
      break;
    }
    int halfleft_id = (l*2 + r*1)/3;
    int halfright_id = (l*1 + r*2)/3;
    long long halfleft_diff = diff(start, end, halfleft_id);
    long long halfright_diff = diff(start, end, halfright_id);
    if(halfleft_diff <= halfright_diff){
      r = halfright_id;
    }else{
      l = halfleft_id;
    }

  }
  long long x[4];
  x[0] = diff(start, end, min(l, end - 1));
  x[1] = diff(start, end, min(l + 1, end - 1));
  x[2] = diff(start, end, min(l + 2, end - 1));
  x[3] = diff(start, end, min(l + 3, end - 1));  
  return min((int)(l + (min_element(x, x+4) - x)), end - 1);
    
}

int main(){
  scanf("%d", &N);
  long long sum = 0;
  for(int i=0; i < N; i++){
    scanf("%lld", A + i);
    sum += A[i];
    sum_A[i] = sum;
  }

  long long res = sum;
  for(int center = 2; center <= N - 2; center++){
  int left = find_pos(0, center);
  int right = find_pos(center, N);
  long long x[4];
  x[0] = sum_A[left - 1];
  x[1] = sum_A[center - 1] - sum_A[left - 1];
  x[2] = sum_A[right - 1] - sum_A[center - 1];
  x[3] = sum_A[N - 1] - sum_A[right - 1];
  res = min(res, *max_element(x, x+4) - *min_element(x, x+4));
  }
  // printf("%d %d %d\n", left, center, right);
  // printf("%d %d %d %d\n", x[0], x[1], x[2], x[3]);  
  printf("%lld\n", res);
  return 0;
}


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

#define int long long

#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,a,b) for(int i=(a);i<(b);i++)
#define pb push_back
#define eb emplace_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second

using vint=vector<int>;
using pint=pair<int,int>;
using vpint=vector<pint>;

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

template<class A,class B>
ostream& operator<<(ostream& ost,const pair<A,B>&p){
    ost<<"{"<<p.first<<","<<p.second<<"}";
    return ost;
}

template<class T>
ostream& operator<<(ostream& ost,const vector<T>&v){
    ost<<"{";
    for(int i=0;i<v.size();i++){
        if(i)ost<<",";
        ost<<v[i];
    }
    ost<<"}";
    return ost;
}

int N,M;
int A[111111];
int acc[111111];
pint calc(int x){
    int sum=0;
    int cnt=0;
    for(int i=0;i<N;i++){
        int k=lower_bound(A,A+N,x-A[i])-A;
        sum+=acc[N]-acc[k]+A[i]*(N-k);
        cnt+=N-k;
    }
    return pint(sum,cnt);
}

signed main(){
    cin>>N>>M;
    rep(i,N)cin>>A[i];
    sort(A,A+N);
    rep(i,N)acc[i+1]=acc[i]+A[i];

    int lb=0,ub=202020;
    while(ub-lb>1){
        int mid=(ub+lb)/2;
        pint p=calc(mid);
        if(p.se>=M)lb=mid;
        else ub=mid;
    }

    pint p=calc(lb);
    int ans=p.fi;
    ans-=(p.se-M)*lb;
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
#define INF 1e12

#define PB push_back
#define PF push_front
#define fi first
#define se second
#define pii pair<int, int>
#define pll pair<ll, ll>
#define vi vector<int>
#define vpi vector<pii>
#define vll vector<ll>
#define vpl vector<pll>
#define vvi vector<vector<int>>
#define vvl vector<vector<ll>>
#define MX(x) *max_element(all(x))
#define MN(x) *min_element(all(x))
#define ios ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define pr_d(x) cout << fixed << setprecision(15) << x << endl
#define ud(c, x) distance(c.begin(), upper_bound(all(c), x))
#define ld(c, x) distance(c.begin(), lower_bound(all(c), x))
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep2(i, a, b) for (int i = (a); i < (b); ++i)
#define rep3(i, n) for (int i = (n - 1); i >= 0; --i)
#define rep4(i, a, b) for (int i = (a); i > (b); --i)
#define pb push_back
#define out(x) cout << x << "\n"
bool odd(int i) { return i % 2; }

#define all(v) v.begin(), v.end()
#define size(x) int(x.size())

int gcd(int a, int b) { return __gcd(a, b); }
int lcm(int a, int b) { return a * (b / gcd(a, b)); }
void Yes_No(bool f) {
  if (f)
    printf("Yes\n");
  else
    printf("No\n");
}

void deb_p(pii p) { printf("pair = %d %d\n", p.fi, p.se); }
void deb_i(int i) { printf("i = %d\n", i); }
void deb_v(vector<int> v) {
  printf("v = ");
  for (auto i : v) printf("%d ", i);
  printf("\n");
}
template <typename T>
bool chmax(T& a, const T& b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <typename T>
bool chmin(T& a, const T& b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
//-------------------ここから回答する-----------------------

void solve(void) {
  string s;
  cin >> s;
  Yes_No(s[0] == s[2]);
}
int main(void) { solve(); }


Measured memory_bytes: 3584
#include<bits/stdc++.h>
using namespace std;
#define LL long long 
#define ULL unsigned long long 

const int N = 1e5+11;
const int M = 1e6+11;
const int mod = 1e9+7;
const int inf = 0x3f3f3f3f;
const int inff = 0x3f3f3f3f3f3f3f3f;


/*-----------------------------------------*/

 
char a[100],b[100],c[100];
int main(){
 	scanf("%s",a);
 	int len=strlen(a);
 	for(int i=0;i<len;i++){
 		if(a[i]==',') printf(" ");
 		else printf("%c",a[i]);
	 }
 	
return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, from, to) for (int i = from; i < (to); ++i)
#define mp(x,y) make_pair(x,y)
#define all(x) (x).begin(),(x).end()
#define pb push_back
using ll = long long;
using vin=vector<int>;
using vll=vector<ll>;
using vst=vector<string>;
using P = pair<int, int>;
const int inf=1e9+7;
const ll INF=1e18;
template <typename T> void chmin(T &a, T b) { a = min(a, b); }
template <typename T> void chmax(T &a, T b) { a = max(a, b); }
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
const int dx[4] = { 1, 0, -1, 0 };
const int dy[4] = { 0, 1, 0, -1 };

char g[5]={'a','i','u','e','o'};
int main(){cout<<fixed<<setprecision(10);
		   char c;
           cin>>c;
           rep(i,0,5){
            if(c==g[i]){
             cout<<"vowel"<<endl; 
              return 0;
            }
           }
           cout<<"consonant"<<endl;
}

Measured memory_bytes: 3596
n = int(input())
a = list(map(int, input().split()))

MOD = 10 ** 9 + 7

c = [-1,-1,-1]

ans = 1

for x in a:
    ans = ans * c.count(x-1) % MOD
    for i in range(3):
        if c[i] == x-1:
            c[i] = x
            break

print(ans)

Measured memory_bytes: 54700
#include<bits/stdc++.h>
//ios::sync_with_stdio(false);
//cin.tie(0);
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<pii,int> ppii;
typedef pair<int,pii> pipi;
typedef pair<ll,ll> pll;
typedef pair<pll,ll> ppll;
typedef pair<ll,pll> plpl;
typedef tuple<ll,ll,ll> tl;
ll mod=1000000007;
ll mod2=998244353;
ll inf=1000000000000000000;
double pi=2*acos(0);
#define rep(i,m,n) for(ll i=m;i<n;i++)
#define rrep(i,n,m) for(ll i=n;i>=m;i--)
int dh[4]={1,-1,0,0};
int dw[4]={0,0,1,-1};
int ddh[8]={-1,-1,-1,0,0,1,1,1};
int ddw[8]={-1,0,1,-1,1,-1,0,1};
ll lmax(ll a,ll b){
    if(a<b)return b;
    else return a;
}
ll lmin(ll a,ll b){
    if(a<b)return a;
    else return b;
}
ll gcd(ll a,ll b){
    if(a<b)swap(a,b);
    if(a%b==0)return b;
    return gcd(b,a%b);
}
ll Pow(ll n,ll k){
    ll ret=1;
    ll now=n;
    while(k>0){
        if(k&1)ret*=now;
        now*=now;
        k/=2;
    }
    return ret;
}
ll dp[513][501];
ll sum[513][501];
int main(){
    int n,x;cin>>n>>x;
    int xx=1;
    while(x>=xx)xx*=2;
    
    memset(dp,0,sizeof dp);
    
    memset(sum,0,sizeof sum);
    rep(i,0,x+1){
        dp[i][i]=1;
    }
    rep(i,0,xx){
        sum[i][0]=dp[i][0];
        rep(j,1,x+1)sum[i][j]=sum[i][j-1]+dp[i][j];
    }
    rep(i,1,n){
        rep(j,0,xx){
            rep(k,0,x+1){
                dp[j][k]=sum[j^k][k];
                
            }
        }
      rep(j,0,xx){
        sum[j][0]=dp[j][0];
        rep(k,1,x+1){
          sum[j][k]=(sum[j][k-1]+dp[j][k])%mod2;
        }
      }
    }
    cout<<sum[x][x]<<endl;
}


Measured memory_bytes: 7128
public class Main {


		public static void main(String[] args) {
		java.util.Scanner scan = new java.util.Scanner(System.in);
		int h, w, i, t;
		
while(true){
		h = scan.nextInt();
		w = scan.nextInt();
		
		if(h == 0 && w == 0){
				break;
			}
		if(3 <= h && h <= 300 && 3 <= w && w <= 300){
			for(i = 0; i < h ; i++){
			for(t = 0; t < w ; t++){
				if(t == 0 || t == w - 1 || i == 0 || i == h - 1){
				System.out.print("#");
				}else{
					
					System.out.print(".");
				}
			}System.out.println("");
			
			}System.out.println("");
		
		
		}
		
		}
		}
}

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

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

  vector<int> D1(n), D2(n);
  rep(i, n) cin >> D1[i] >> D2[i];

  int zorome = 0;
  rep(i, n) {
    int d1 = D1[i], d2 = D2[i];
    if (!(d1 == d2)) {
      zorome = 0;
    } else {
      zorome++;
      if (zorome == 3) break;
    }
  }

  if (zorome == 3) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}


Measured memory_bytes: 3640
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        C solver = new C();
        solver.solve(1, in, out);
        out.close();
    }

    static class C {
        static int n;
        static int m;
        static int q;
        static int atod[][];
        static int suuretu[];
        static int ans = 0;

        public void solve(int testNumber, Scanner in, PrintWriter out) {
            // 入力
            n = Integer.parseInt(in.next());
            m = Integer.parseInt(in.next());
            q = Integer.parseInt(in.next());
            atod = new int[q][4];
            suuretu = new int[n];
            for (int i = 0; i < q; i++) {
                atod[i][0] = Integer.parseInt(in.next()) - 1;
                atod[i][1] = Integer.parseInt(in.next()) - 1;
                atod[i][2] = Integer.parseInt(in.next());
                atod[i][3] = Integer.parseInt(in.next());
            }

            dfs(1, 0);
//        List<Integer> A = new ArrayList<>(1);
//        Collections.fill(A, 1);
//        dfs(A);

            // 出力
            out.println(ans);

        }

        public static void dfs(int now, int cnt) {
            suuretu[cnt] = now;
            if (cnt == n - 1) {
                int tmp = 0;
                for (int i = 0; i < q; i++) {
                    if (suuretu[atod[i][1]] - suuretu[atod[i][0]] == atod[i][2]) tmp += atod[i][3];
                }
                ans = Math.max(ans, tmp);
                return;
            }
            for (int i = now; i <= m; i++) {
                dfs(i, cnt + 1);
            }
        }

    }
}



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

int main() {
  long N,M,p=0;
  cin>>N>>M;
  p=M;
  while(true){
    if(p*N<=M){
      p=p+10000000;
     break;
   }
    p=p-10000000;
  }
  
 for(int i=p;i>0;i--){
   if(M%i==0&&i*N<=M){
     cout<<i;
     break;
   }
 }
  
}

Measured memory_bytes: 256
#include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <iostream>
#include <sstream>
#include <functional>
#include <map>
#include <string>
#include <cstring>
#include <vector>
#include <queue>
#include <stack>
#include <deque>
#include <set>
#include <list>
#include <numeric>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll> P;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const ll INF = 1LL<<29;
const ll mod = 1e9+7;
#define rep(i,n) for(int (i)=0;(i)<(ll)(n);++(i))
#define repd(i,n,d) for(ll (i)=0;(i)<(ll)(n);(i)+=(d))
#define all(v) (v).begin(), (v).end()
#define pb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))
#define mset(m,v) memset((m),(v),sizeof(m))
#define chmin(x,y) (x=min(x,y))
#define chmax(x,y) (x=max(x,y))
#define fst first
#define snd second
#define UNIQUE(x) (x).erase(unique(all(x)),(x).end())
template<class T> ostream &operator<<(ostream &os, const vector<T> &v){int n=v.size();rep(i,n)os<<v[i]<<(i==n-1?"":" ");return os;}

int main(){
	string a, b, c;
  cin>>a>>b>>c;
  char d = 'A'-'a';
  a[0]+=d; b[0]+=d; c[0]+=d;
  cout<<a[0]<<b[0]<<c[0]<<endl;
	return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<stdlib.h>
#include<string.h>
#include<queue>
#define LL long long
using namespace std;
inline int read( )
{
  int sum=0;char c=getchar( );bool f=0;
  while(c<'0'||c>'9') {if(c=='-') f=1;c=getchar( );}
  while(c>='0'&&c<='9') {sum=sum*10+c-'0';c=getchar( );}
  if(f) return -sum;
  return sum;
}
const int N=200005;
const int INF=1000000005;
const int mod=1000000007;
int n,X,Y,c[N],w[N],mn[N];
struct ex{int num,next;}map[N*10];
int head[N],len;
inline void link(int x,int y)
{
  len++;map[len].num=y;map[len].next=head[x];head[x]=len;
  len++;map[len].num=x;map[len].next=head[y];head[y]=len;
}
LL jc[N],ny[N];
inline LL quick(LL a,int b)
{
  LL r=1,base=a;
  while(b)
    {
      if(b&1) r=r*base%mod;
      base=base*base%mod;
      b>>=1;
    }
  return r;
}
bool vis[N];
int inq[N],q[N],cs[N],cnt,tot;
inline void dfs(int k)
{
  vis[k]=1;int i,x=c[k];
  if(inq[x]!=cnt) inq[x]=cnt,q[++tot]=x,cs[x]=1;
  else cs[x]++;
  for(i=head[k];i;i=map[i].next)
    if(!vis[x=map[i].num]) dfs(x);
}
int main( )
{
  int i,j,x,y,a0=0,a1=0;
  n=read( );X=read( );Y=read( );w[0]=INF;
  for(i=1;i<=n;i++) 
    {
      j=c[i]=read( ),w[i]=read( );
      if(w[mn[j]]>w[i]) mn[j]=i;
    }
  for(i=1;i<=n;i++)
    {
      x=c[i];j=mn[x];
      if(i!=j) {if(w[i]+w[j]<=X) link(i,j);}
      else w[i]<w[a0]?a1=a0,a0=i:(w[i]<w[a1]?a1=i:0);
    }
  if(a0)
    {
      x=c[a0];j=w[a0];
      for(i=1;i<=n;i++)
	if(c[i]!=x&&w[i]+j<=Y) link(a0,i);
    }
  if(a1)
    {
      x=c[a1];j=w[a1];
      for(i=1;i<=n;i++)
	if(c[i]!=x&&w[i]+j<=Y) link(a1,i);
    }
  jc[0]=1;ny[0]=1;
  for(i=1;i<=n;i++) jc[i]=jc[i-1]*i%mod;
  ny[n]=quick(jc[n],mod-2);
  for(i=n;i>=1;i--) ny[i-1]=ny[i]*i%mod;
  LL ans=1,dn;
  for(i=1;i<=n;i++)
    {
      if(vis[i]) continue;
      cnt++;tot=0;dfs(i);
      dn=1;y=0;
      for(j=1;j<=tot;j++)
	x=cs[q[j]],dn=dn*ny[x]%mod,y+=x;
      ans=ans*jc[y]%mod;
      ans=ans*dn%mod;
    }
  printf("%lld",ans);
  return 0;
}

Measured memory_bytes: 18176
#include <iostream>
#include <vector>
#include <queue>
using namespace std;
bool b[16][16][16][16];
int d[16][16];
int main(){
    int n,gx,gy,p;
    cin>>n;
    while(n--){
        for(int i=0;i<16;i++)for(int j=0;j<16;j++)for(int k=0;k<16;k++)for(int l=0;l<16;l++)b[i][j][k][l]=0;
        for(int i=0;i<16;i++)for(int j=0;j<16;j++)d[i][j]=0;
        cin>>gx>>gy;
        cin>>p;
        for(int i=0;i<p;i++){
            int x1,y1,x2,y2;
            cin>>x1>>y1>>x2>>y2;
            b[y1][x1][y2][x2]=true;
            b[y2][x2][y1][x1]=true;
        }
        d[0][0]=1;
        for(int i=0;i<=gx;i++){
            for(int j=0;j<=gy;j++){
                if(i!=0)if(!b[j][i][j][i-1])d[j][i]+=d[j][i-1];
                if(j!=0)if(!b[j][i][j-1][i])d[j][i]+=d[j-1][i];
            }
        }
        if(d[gy][gx]==0){
            cout<<"Miserable Hokusai!"<<endl;
        }else{
            cout<<d[gy][gx]<<endl;
        }
    }
}

Measured memory_bytes: 3132
# 解説AC
N,K = map(int, input().split())

MOD = 10 ** 9 + 7

ans = 0
for k in range(K, (N + 1) + 1):
    MIN = k * (k - 1) // 2
    MAX = (2 * N - k + 1) * k // 2
    num = MAX - MIN + 1
    ans = (ans + num) % MOD

print(ans)

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

int main(){
  int H, W;
  cin >> H >> W;
  vector<vector<char>> a(100, vector<char>(101));
  vector<vector<char>> b(102, vector<char>(102));

  for(int i = 0; i < H; i++){
    for(int j = 0; j < W; j++){
      cin >> a.at(i).at(j);
    }
  }

  for(int i = 0; i < H+2; i++){
    for(int j = 0; j < W+2; j++){
      b.at(i).at(j) = '#';
    }
  }

  for(int i = 0; i < H; i++){
    for(int j = 0; j < W; j++){
      b.at(i+1).at(j+1) = a.at(i).at(j);
    }
  }

  for(int i = 0; i < H+2; i++){
    for(int j = 0; j < W+2; j++){
      cout << b.at(i).at(j);
    }
    cout << endl;
  }

  return 0;
}


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

using ll = long long int;
using node = pair<int, int>;

const int MAX = (int)(1e5 + 5);
const ll INF = (ll)(1e10 + 5);

int n, m;
map<node, vector<node>> graph;
int s, t;

map<node, int> path_map;

int ans;

int calc() {
  queue<node> que;
  set<node> visited;

  que.push(node(s, 0));
  path_map[node(s, 0)] = 0;
  visited.insert(node(s, 0));

  while (!que.empty()) {
    node cur_node = que.front(); que.pop();

    int cur_path = path_map[cur_node];

    for (node &next_node: graph[cur_node]) {
      if (visited.find(next_node) != visited.end()) continue;

      que.push(next_node);
      path_map[next_node] = cur_path + 1;
      visited.insert(next_node);
    }
  }

  return (path_map.find(node(t, 0)) == path_map.end()) ? -1 : path_map[node(t, 0)] / 3;
}

int main(void) {
  // Here your code !
  scanf("%d %d", &n, &m);

  for (int i = 0; i < m; ++i) {
    int u, v;
    scanf("%d %d", &u, &v);
    graph[node(u, 0)].push_back(node(v, 1));
    graph[node(u, 1)].push_back(node(v, 2));
    graph[node(u, 2)].push_back(node(v, 0));
  }

  scanf("%d %d", &s, &t);


  // for (auto &e: graph) {
  //   printf("(%d, %d): ", e.first.first, e.first.second);
  //   for (auto &d: e.second) {
  //     printf("(%d, %d) ", d.first, d.second);
  //   }
  //   printf("\n");
  // }

  ans = calc();

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

  return 0;
}


Measured memory_bytes: 66048
#include <algorithm>
#include <iostream>
#include <numeric>
#include <vector>
using namespace std;

int main() {
    int n;
    cin >> n;
    auto b = vector<int>(n - 1);
    for (auto &b_i : b)
        cin >> b_i;
    auto a_max = vector<int>(n);

    a_max.front() = b.front();
    a_max.back() = b.back();

    for (int i = 1; i < n - 1; i++)
        a_max[i] = min(b[i], b[i - 1]);

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


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

int main () {
  int n,t,a;
  cin >>n>>t>>a;
  vector<int>h(n);
  float anst;
  for (int i=0;i<n;i++){
    cin >>h[i];
  }

  anst =abs(a-(t-h[0]*0.006));
  int cnt=0;
  for (int i=0;i<n;i++){
    if(anst >=abs(a-(t-h[i]*0.006))){
      anst =abs(a-(t-h[i]*0.006));
      cnt =i;
    } 
  }
  cout <<cnt+1<<endl;
}


Measured memory_bytes: 256
#include<stdio.h>

int N, M;
int Height[100010];
int AnsTower[100010];

int A, B;

int answer = 0;

int main(void){

    for(int index=0; index<100010; index++){
        AnsTower[index] = 1;
    }

    scanf("%d%d", &N, &M);

    for(int index=0; index<N; index++){
        scanf("%d", &Height[index]);
    }

    for(int i=0; i<M; i++){

        scanf("%d%d", &A, &B);
        if(Height[A-1] > Height[B-1]){
            AnsTower[B-1] = 0;
        }else if(Height[A-1] < Height[B-1]){
            AnsTower[A-1] = 0;
        }else{
            AnsTower[A-1] = 0;
            AnsTower[B-1] = 0;
        }

    }

    for(int index=0; index<N; index++){
        answer += AnsTower[index];
        //printf("%d:%d\n", index, AnsTower[index]);
    }

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

    return 0;
} 

Measured memory_bytes: 2512
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <string>
#include <vector>
#include <math.h>
#include <queue>
#include <map>
#define ll long long
const int MOD = 1e9+7;
using namespace std;

int main(){
	int ans = 0;
	string s, t;
	cin >> s >> t;
	for (int i = 0; i < s.length(); i++){
		if (s[i] == t[i]) ans++;
	}
	cout << ans << endl;
	return 0;
}


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

#define CHOOSE(a) CHOOSE2 a
#define CHOOSE2(a0, a1, a2, a3, a4, x, ...) x
#define dump_1(x1) cerr << #x1 << ": " << x1 << endl
#define dump_2(x1, x2) \
  cerr << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << endl
#define dump_3(x1, x2, x3)                                                \
  cerr << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << ", " #x3 << ": " \
       << x3 << endl
#define dump_4(x1, x2, x3, x4)                                            \
  cerr << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << ", " #x3 << ": " \
       << x3 << ", " #x4 << ": " << x4 << endl
#define dump_5(x1, x2, x3, x4, x5)                                        \
  cerr << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << ", " #x3 << ": " \
       << x3 << ", " #x4 << ": " << x4 << ", " #x5 << ": " << x5 << endl
#define dump(...) \
  CHOOSE((__VA_ARGS__, dump_5, dump_4, dump_3, dump_2, dump_1, ~))(__VA_ARGS__)
#define check(s) cerr << s << endl

#define rep(i, n) for (int i = 0; i < n; i++)
#define repr(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int)(x).size())
#define unique(v) v.erase(unique(v.begin(), v.end()), v.end());
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)

using namespace std;

using ll = long long;

vector<int> dx = {0, 1, 0, -1};
vector<int> dy = {1, 0, -1, 0};

const ll LINF = 2e18;
const int INF = 1e9;

void solve(ll a, ll b, ll x) {
  ll p = (ll)ceil((double)a / x) * x;

  if (p < a || p > b) {
    cout << 0 << endl;
  } else {
    cout << (b - p) / x + 1 << endl;
  }
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(15);
  ll a;
  scanf("%lld", &a);
  ll b;
  scanf("%lld", &b);
  ll x;
  scanf("%lld", &x);
  solve(a, b, x);
  return 0;
}


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

using namespace std;

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

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

    for (int i = n - 1; i >= 0; i--) {
        cout << a[i];
        if (i > 0)
            cout << " ";
    }
    cout << endl;

    return 0;
}


Measured memory_bytes: 3084
import java.util.*;
public class Main{
	public static void main(String[] args){
      Scanner sc = new Scanner(System.in);
      String x = sc.next();
      if(x.equals("A"))System.out.println("T");
      if(x.equals("T"))System.out.println("A");
      if(x.equals("G"))System.out.println("C");
      if(x.equals("C"))System.out.println("G");
      sc.close();
    }
}


Measured memory_bytes: 20308
def coloring_dominoes(N: int, S1: str, S2: str)->int:
    MOD = 1000000007

    if S1[0] == S2[0]:
        offset = 1
        ret = 3
        before_dir = S1[0] == S2[0]
    else:
        offset = 2
        ret = 3 * 2
        before_dir = S1[0] == S2[0]

    i = offset
    while i < N:
        current_dir = S1[i] == S2[i]

        if before_dir and current_dir:
            ret *= 2
            i += 1
        elif before_dir and not current_dir:
            ret *= 2 * 1
            i += 2
        elif not before_dir and current_dir:
            ret *= 1
            i += 1
        else:
            ret *= 3
            i += 2

        ret %= MOD
        before_dir = current_dir

    return ret


if __name__ == "__main__":
    N = int(input())
    S1 = input()
    S2 = input()
    ans = coloring_dominoes(N, S1, S2)
    print(ans)


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

int main(void) {
	int N, K, sum = 0	; cin >> N >> K;
	int p[N]; for(int& pi: p) cin >> pi;
	sort(p, p + N);
	
	for(int i = 0;i < K;i++)
		sum += p[i];
		
	cout << sum << '\n';
}


Measured memory_bytes: 3596
#include <atcoder/maxflow>
#include <bits/stdc++.h>

using namespace std;

int n, m;
string grid[100];

int enc(int i, int j) {
    return i * m + j;
}

pair<int, int> dec(int x) {
    return make_pair(x / m, x % m);
}

int main() {
    cin >> n >> m;
    for (int i = 0; i < n; i++) {
        cin >> grid[i];
    }

    int s = n * m;
    int t = s + 1;

    atcoder::mf_graph<int> g(n * m + 2);

    for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
            if (grid[i][j] == '#') continue;

            int k = enc(i, j);

            if ((i + j) % 2) {
                g.add_edge(s, k, 1);
            } else {
                g.add_edge(k, t, 1);
            }

            if ((i + j) % 2 == 0) continue;

            if (i > 0 and grid[i - 1][j] == '.') {
                g.add_edge(k, enc(i - 1, j), 1);
            }

            if (i < n - 1 and grid[i + 1][j] == '.') {
                g.add_edge(k, enc(i + 1, j), 1);
            }

            if (j > 0 and grid[i][j - 1] == '.') {
                g.add_edge(k, enc(i, j - 1), 1);
            }

            if (j < m - 1 and grid[i][j + 1] == '.') {
                g.add_edge(k, enc(i, j + 1), 1);
            }
        }
    }

    int ans = g.flow(s, t);

    for (auto [from, to, cap, flow] : g.edges()) {
        if (from == s or to == t or flow != 1) continue;

        auto [i1, j1] = dec(from);
        auto [i2, j2] = dec(to);

        if (i1 != i2) {
            grid[i1][j1] = 'v';
            grid[i2][j2] = '^';
            if (i2 < i1) swap(grid[i1][j1], grid[i2][j2]);
        } else {
            grid[i1][j1] = '>';
            grid[i2][j2] = '<';
            if (j2 < j1) swap(grid[i1][j1], grid[i2][j2]);
        }
    }

    cout << ans << endl;
    for (int i = 0; i < n; i++) {
        cout << grid[i] << "\n";
    }

    return 0;
}

Measured memory_bytes: 5500
import java.util.*;
import java.lang.*;
import java.io.*;

class Main{

    public static class Pox{
	public int t,s,d;

	Pox(){
	    t = 0;
	    s = 0;
	    d = 0;
	}

    }

      public static void main(String args[])throws IOException
    {
	BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
	
	while(true)
	    {
		String line = in.readLine();
		int N,M;
		N = Integer.parseInt(line.substring(0,line.indexOf(" ")));
		M = Integer.parseInt(line.substring(line.indexOf(" ")+1));
		if(N == 0 && M == 0)
		    break;

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

		for(int i=0;i<M;i++)
		    {
			Pox input = new Pox();
			line = in.readLine();
			String[] elements = line.split(" ");
			input.t = Integer.parseInt(elements[0]);
			input.s = Integer.parseInt(elements[1]);
			input.d = Integer.parseInt(elements[2]);
			list.add(input);
		    }
		Collections.sort(list,new Comparator<Pox>(){
			@Override
			    public int compare(Pox a,Pox b)
			{
			    if(a.t > b.t)
				{
				    return 1;
				}
			    return -1; 		    

			}
		    });


		boolean[] infected = new boolean[20010];
		for(int i=0;i<=N;i++)
		    infected[i] = false;
		infected[1] = true;


	
		for(int i=0;i<M;i++)
		    {
	
			if(infected[list.get(i).s])
			    {
				infected[list.get(i).d] = true;
			    }
			
		    }

		int cnt = 0;
		for(int i=0;i<=N;i++)
		    if(infected[i])
			{
			    cnt++;
			}
		System.out.println(cnt);
	    }
 
    }
}

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

bool chek(char board[100 + 10], int len);

char name[25 + 10];
int nlen;

int main()
{
	int n;

	int i;

	//char name[25 + 10];
	//int nlen;

	char sboard[100 + 10];
	int blen;

	int ans = 0;

	cin >> n;

	cin >> name;
	nlen = strlen(name);

	for (i = 0; i < n; i++)
	{
		cin >> sboard;
		blen = strlen(sboard);

		if ( chek(sboard, blen) )
		{
			//cout << 'C' << i << endl;
			
			ans++;
		}
	}

	cout << ans << endl;

	return 0;
}


bool chek(char board[100+10], int len)
{
	int i, j, k;

	int nowlen=0;

	int t;

	for (i = 0; i < len; i++)
	{
		nowlen = 0;
		if (board[i] == name[nowlen])
		{
			//nowlen++;

			if (nowlen >= nlen)
			{
				return true;
			}

			for (j = i + 1; j < len; j++)
			{
				nowlen = 1;
				if (board[j] == name[nowlen])
				{
					k = j - i;
					t = j;

					nowlen = 2;

					//cout << 'A' << t << ' ' << k << endl;

					while (t + k < len && nowlen <nlen)
					{
						t += k;

						//cout << 'B' << t << endl;

						if (board[t] != name[nowlen])
						{
							break;
						}

						nowlen++;
					}
				}

				if (nowlen >= nlen)
				{
					return true;
				}
			}
		}
	}

	return false;
}

Measured memory_bytes: 3092
#include<bits/stdc++.h>
#define FOR0(i,n) for(i=0;i<n;i++)
#define FOR(i,j,n) for(i=j;i<n;i++)
#define FORD(i,j,k) for(i=j;i>=k;i--)
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define inf 1000000000
#define ninf -1000000000
#define endl '\n' 
#define she_told_me_dont_worry ios_base::sync_with_stdio (false) ; cin.tie(0) ; cout.tie(0) ;
// Use cout.flush() for interactive problems.
// Use this for increased stack size: g++ -o a.exe -Wl,--stack=256000000 -O2 source.cpp
inline long long  MAX2(long long  a, long long int b){return (a)>(b)?(a):(b);}
inline long long  MAX3(long long  a, long long  b,long long  c){return (a)>(b)?((a)>(c)?(a):(c)):((b)>(c)?(b):(c));}
inline long long  MIN2(long long  a, long long  b){return (a)<(b)?(a):(b);}
inline long long  MIN3(long long  a, long long b,long long c){return (a)<(b)?((a)<(c)?(a):(c)):((b)<(c)?(b):(c));}
using namespace std;
typedef long long ll;
typedef pair<int,int> ii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector< ii > vii;
int main()
{
    she_told_me_dont_worry
    ll k, a, b;
    cin>>k>>a>>b;
    if( a > k+1 )
    {
        cout<<k+1;
        return 0;
    }
    ll dif = k +1 - a;
    ll mul = MAX2(2, b-a);
    ll ex = (dif/2)*mul;
    if(dif%2!=0)
        ex += 1;
    cout<<(a+ex);
    cerr <<endl<< "Time elapsed : " << clock() * 1000.0 / CLOCKS_PER_SEC << " ms" << '\n';
}

Measured memory_bytes: 256
n , k = tuple(map(int, input().split()))
a = list(map(int, input().split()))

dp = [100000000000] * n
dp[0] = 0

for i in range(1, n):
  for j in range(1,k+1):
    if i - j >= 0:
      dp[i] = min(dp[i], dp[i - j] + abs(a[i-j]-a[i]))

print(dp[n-1])

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

int main(){
  vector<int> a(5);
  for(int i=0; i<5; ++i) cin >> a[i];
  int k; cin >> k;
  for(int i=0; i<4; ++i){
    for(int j=i+1; j<5; ++j){
      if(a[j] - a[i] > k){
        cout << ":(" << endl;
        return 0;
      }
    }
  }
  cout << "Yay!" << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main()
{
	int x,y,h,w,r;
	cin>>w>>h>>x>>y>>r;
	if(w-x>=r&&h-y>=r&&x>=0&&y>=0)
	cout<<"Yes"<<endl;
	else
	cout<<"No"<<endl;
	return 0;
}


Measured memory_bytes: 3116
import java.util.*;


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

        Scanner s = new Scanner(System.in);
        int money = s.nextInt();
        int cake = s.nextInt();
        int donut = s.nextInt();

        int rest = (money - cake) % donut;
        System.out.println(rest);
    }
}

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

int main()
{
  char c;
  cin >> c;
  
  string ans = "consonant";
  if (c == 'a' || c == 'e' || c == 'i'
      || c == 'o' || c == 'u') ans = "vowel";
  
  cout << ans << endl;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <iostream>
#include <algorithm>
#include <queue>
#include <stack>
#include <deque>
#include <climits>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
//#include <tuple>

#define INF INT_MAX>>1 
#define SIZE 100010
#define MOD 1000000007
#define rep(i, n) for(int i=0; i<(int)(n); i++)
#define rep2(i, from, to) for(int i=(from); i<(int)(to); i++)
#define all(obj) (obj).begin(), (obj).end()
#define lpair pair<ll, ll>
#define vint vector<ll>
#define vinput(name) for(int i=0; i<(int)(name.size()); i++) cin >> name[i];
#define voutput(name) for(int i=0; i<(int)(name.size()); i++) cout << name[i] << endl;
typedef long long ll;

using namespace std;

ll ans = 0;

int main(void){
	int n; cin >> n;
	vint a(n); vinput(a);

	rep(i, n){
		if(a[i] % 2 == 0){
			if(a[i]%3 == 0 || a[i]%5 == 0);
			else{
				cout << "DENIED" << endl;
				return 0;
			}
		}
	}
	cout << "APPROVED" << endl;
	return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<map>
#include<algorithm>
#include<set>

using namespace std;

int main()
{
    int n;
    string a, b, c;
    cin >> n >> a >> b >> c;

    int count = 0;
    for (int i = 0; i < n; i++) {
        set<char> abc;
        abc.insert(a[i]);
        abc.insert(b[i]);
        abc.insert(c[i]);
        if (abc.size() == 2) {
            count += 1;
        } else if (abc.size() == 3) {
            count += 2;
        }
    }

    cout << count << endl;
    
    return 0;
}


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

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define FOR(i,n,m) for(int i=(int)(n); i<=(int)(m); i++)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define RITR(x,c) for(__typeof(c.rbegin()) x=c.rbegin();x!=c.rend();x++)
#define setp(n) fixed << setprecision(n)

#define ld long double
#define ll long long
#define vll vector<ll>
#define vi vector<int>
#define pll pair<ll,ll>
#define pi pair<int,int>

#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define ins insert

using namespace std;

/* Some Libraries */

//-------------------------------------------------

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n; cin>>n;
    double ans;
    rep(i, n){
        int a; cin>>a;
        ans += (double)1/a;
    }
    ans = 1/ans;
    cout<<setp(9)<<ans<<"\n";
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <inttypes.h>

int cmp( const void *p, const void *q ) {
	return *(int*)p - *(int*)q;
}

int main(void){
	int n,m;
	long long int d[200000]={0},t[200000]={0};
	int i,j;
	int flag=1;

	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%lld",&d[i]);
	}
	scanf("%d",&m);
	for(i=0;i<m;i++){
		scanf("%lld",&t[i]);
	}
	qsort(d,n,sizeof(d[0]),cmp);
	qsort(t,m,sizeof(t[0]),cmp);
	for(i=0,j=0;i<m;){
		if(t[i]==d[j]){
			i++;
			j++;
		}else if(d[j]>t[i]){
			printf("NO");
			flag=0;
			break;
		}else{
			j++;
		}
	}
	if(flag==1){
		printf("YES");
	}

	return 0;
}


Measured memory_bytes: 4860
s=input()
n=len(s)
i=1
a=s[0]
count=1
while i<n-1:
    if s[i]==a:
        count+=1
        a=s[i:i+2]
        i+=2
    else:
        count+=1
        a=s[i]
        i+=1
if i==n-1:
    if s[i]!=a:
        count+=1
print(count)

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

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

	int res = 0;
	int n;

	cin >> n;

	for(int i=1;i<=n;i+=2)
	{
		int count = 0;
		for(int j=1;j<=sqrt(i);j++)
		{
			if(i%j==0)
			{
				if(i/j==j)
				{
					count++;
				}
				else
				{
					count+=2;
				}
			}
		}
		if(count==8)
		{
			res++;
		}
	}

	cout << res << '\n';

	return 0;	
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int INF = 1 << 28;

int main(){
  int N, M;
  int city[2][200][200];
  int dp[1000][200];
  int R, z[1000];

  while(cin >> N >> M, N){
    
    fill_n( **city, 2 * 200 * 200, INF);
    fill_n( *dp, 1000 * 200, INF);

    for(int i = 0; i < M; i++){
      int a, b, t;
      char c;
      cin >> a >> b >> t >> c;
      a--, b--;
      if(c == 'L'){
        city[0][a][b] = city[0][b][a] = t;
      }else{
        city[1][a][b] = city[1][b][a] = t;
      }
    }
    cin >> R;
    for(int i = 0; i < R; i++){
      cin >> z[i];
      z[i]--;
    }

    for(int l = 0; l < 2; l++){
      for(int k = 0; k < N; k++){
        city[l][k][k] = 0;
        for(int i = 0; i < N; i++){
          for(int j = 0; j < N; j++){
            city[l][i][j] = min( city[l][i][j], city[l][i][k] + city[l][k][j]);
          }
        }
      }
    }
    dp[0][z[0]] = 0;
    for(int i = 0; i < R - 1; i++){
      for(int j = 0; j < N; j++){ //船を止めてある場所
        if(dp[i][j] == INF) continue;
        for(int k = 0; k < N; k++){ //次船を止める場所
          if(j == k){
            dp[i + 1][k] = min( dp[i + 1][k], dp[i][j] + city[0][z[i]][z[i + 1]]);
          }else{
            dp[i + 1][k] = min( dp[i + 1][k], dp[i][j] + city[0][z[i]][j] + city[1][j][k] + city[0][k][z[i + 1]]);
          }
        }
      }
    }
    cout << *min_element( dp[R - 1], dp[R]) << endl;
  }
  return 0;
}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

#define _abs(x)((x) < 0 ? (x) * -1 : (x))
#define _max(x, y)(max(0, max((x), (y))))
#define _min(x, y)(max(0, min((x), (y))))

#define pb push_back
#define mp make_pair

static const ll MOD = 1e9 + 7;

int main()
{
    //freopen("in.txt", "r", stdin);
    //freopen("out.txt", "w", stdout);
    //freopen("debug.txt", "w", stderr);

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

    int h, w;

    cin >> h >> w;

    string grid[h];
    string ans[h];
    int bomb;

    int i, j;

    for (i = 0; i < h; i++) cin >> grid[i];

    for (i = 0; i < h; i++) {
        ans[i] = grid[i];

        for (j = 0; j < w; j++) {
            if (grid[i][j] == '.') {
                bomb = 0;

                if (0 <= i - 1 && 0 <= j - 1 && grid[i - 1][j - 1] == '#') bomb++;
                if (0 <= i - 1 && grid[i - 1][j] == '#') bomb++;
                if (0 <= i - 1 && j + 1 < w && grid[i - 1][j + 1] == '#') bomb++;
                if (0 <= j - 1 && grid[i][j - 1] == '#') bomb++;
                if (j + 1 < w && grid[i][j + 1] == '#') bomb++;
                if (i + 1 < h && 0 <= j - 1 && grid[i + 1][j - 1] == '#') bomb++;
                if (i + 1 < h && grid[i + 1][j] == '#') bomb++;
                if (i + 1 < h && j + 1 < w && grid[i + 1][j + 1] == '#') bomb++;

                ans[i].erase(j, 1);
                ans[i].insert(j, string(1, (char)(bomb + '0')));
            }
        }
    }

    for (i = 0; i < h; i++) cout << ans[i] << '\n';

    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
int main(void)
{
	int n, m, l, i, j, k;
	
	scanf("%d %d %d\n",&n, &m, &l);
	
	long A[n][m], B[m][l], C[n][l];
	for(i=0;i<n;i++){
		for(j=0;j<l;j++){
			C[i][j] = 0;
		}
	}
	
	//Aの読み込み
	for(i=0;i<n;i++){
		for(j=0;j<m;j++){
			scanf("%ld",&A[i][j]);
		}
	}
	//Bの読み込み
	for(i=0;i<m;i++){
		for(j=0;j<l;j++){
			scanf("%ld",&B[i][j]);
		}
	}
	//Cの計算
	for(i=0;i<n;i++){
		for(j=0;j<l;j++){
			for(k=0;k<m;k++){
				C[i][j] = A[i][k] * B[k][j] + C[i][j];
			}
		}
	}
	
	for(i=0;i<n;i++){
		for(j=0;j<l;j++){
			if(j==l-1)printf("%ld\n",C[i][j]);
			else printf("%ld ",C[i][j]);
		}
	}
	
	return 0;
}


Measured memory_bytes: 2060
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);

		String str1 = s.next();
		String str2 = s.next();

		int min1 = 1000;
		int max2 = 0;

		for (int i = 0; i < str1.length(); i++) {
			int strInt1 = (int) str1.charAt(i);
			min1 = Math.min(min1, strInt1);
		}

		for (int i = 0; i < str2.length(); i++) {
			int strInt2 = (int) str2.charAt(i);
			max2 = Math.max(max2, strInt2);
		}

		if ((min1 == max2)&&(str1.replace((char)min1 + "", "").length()==str2.replace((char)max2 + "", "").length())) {
			int count1 = replace(str1, (char) min1);
			int count2 = replace(str2, (char) max2);

			String ans = (count1 < count2) ? "Yes" : "No";
			System.out.println(ans);
			return;
		}else if(min1 == max2){
			System.out.println("No");
			return;
		}

		String ans = (min1 < max2) ? "Yes" : "No";
		System.out.println(ans);
	}

	static int replace(String str, char target) {
		return str.length() - str.replace(target + "", "").length();
	}
}


Measured memory_bytes: 21844
n = int(input())
h = [0] + list(map(int, input().split()))

dp = [0] * (n + 1)
dp[1] = 0
dp[2] = dp[1] + abs(h[2] - h[1])

for i in range(3, n + 1):
	dp[i] = min(dp[i - 2] + abs(h[i] - h[i - 2]),
				dp[i - 1] + abs(h[i] - h[i - 1]))

print(dp[n])

Measured memory_bytes: 52208
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <tuple>
#include <queue>
#include <bitset>
#include <unordered_map>
#include <tuple>
#include <utility>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <sys/time.h>

using namespace std;

void solve(long long N, vector<long long> x, vector<long long> y){
  if (N == 1) {
    std::cout << 1 << std::endl;
    return;
  }
  long long p, q;
  long long ans = 100000;
  long long sc;
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < N; j++) {
      if (i == j) {
        continue;
      }
      p = x[i] - x[j];
      q = y[i] - y[j];
      sc = N;
      for (int k = 0; k < N; k++) {
        for (int l = 0; l < N; l++) {
          if (k == l) {
            continue;
          }
          if (x[k] - p == x[l] && y[k] - q == y[l]) {
            sc--;
          }
        }
      }
      ans = min(sc, ans);
    }
  }
  std::cout << ans << std::endl;
}

int main(){
  long long N;
  scanf("%lld",&N);
  vector<long long> x(N);
  vector<long long> y(N);
  for(int i = 0 ; i < N ; i++){
    scanf("%lld",&x[i]);
    scanf("%lld",&y[i]);
  }
  solve(N, x, y);
  return 0;
}


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

int main() {
	int n, x;
	int m[1000];
	cin >> n >> x;
	for (int i = 1; i <= n; i++) {
		cin >> m[i];
	}
	
	//一個ずつ作る
	for (int i = 1; i <= n; i++){
		x -= m[i];
	}
	//cout << x << endl;
	//一番小さい数
	int dummy;
	dummy = m[1];
	for (int i = 2; i <= n; i++) {
		if (dummy > m[i]) {
			dummy = m[i];
		}
	}
	//cout << dummy << endl;
	//何個できるか
	int a;
	a = x / dummy;
	//cout << a << endl;
	a = a + n;
	cout << a << endl;
	
	return 0;
	system("pause");
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <utility>
#include <algorithm>
#include <queue>
#include <cmath>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<n;i++)
#define MP make_pair
#define PB push_back
ll inf = (1LL)<<60;

ll dp[100001][20];


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n,m;
    cin >> n >> m;
    vector<ll> t(n);
    rep(i,n)cin >> t[i];
    vector<vector<pair<int,ll> > >g(n);
    rep(i,m){
        int a,b;
        ll c;
        cin >> a >> b >> c;
        a--;
        b--;
        g[a].PB(MP(b,c));
        g[b].PB(MP(a,c));
    }
    priority_queue<pair<ll,pair<ll,int> >,vector<pair<ll,pair<ll,int> > >,greater<pair<ll,pair<ll,int> > > >pq;
    pq.push(MP((ll)0,MP((ll)0,0)));
    vector<int> parent(n);
    parent[0]=-1;
    vector<pair<ll,ll>  > place(n,MP(inf,inf));
    place[0] = MP(0,0);
    while(!pq.empty()){
        auto xxxxxxxx = pq.top();
        pq.pop();
        auto x = xxxxxxxx.first;
        auto y = xxxxxxxx.second.first;
        auto p = xxxxxxxx.second.second;
        if(make_pair(x,y) > place[p]) continue;
        for(auto& e : g[p]){
            if(MP(x+e.second,y+1)>place[e.first])continue;
            if(MP(x+e.second,y+1)==place[e.first]){
                if(t[parent[e.first]]>t[p]){
                    parent[e.first] = p;
                    pq.push(MP(x+e.second,MP(y+1,e.first)));
                }
            }else{
                place[e.first] = MP(x+e.second,y+1);
                parent[e.first] = p;
                pq.push(MP(x+e.second,MP(y+1,e.first)));
            }
        }
    }
    rep(i,n){
        rep(j,20){
            dp[i][j] = -1;
        }
    }
    rep(i,n){
        dp[i][0] = parent[i];
    }
    rep(j,19){
        rep(i,n){
            if(dp[i][j]>=0){
                dp[i][j+1] = dp[dp[i][j]][j];
            }
        }
    }
    int k;
    cin >> k;
    rep(i,k){
        int a,b;
        ll c;
        cin >> a >> b >> c;
        a--;
        ll ans = 0;
        ans = place[a].first;
        if(place[a].second<=b){
            cout << max(0LL,ans-c) << endl;
        }else{
            int now = a;
            int d = place[a].second-b;
            for(int i = 20; i>=0; i--){
                if(d < (1 << i)) continue;
                now = dp[now][i];
                d -= (1<<i);
            }
            cout << ans - min(place[now].first,c) << endl;
        }
    }

    return 0;
}


Measured memory_bytes: 50812
n, m = [int(_) for _ in input().split()]
a = [0] * (n + 1)
for i in range(m):
    l, r = [int(_) for _ in input().split()]
    a[l - 1] += 1
    a[r] -= 1
s = [0] * (n + 1)
for i in range(n):
    s[i + 1] = s[i] + a[i]
ans = 0
for i in range(len(s)):
    if s[i] == m:
        ans += 1
print(ans)

Measured memory_bytes: 46808
H, W = map(int, input().split())
S = [input() for _ in range(H)]

r = [[0] * W for _ in range(H)]
l = [[0] * W for _ in range(H)]
u = [[0] * W for _ in range(H)]
d = [[0] * W for _ in range(H)]

for i in range(H):
    for j in range(W):
        if j == 0 and S[i][0] == '.':
            l[i][j] = 1
        elif S[i][j] == '.':
            l[i][j] = l[i][j-1] + 1
    for j in range(W-2, -1, -1):
        if S[i][j] == '.' and S[i][j+1] == '.':
            r[i][j] = r[i][j+1] + 1
for j in range(W):
    for i in range(H):
        if i == 0 and S[0][j] == '.':
            u[i][j] = 1
        elif S[i][j] == '.':
            u[i][j] = u[i-1][j] + 1
    for i in range(H-2, -1, -1):
        if S[i][j] == '.' and S[i+1][j] == '.':
            d[i][j] = d[i+1][j] + 1
m = 0
for i in range(H):
    for j in range(W):
        tmp = l[i][j] + r[i][j] + u[i][j] + d[i][j] - 1
        if tmp > m:
            m = tmp
print(m)

Measured memory_bytes: 179816
#include <iostream>
#include <vector>
using namespace std;
 
struct st {int from, to;};
vector<st> v;

int main() {
    int m, n, a, b;
    cin >> m >> n;
 
    int c[21];
	fill(c, c+21, 0);
    for (int i = 0;i < n;i++) {
        cin >> a >> b;
        v.push_back((st){a, b});
        c[b]++;
    }
 
    for (int i = 0;i < m;i++) {
        for (int j = 1;j <= m;j++) {
            if (c[j] == 0) {
                cout << j << endl;
            	c[j] = (1 << 10);
                for (int k = 0;k < n;k++) {
                    c[v[k].to] -= (v[k].from == j);
                }
                break;
            }
        }
    }
    return 0;
}

Measured memory_bytes: 3164