akhauriyash/Code-Regression huggingface dataset:
W,H,N = map(int,input().split())
lst = [list(map(int,input().split())) for i in range(N)]

#print(W,H,N)
#print(lst)
#lst = sorted(lst, key=lambda x: x[2])
#print(lst)
Wst = [1]*W
Hst = [1]*H
for i in range(N):
    if lst[i][2] == 1:
        for j in range(lst[i][0]):
            Wst[j] = 0
    if lst[i][2] == 2:
        #print(lst[i][0],W)
        for j in range(lst[i][0],W):
            Wst[j] = 0
    if lst[i][2] == 3:
        for j in range(lst[i][1]):
            Hst[j] = 0
    if lst[i][2] == 4:
        #print(lst[i][0],W)
        for j in range(lst[i][1],H):
            Hst[j] = 0
    
#print(Wst,Hst)
print(sum(Wst)*sum(Hst))

Measured memory_bytes: 9184
/*
    -ensure correct output format
    -ensure printing required output
    -reread the problem statement
  */

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll>pll;
typedef pair<ll,pair<ll,ll>>plll;
#define fastread() (ios_base:: sync_with_stdio(false),cin.tie(NULL));
#define vll(v) v.begin(),v.end()
#define all(x) x.rbegin(),x.rend()
#define min3(a, b, c)   min(a, min(b, c))
#define max3(a, b, c)   max(a, max(b, c))
#define F first
#define S second
#define in  freopen("input.txt", "r", stdin)
#define out  freopen("output.txt", "w", stdout)
#define minheap int,vector<int>,greater<int>
#define pb push_back
#define eb emplace_back
#define ischar(x)  (('a' <= x && x <= 'z') || ('A' <= x && x <= 'Z'))
#define isvowel(ch) ((ch=='a'||ch=='e'||ch=='i'||ch=='o'||ch=='u')||(ch=='A'|| ch=='E' || ch=='I'|| ch=='O'|| ch=='U'))
#define bug cout<<"BUG"<<endl;
const int Max = 2e6 + 10;
const int Mod = 1e9 + 7;
const double PI  =3.141592653589793238463;
bool compare(const pair<ll,ll> &a, const pair<ll,ll> &b)
{
       return (a.first > b.first);
}
ll lcm(ll a,ll b)
{
    if(a==0 || b==0)return 0;

    return a/__gcd(a,b)*b;
}

void input(ll ara[],ll n)
{
    for(ll i=0; i<n; i++)cin>>ara[i];
}
void print(ll ara[],ll n)
{
    for(ll i=0; i<n; i++)
        cout<<ara[i]<<" ";
    cout<<endl;
}


int main()
{

   fastread();

   ll i,j,n,m,p,a,sum=0,k,t,b,c,d,cnt=0,q,l,r,ans=0;

      bool flag=false;

      string str;

      cin>>a>>b>>c;

      a-=b;

      cout<<c-min(c,a)<<endl;













}



Measured memory_bytes: 3600
#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <cwchar>
#include <cwctype>
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <array>
#include <atomic>
#include <chrono>
#include <codecvt>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rep2(i, n) for(int i = 1; i <= (int)(n); i++)
using namespace std;
typedef int64_t ll;
typedef long double ld;
const ll INF=(1LL<<62);
const double inf=pow(10,10);
const ld pi=acosl(1);
const ll mod = 1000000007;
const int dx[4]={0,1,0,-1};
const int dy[4]={1,0,-1,0};
const int ddx[8]={1,0,-1,-1,-1,0,1,1};
const int ddy[8]={1,1,1,0,-1,-1,-1,0};

int main(){
	ll N;cin>>N;
	set<ll>se;
	rep(i,N){
		ll A;cin>>A;
		se.insert(A);
	}
	if(N==se.size())cout<<"YES"<<endl;
	else cout<<"NO"<<endl;
}


Measured memory_bytes: 9600
#include<iostream>
#include<vector>
#include<math.h>
using namespace std;
#define EPS (1e-10)
#define equals(a,b) (fabs((a)-(b))<EPS)

#define FOR(k,m,n) for(int (k)=(m);(k)<(n);(k)++)
#define REP(i,n) FOR((i),0,(n))


//???

//???
class Point{
public:
	double x, y;
	//?????????????????????
	Point(int x_=0.0,int y_=0.0):x(x_),y(y_){}
	
	//??????????????????????????????
	Point operator + (Point &p) { return Point(x + p.x, y + p.y); }
	Point operator - (Point &p) { return Point(x - p.x, y - p.y); }
	Point operator * (double k) { return Point(x * k, y * k); }
	Point operator / (double k) { return Point(x / k, y / k); }

	bool operator  < (const Point &p)const {
		return x!=p.x ? x<p.x : y<p.y;
	}
	bool operator == (const Point &p)const {
		return fabs(x-p.x)<EPS && fabs(y-p.y)<EPS;
	}

	//??¢??°
	double norm() { return x*x + y*y; }
	double abs() { return sqrt(norm()); }

};
typedef Point Vector;        //????????????
struct Segment{Point p1,p2;};//??????
typedef Segment Line;        //??´???

//???
class Circle {
public:
	Point center;
	double r;
	//?????????????????????
	Circle(Point c_=Point(),double r_=0.0):center(c_),r(r_){}
};
typedef vector<Point> Polygon;//????§???¢??????????????????



//??¢??°????????????

//?????????????????¢??°??????
namespace VFunc {
	//??????
	double dot(Vector a, Vector b) { return a.x*b.x + a.y*b.y; }
	//??????
	double cross(Vector a, Vector b) { return a.x*b.y - a.y*b.x; }
	//??´?????????????¨????
	bool isOrthogonal(Vector a, Vector b) { return equals(dot(a, b), 0.0); }
	bool isOrthogonal(Point a1,Point  a2, Point b1,Point b2) {return isOrthogonal(a1-a2,b1-b2);}
	bool isOrthogonal(Segment s1, Segment s2) { return equals(dot(s1.p2 - s1.p1, s2.p2 - s2.p1), 0.0); }
	//????????????????¨????
	bool isParallel(Vector a, Vector b) { return equals(cross(a, b), 0.0); }
	bool isParallel(Point a1, Point  a2, Point b1, Point b2) {return isParallel(a1 - a2, b1 - b2);}
	bool isParallel(Segment s1, Segment s2) {return equals(cross(s1.p2 - s1.p1, s2.p2 - s2.p1), 0.0);}

}
//??????????????¨??????
int q;
Point p[4];

int main() {
	cin>>q;
	REP(i,q){
		REP(j, 4)cin >> p[j].x >> p[j].y;
		if      (VFunc::isParallel  (p[0], p[1], p[2], p[3])) cout << "2" << endl;
		else if (VFunc::isOrthogonal(p[0], p[1], p[2], p[3])) cout << "1" << endl;
		else                                                  cout << "0" << endl;
	}
}

Measured memory_bytes: 3228
#include <algorithm>
#include <cassert>
#include <climits>
#include <iostream>
#include <vector>
#include <queue>
#include <functional>
using namespace std;

#define FOR(i, k, n) for (int i = (k); i < (int)(n); ++i)
#define REP(i, n) FOR(i, 0, n)

typedef pair<int, int> pii;
typedef priority_queue<pii, vector<pii>, less<pii>> PQL;
typedef priority_queue<pii, vector<pii>, greater<pii>> PQG;

vector<int> assignment;
vector<pii> points;
PQL maxQueue[3][4];
PQG minQueue[3][4];

int f(const pii& p, int k) {
  static const int dx[] = {-1, -1, 1, 1};
  static const int dy[] = {1, -1, 1, -1};
  return p.first * dx[k] + p.second * dy[k];
}

void assign(int p, int j) {
  assignment[p] = j;
  REP(k, 4) {
    maxQueue[j][k].push(make_pair(f(points[p], k), p));
    minQueue[j][k].push(make_pair(f(points[p], k), p));
  }
}

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

  int n; cin >> n;
  points.resize(n);
  REP(i, n) cin >> points[i].first >> points[i].second;

  int answer = INT_MAX;
  for (int dir = 0; dir < 2; ++dir) {
    assignment.assign(n, -1);
    REP(i, 3) REP(j, 4) maxQueue[i][j] = PQL(), minQueue[i][j] = PQG();

    REP(i, n) REP(k, 4) {
      maxQueue[0][k].push(make_pair(f(points[i], k), i));
      minQueue[0][k].push(make_pair(f(points[i], k), i));
    }

    while (!maxQueue[0][0].empty()) {
      int maxDist = -1, argMaxJ = -1, argMaxK = -1;
      REP(j, 3) {
        if (maxQueue[j][0].empty()) continue;
        REP(k, 4) {
          int dist = maxQueue[j][k].top().first - minQueue[0][k].top().first;
          if (dist > maxDist) {
            maxDist = dist;
            argMaxJ = j;
            argMaxK = k;
          }
        }
      }

      if (argMaxJ == 0) {
        int p[2] = { maxQueue[0][argMaxK].top().second, minQueue[0][argMaxK].top().second };
        int maxDist[2] = {-1, -1};
        REP(l, 2) FOR(j, 1, 3) REP(k, 4) {
          auto& pt = points[p[(l + j - 1) % 2]];
          int maxV = (maxQueue[j][k].empty() ? INT_MIN : maxQueue[j][k].top().first);
          int minV = (minQueue[j][k].empty() ? INT_MAX : minQueue[j][k].top().first);
          maxDist[l] = max(maxDist[l], max(maxV, f(pt, k)) - min(minV, f(pt, k)));
        }

        int r = (maxDist[0] < maxDist[1]) ? 0 : 1;
        if (dir == 1) r = 1 - r;
        assign(p[0], r + 1);
        assign(p[1], 2 - r);
      } else {
        assign(minQueue[0][argMaxK].top().second, 3 - argMaxJ);
      }

      REP(k, 4) {
        while (!maxQueue[0][k].empty() && assignment[maxQueue[0][k].top().second] != -1)
          maxQueue[0][k].pop();
        while (!minQueue[0][k].empty() && assignment[minQueue[0][k].top().second] != -1)
          minQueue[0][k].pop();
      }
    }

    int ans = -1;
    FOR(j, 1, 3) REP(k, 4)
      ans = max(ans, maxQueue[j][k].top().first - minQueue[j][k].top().first);
    answer = min(answer, ans);
  }
  cout << answer << endl;
}

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

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
using vi = vector<int>;
using vvi = vector<vi>;

int N, M;

int main()
{
  cin >> N >> M;
  vvi AdjList(N);
  REP( i, M ) {
    int a, b; cin >> a >> b;
    a--; b--;
    AdjList[a].push_back(b);
    AdjList[b].push_back(a);
  }
  
  vector<bool> Visited(N, false);
  int member = 0, ans = 0;
  REP( i, N ) {
    if( Visited[i] ) continue;
    member = 1; Visited[i] = true;
    
    queue<int> que; que.push(i);
    while( !que.empty() ) {
      int u = que.front(); que.pop();
      REP( j, AdjList[u].size() ) {
        int v = AdjList[u][j];
        if( !Visited[v] ) {
          member++; Visited[v] = true;
          que.push(v);
          //cout << v << endl;
        }
      }
    }
    ans = max(ans, member);
  }
  cout << ans;
}

Measured memory_bytes: 14900
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define REP(i,n) for (int64_t i=0; i<(n); ++i)
#define P pair<int,int>
using ll=int64_t;
using namespace std;
#define ketasuu(n) fixed<<setprecision(n)
#define btoe(p) p.begin(),p.end()
#define etob(p) p.rbegin(),p.rend()


int main(){
    vector<int> primes(1e5+5,1);
    for(int i=3; i<1e5+5; ++i){
        for(int j=2; j*j<=i; ++j){
            if(i%j==0){
                primes[i]=j;
            }
        }
    }
    vector<int> candi(1e5+5,0);
    for(int i=3; i<1e5+5; ++i){
        candi[i]=candi[i-1];
        if(primes[i]==1){
            if(i%2==1 && primes[(i+1)/2]==1){
                candi[i]++;
            }
        }
    }
    int qqq; cin>>qqq;
    rep(qqqqq,qqq){
        int l,r; cin>>l>>r;
        cout<<candi[r]-candi[l-1]<<endl;
    }
    return 0;
}

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

using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
typedef pair<ll, ll> Pll;
typedef vector<int> Vi;
typedef tuple<int, int, int> T;
#define FOR(i,s,x) for(int i=s;i<(int)(x);i++)
#define REP(i,x) FOR(i,0,x)
#define ALL(c) c.begin(), c.end()
#define MP make_pair
#define DUMP( x ) cerr << #x << " = " << ( x ) << endl
#define fst first
#define snd second

#define MAX_V 100010
#define MAX_LOG_V 20

vector<int> edge[MAX_V];
int parent[MAX_LOG_V][MAX_V];
int depth[MAX_V];

struct LCA{
  int root;

  LCA(int r): root(r){}

  void add_edge(int a, int b) {
    edge[a].push_back(b);
    edge[b].push_back(a);
  }
  
  void dfs(int v, int par, int dep) {
    parent[0][v] = par;
    depth[v] = dep;
    for (auto child : edge[v]) {
      if (child != par) dfs(child, v, dep + 1);
    }
  }

  void init(int V) {
    dfs(root, -1, 0);
    for (int k = 0; k + 1 < MAX_LOG_V; k++) {
      for (int v = 0; v < V; v++) {
	if (parent[k][v] < 0) {
	  parent[k+1][v] = -1;
	} else {
	  parent[k+1][v] = parent[k][parent[k][v]];
	}
      }
    }
  }

  int lca(int u, int v) {
    if (depth[u] > depth[v]) swap(u, v);
    for (int k = 0; k < MAX_LOG_V; k++) {
      if ((depth[v] - depth[u]) >> k & 1) {
	v = parent[k][v];
      }
    }
    if (u == v) return u;
    for (int k = MAX_LOG_V - 1; k >= 0; k--) {
      if (parent[k][u] != parent[k][v]) {
	u = parent[k][u];
	v = parent[k][v];
      }
    }
    return parent[0][u];
  }
};

int main() {
  int N;
  LCA lca(0);
  
  scanf("%d", &N);
  REP(i, N) {
    int k;
    cin >> k;
    REP(j, k) {
      int c;
      cin >> c;
      lca.add_edge(i, c);
    }
  }
  lca.init(N);
  int Q;
  cin >> Q;
  REP(i, Q) {
    int u, v;
    cin >> u >> v;
    cout << lca.lca(u, v) << endl;
  }
  return 0;
}

Measured memory_bytes: 17524
#include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000
#define int long long
int N, A, B, C, D;

int check(int m) {
    int left = C * (N - 1 - m) - D*m;
    int right = -C*m + (N - 1 - m) * D;
    return ((left <= B - A) && (B - A <= right));
}


signed main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> N >> A >> B >> C >> D;
    rep(i, N) {
        if (check(i)) {
            cout << "YES" << endl;
            return 0;
        }
    }
    cout << "NO" << endl;

    return 0;
}


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

typedef long long ll;

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    
    int n, m;
    cin >> n >> m;
    int a[n];
    int sum = 0;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        sum += a[i];
    }
    double cond = sum/(4.0*m);
    int count = 0;
    for (int i = 0; i < n; i++) {
        if (a[i] >= cond) {
            count++;
        }
    }
    cout << (count >= m ? "Yes" : "No");
}


Measured memory_bytes: 3580
#include <iostream>
#include <cmath>
#include <utility>
#include <queue>
#include <stack>
#include <algorithm>
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define vii vector < pair<int,int> >
#define pii pair<int,int>
const int INF=1e9+2;
const int eps=1e-9;
using namespace std;

int main(){
    int h, w, r, c, cnt, ans;
    char temp;
    bool grid[1002][1002];
    cin>>h>>w;
    queue<pair< pii, int> > bfs;
    for (int i=1; i<=h; i++){
        for (int j=1; j<=w; j++){
            cin>>temp;
            if (temp=='#'){
                grid[i][j]=1;
                bfs.push(pair<pii,int>(pii(i,j),0));
            }
            else grid[i][j]=0;
        }
    }
    while (!bfs.empty()){
        r=bfs.front().fi.fi;
        c=bfs.front().fi.se;
        cnt=bfs.front().se;
        bfs.pop();
        if (cnt!=0 && (r<1 || r>h || c<1 || c>w || grid[r][c])) continue;
        ans=cnt;
        //cout<<r<<c<<cnt<<endl;
        grid[r][c]=1;
        bfs.push(pair<pii,int>(pii(r+1,c),cnt+1));
        bfs.push(pair<pii,int>(pii(r,c+1),cnt+1));
        bfs.push(pair<pii,int>(pii(r,c-1),cnt+1));
        bfs.push(pair<pii,int>(pii(r-1,c),cnt+1));
    }
    cout<<ans;
//    for (int i=1; i<=h; i++){
//        for (int j=1; j<=w; j++){
//            cout<<grid[i][j];
//        }
//        cout<<endl;
//    }
}


Measured memory_bytes: 49608
#include <iostream>
#include <cstring>
#define nmax 10005
using namespace std;
const int mod = 1e9 + 7;

long long dp[nmax][2][105];
int n, d;
string s;

long long solve(int pos, int eq, int rest)
{
    if(pos == n) {
        if (rest == 0)
            return 1;
        return 0;
    }
    if(dp[pos][eq][rest] != -1)
        return dp[pos][eq][rest];
    int lim;
    long long tot = 0;

    if (eq)
        lim = s[pos] - '0';
    else
        lim = 9;

    for(int i = 0; i <= lim; i++)
        tot += solve(pos + 1, eq && (i == lim), (rest + i) % d );

    tot %= mod;
    if (tot < 0)
        tot += mod;
    dp[pos][eq][rest] = tot;

    return tot;

}

int main()
{
    cin >> s;
    cin >> d;
    n = s.size();

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

    long long ans = solve(0,1,0) - 1;

    if (ans < 0)
        ans += mod;

    cout << ans << endl;

    return 0;

}

Measured memory_bytes: 17408
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <vector>

// Acknowledgement: Special thanks to kyomukyomupurin, who developed this
// template.
template <class T, class U>
std::ostream& operator<<(std::ostream& os, const std::pair<T, U>& p) {
  return os << '(' << p.first << ", " << p.second << ')';
}

template <class T>
std::ostream& operator<<(std::ostream& os, const std::vector<T>& vec) {
  int n = 0;
  for (auto e : vec) os << (n++ ? ", " : "{") << e;
  return os << (n ? "}" : "{}");
}

template <class T>
std::ostream& operator<<(std::ostream& os, const std::set<T>& st) {
  int n = 0;
  for (auto e : st) os << (n++ ? ", " : "{") << e;
  return os << (n ? "}" : "{}");
}

template <class T, class U>
std::ostream& operator<<(std::ostream& os, const std::map<T, U>& mp) {
  int n = 0;
  for (auto e : mp) os << (n++ ? ", " : "{") << e;
  return os << (n ? "}" : "{}");
}

template <class T>
std::istream& operator>>(std::istream& is, std::vector<T>& vec) {
  for (T& e : vec) is >> e;
  return is;
}

#ifdef LOCAL
#define debug(...) \
  std::cerr << "[" << #__VA_ARGS__ << "]: ", debug_out(__VA_ARGS__)
#else
#define debug(...)
#endif

void debug_out() { std::cerr << '\n'; }

template <class Head, class... Tail>
void debug_out(Head&& head, Tail&&... tail) {
  std::cerr << head;
  if (sizeof...(Tail) != 0) std::cerr << ", ";
  debug_out(std::forward<Tail>(tail)...);
}
using namespace std;
using int64 = long long;

class combination {
 public:
  static constexpr int64 divide_by = (int64)1e9 + 7;
  combination(int64 MAX) : fac(MAX), finv(MAX), inv(MAX) {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++) {
      fac[i] = fac[i - 1] * i % divide_by;
      inv[i] = divide_by - inv[divide_by % i] * (divide_by / i) % divide_by;
      finv[i] = finv[i - 1] * inv[i] % divide_by;
    }
  }

  int64 get_comb(int n, int k) {
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % divide_by) % divide_by;
  }

 private:
  vector<int64> fac, finv, inv;
};

int main() {
  int N, P;
  cin >> N >> P;
  vector<int> A(N);
  cin >> A;
  int ev = 0;
  int od = 0;
  for (int i = 0; i < N; i++) {
    if (A[i] % 2 == 1)
      od++;
    else
      ev++;
  }
  combination comb(101);
  int64 sm_even = pow(2LL, ev);
  int64 sm_odd = 0;
  if (P == 0) {
    if (od % 2 == 1) {
      for (int i = 0; i <= od - 1; i = i + 2) {
        sm_odd += comb.get_comb(od, i);
      }
    } else {
      for (int i = 0; i <= od; i = i + 2) {
        sm_odd += comb.get_comb(od, i);
      }
    }
  } else {
    if (od % 2 == 1) {
      for (int i = 1; i <= od; i = i + 2) {
        sm_odd += comb.get_comb(od, i);
      }
    } else {
      for (int i = 1; i <= od - 1; i = i + 2) {
        sm_odd += comb.get_comb(od, i);
      }
    }
  }
  debug(sm_odd, sm_even);
  cout << sm_odd * sm_even << endl;
  return 0;
}

Measured memory_bytes: 3964
#include<iostream>
using namespace std;
const int maxn=1e5+100;
int a[maxn];
int main()
{
	int n,x;
	cin>>n;
	for(int i=1;i<=n;i++)
	{
		cin>>x;
		a[x]=i;
	}
	for(int i=1;i<=n;i++)cout<<a[i]<<' ';
	return 0;
}

Measured memory_bytes: 1152
from fractions import gcd
from datetime import date, timedelta
from heapq import*
import math
from collections import defaultdict, Counter, deque
import sys
from bisect import *
import itertools
import copy
sys.setrecursionlimit(10 ** 7)
MOD = 10 ** 9 + 7


def main():
    n, m = map(int, input().split())
    s = list(input())[::-1]

    now = 0
    ansl = []
    while now != n:
        tm = min(n - now, m)
        pnow = now
        while tm > 0 and now+tm < len(s):
            if s[now + tm] == "0":
                now += tm
                ansl.append(tm)
                break
            else:
                tm -= 1
        
        if pnow == now:
            print(-1)
            exit()
        

    ansl = ansl[::-1]
    for i in range(len(ansl)):
        if ansl[i] == 0:
            continue
        print(*ansl[i:])
        exit()
    print(-1)


if __name__ == '__main__':
    main()


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

	typedef long long ll;
	using namespace std;

	int main(){
		char a;
		//acgt
		cin >> a;
		if(a == 'A'){
			cout << "T";
		}else if(a == 'C'){
			cout << "G";
		}else if(a == 'G'){
			cout << "C";
		}else{
			cout << "A";
		}
		return 0;
	}

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

int main() {
    int H, W;

    while (std::cin >> H >> W, H || W) {
        for (int i = 0; i < H; ++i) {
            std::cout << std::string(W, '#') << std::endl;
        }

        std::cout << std::endl;
    }
}


Measured memory_bytes: 3152
<?php
$input_line = trim(fgets(STDIN));
$array = [];

for ($i = 0; $i < $input_line; $i++) {
    $s = trim(fgets(STDIN));
    $s = str_replace(array("\r\n","\r","\n"), '', $s);
    $s = explode(" ", $s);
    $array[] = $s[0];
}

rsort($array);

$result = 1;
$num = $array[0];

for ($i = 1; $i < $input_line; $i++) {
  	if ($num > $array[$i]) {
    	$num = $array[$i];
        $result += 1;
    } else {
    	continue;
    }
}

echo $result;
?>

Measured memory_bytes: 3576
using System;
using System.Collections.Generic;
using System.Linq;

class Program
{
    static void Main()
    {
        Solve();
    }

    static void Solve()
    {
        var ab = Console.ReadLine().Split().Select(int.Parse).ToArray();
        if(1 <= ab[0] && ab[0] <= 9 && 1 <= ab[1] && ab[1] <= 9)
        {
            Console.WriteLine(ab[0] * ab[1]);
        } else
        {
            Console.WriteLine("-1");
        }
        
    }
}



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

using namespace std;

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

int main(){
    while(1){
        int h, w;
        cin >> h >> w;
        if(!h && !w)return 0;

        rep(i,h){
            rep(j,w){
                if((i + j) % 2)printf(".");
                else printf("#");
            }
            cout << endl;
        }
        cout << endl;
    }
    return 0;
}



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

#define int long long
#define counter(m)     for(int i=0;i<m;i++)
#define gcd            __gcd
#define endl           "\n"
#define pb             emplace_back
#define setbits(x)     __builtin_popcountll(x)
#define zrobits(x)     __builtin_ctzll(x)
#define mod            1000000007
#define mod2           998244353
#define maxe           *max_element
#define mine           *min_element
#define inf            1e18
#define deci(x, y)      fixed<<setprecision(y)<<x
#define w(t)           int t; cin>>t; while(t--)
#define nitin          ios_base::sync_with_stdio(false); cin.tie(NULL)
#define PI             3.141592653589793238
using namespace std;

int32_t main() {
    nitin;
    string s;
    int k;
    cin>>s>>k;
    int n=s.length();
    vector<int>v(26,0);
    for(auto c:s)
    {
        v[c-'a']++;
    }
    int cnt=0;
    for(auto c:v)
        if(c!=0)
            cnt++;
        if(cnt==1)
        {
            cout<<(n*k)/2<<endl;
        }
        else{



            char c=s[0];
            int pref=0;
            int i;
            for(i=0;i<n;i++)
            {
                if(s[i]==c)
                    pref++;
                else
                    break;
            }
            char d=s[n-1];
            int suff=0;
            int j;
            for(j=n-1;j>=0;j--)
            {
                if(s[j]==d)
                    suff++;
                else
                    break;
            }
            int ans=0;
            int temp=1;
            for(int q=i+1;q<=j;q++)
            {
                if(s[q]==s[q-1])
                    temp++;
                else
                {
                    ans+=(temp/2)*k;
                    temp=1;
                }
            }
            ans+=(temp/2)*k;
            if(c==d)
            {
                ans+=(pref)/2;
                ans+=suff/2;
                ans+=((pref+suff)/2)*(k-1);
            }
            else{
                ans+=(pref/2)*k;
                ans+=(suff/2)*k;
            }
            cout<<ans<<endl;
        }
    return 0;
}

Measured memory_bytes: 3604
(defmacro input []
  (do (read-line)
      (clojure.string/split (read-line) #"\s")))

(defn HinaArare [Ss]
  (case (-> Ss distinct count)
    3 "Three"
    4 "Four"))

(-> (input)
  HinaArare
  println)

Measured memory_bytes: 66172
#include <iostream>
#include <vector>
#include <queue>
#include <stack>
#include <string>
#include <algorithm>
#include <functional>
#include <unordered_map>
#include <map>

using namespace std;
int med(vector<int> a)
{
	sort(a.begin(), a.end());

	if (a.size() % 2 != 0)
		return a[a.size() / 2];

	return (a[(a.size() - 1) / 2] + a[a.size() / 2]) / 2;
}

long long calcSadness(vector<int> all, int b)
{
	long long ans{ 0 };
	for (int i = 0; i < all.size(); i++)
	{
		ans += abs(all[i] - (b + i + 1));
	}

	return ans;
}//

int main() 
{
	int N;
	cin >> N;
	vector<int> all;
	for (int i=0 ;i <N;i++)
	{
		int t;
		cin >> t;
		all.push_back(t);
	}
	vector<int> temp;
	for (int i = 1; i <= N; i++)
	{
		temp.push_back(all[i - 1] - i);
	}

	long long ans = min(calcSadness(all, med(temp)), calcSadness(all, med(temp)+1));

	cout << ans;

}

Measured memory_bytes: 5108
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
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 rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(vec) vec.begin(),vec.end()
typedef long long ll;
typedef pair<ll,ll> pll;
typedef pair<int,int> pii;
const ll mod=1e9+7;
const int inf=1<<30;

int main(){
  string s; cin >> s;
  if(s[2]==s[3]&&s[4]==s[5]){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
  
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
#define repr(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define invrepr(i,a,b) for(int i=b-1;i>=a;i--)
#define invrep(i,n) invrepr(i,0,n)
#define repitr(itr,a) for(auto itr=a.begin();itr!=a.end();++itr)
#define P pair<int,int>
const int MOD=998244353;
const int INF=2e9;
const double PI=acos(-1);


int main() {
    ios_base::sync_with_stdio(false);

    int n;
    cin >> n;
    int ans=0;
    rep(i,n) {
        int a;
        cin >> a;
        if (i%2==0 && a%2==1) ++ans;
    } 
    cout << ans << endl;
     
    return 0;   
}

Measured memory_bytes: 3580
import math
a,b,deg=map(float,input().split())
rad=math.radians(deg)
s=(a*b*math.sin(rad))/2
c=math.sqrt(a**2+b**2-2*a*b*math.cos(rad))
h=2*s/a
print("%.10f %.10f %.10f"%(s,a+b+c,h))


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

constexpr int64_t mod = 1000000007;

int64_t power(int64_t n, int64_t k) {
  if (k == 0) return 1;
  int64_t res = power(n * n % mod, k / 2);
  if (k % 2) res = res * n % mod;
  return res;
}

int primes(int64_t n) {
  int res = 0;
  for (int64_t i = 2; i * i <= n; i++) {
    int k = 0;
    while (n % i == 0) {
      n /= i;
      k++;
    }
    if (k >= 2) return 0;
    res += k;
  }
  if (n > 1) {
    res++;
  }
  if (res % 2 == 0) {
    return 1;
  } else {
    return mod - 1;
  }
}

int main() {
  int64_t n, k, ans = 0;
  cin >> n >> k;
  vector<int64_t> c(k + 1);
  for (int i = 1; i <= k; i++) {
    c.at(i) = power(k / i, n);
  }
  for (int i = 1; i <= k; i++) {
    for (int j = 1; j * j <= i; j++) {
      if (i % j == 0) {
        ans += j * c.at(i) % mod * primes(i / j);
        ans %= mod;
        if (j * j != i) {
          ans += i / j * c.at(i) % mod * primes(j);
          ans %= mod;
        }
      }
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 3948
#include <stdio.h>
#include <stdlib.h>
#define MAX 2000001
#define VMAX 10000

int main(){
  unsigned short *A, *B;
  int C[VMAX+1];
  int n, i, j;

  scanf("%d", &n);

  A = malloc(sizeof(short)*n+1);
  B = malloc(sizeof(short)*n+1);

  /* your code */
  for(i=0; i<=VMAX;i++)C[i]=0;
  
  for(i=0; i<n; i++){
    scanf("%hu",&A[i+1]);
    C[A[i+1]]++;
  }
  
  for(i=1; i<= VMAX; i++)C[i]=C[i] + C[i-1];

  for(j=1; j<=n;j++){
    B[C[A[j]]] = A[j];
    C[A[j]]--;
  }
  
  for(i=1;i<=n;i++){
    if(i >= 2) printf(" ");
    printf("%d",B[i]);
  }
  printf("\n");
    return 0;
}



Measured memory_bytes: 9584
/*suri_kumkaran*/

#include <bits/stdc++.h>

using namespace std;

#define UB upper_bound
#define LB lower_bound
#define BS binary_search
#define MP make_pair
#define EB emplace_back
#define endl "\n"
#define PI 3.1415926535897932384626433832795
#define MOD 1000000007
#define F first
#define S second
#define ALL(a) (a).begin(),(a).end()
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define int long long

typedef long long int64;
typedef vector<int> VI64;
typedef vector<pair<int,int>> VII64;
typedef vector<string> VS;
typedef vector<vector<int>> VVI;

int32_t main()
{
    IOS;
    int T=1;
    //cin>>T;
    while(T--)
    {
        int n,m;
        cin>>n>>m;
        int ans=0;
        ans+=(n-1)*n;
        ans+=(m-1)*m;
        cout<<ans/2;
    }

    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

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

    int A = scanner.nextInt();
    int B = scanner.nextInt();
    int C = scanner.nextInt();

    if (A+B >= C ) {
      System.out.println("Yes");
    } else {
      System.out.println("No");
    }
  }

}

Measured memory_bytes: 23252
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <algorithm>
#include <set>
#include <map>
#include <bitset>
#include <cmath>
#include <functional>
#define vv(a, b, c, d) vector<vector<d> >(a, vector<d>(b, c))
#define vvi vector<vector<int> >
#define vvl vector<vector<ll> >
#define vll vector<ll>
#define rep(a, b, c) for(ll c=a;c<b;c++)
#define re(b, c) for(ll c=0;c<b;c++)
typedef long long int ll;
typedef long double ld;
using namespace std;

int main(int argc, char const *argv[]) {
  ll k;std::cin >> k;
  vector<ll> num(50, 49);
  for(int i=0;i<k%50;i++){
    num[i] += 50;
    for(int j=0;j<50;j++){
      if(i==j) continue;
      num[j]--;
    }
  }
  for(int i=0;i<50;i++) num[i]+=k/50;
  std::cout << 50 << '\n';
  for(int i=0;i<50;i++) std::cout << num[i] << (i==49?"\n":" ");
  return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
using namespace std;
 
int main(){
    char chs[]=" ',-.?ABCDEFGHIJKLMNOPQRSTUVWXYZ";
    string codes[32]={
        "101","000000","000011","10010001","010001","000001","100101","10011010"
        ,"0101","0001","110","01001","10011011","010000","0111","10011000"
        ,"0110","00100","10011001","10011110","00101","111","10011111","1000"
        ,"00110","00111","10011100","10011101","000010","10010010","10010011","10010000"};
 
    string s;
    while(getline(cin,s)){
        string t;
        for(int i=0;i<s.size();i++){
            t += codes[find(chs,chs+32,s[i])-chs];
        }
        if(t.size()%5)t.append(5-t.size()%5,'0');
        for(int i=0;i<t.size();i+=5){
            int n=0;
            for(int j=0;j<5;j++)n = n<<1|t[i+j]-'0';
            if(n<26)cout<<(char)('A'+n);
            else cout<<" .,-'?"[n-26];
        }
        cout<<endl;
    }
    return 0;
}

Measured memory_bytes: 3120
#include <stdio.h>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <iterator>
#include <assert.h>
#pragma warning(disable:4996) 
 
typedef long long ll;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))
#define LINF 9223300000000000000
#define INF 2140000000
const long long MOD = 1000000007;
//const long long MOD = 998244353;

using namespace std;

char str[25][25];
ll d[405][405];

int dx[4]={1,-1,0,0};
int dy[4]={0,0,1,-1};

int main(int argc, char* argv[])
{
    int h,w;
    scanf("%d%d", &h, &w);
    int i,j;
    for(i=0; i<h; i++) {
        scanf("%s", str[i]);
    }

    int n=h*w;
    for(i=0; i<n; i++) {
        for(j=0; j<n; j++) {
            if(i!=j) d[i][j]=INF;
        }
    }
#define P(i,j) (i)*w+(j)
    int k;
    for(i=0; i<h; i++) {
        for(j=0; j<w; j++) {
            if(str[i][j]=='.') {
                for(k=0; k<4; k++) {
                    int i2=i+dx[k];
                    int j2=j+dy[k];
                    if(i2<0 || i2>=h || j2<0 || j2>=w) continue;
                    if(str[i2][j2]=='.') {
                        d[P(i,j)][P(i2,j2)]=1;
                    }
                }
            }
        }
    }

    {
        //ワーシャルフロイド
        for(int k = 0; k < n; ++k)
            for(int i = 0; i < n; ++i)
                for(int j = 0; j < n; ++j) d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
    }

    ll ans=0;
    for(i=0; i<n; i++) {
        for(j=0; j<n; j++) {
            if(d[i][j]<INF)
            ans=MAX(ans,d[i][j]);
        }
    }
    printf("%lld\n", ans);


    return 0;
}




Measured memory_bytes: 1408
#include<iostream>
#include<cstdio>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<cstring>
using namespace std;
typedef long long ll;
int parent[100010],n,m,sum;
//parent数组存储的是每个强盗的父亲即boss、sum用来记录犯罪团伙的数量
void Init() //初始化
{
    for(int i = 1;i <= n;i++)
        parent[i] = i;
    return;
}
int get_boss(int v)
{
    if(parent[v] == v)
        return v;
    else
    {
        //路径压缩(使搜索祖宗的过程中，路径中搜索的结点的父亲的变为祖宗)
        parent[v] = get_boss(parent[v]);
        return parent[v];
    }
}
void Merge(int v,int u)
{
    int t1 = get_boss(v);
    int t2 = get_boss(u);
    parent[t2] = t1;
    return;
}
void solve(int T)
{
    cin >> n >> m;
    Init();
    for(int i=1;i<=m;i++)
    {
        int u,v;
        cin>>u>>v;
        Merge(u,v);
    }
    int cnt=0;
    for(int i=1;i<=n;i++)
    {
        if(parent[i]==i) cnt++;
    }
    cout << cnt-1;
}



signed main()
{
    int t=1;
    //scanf("%d",&t);
    for(int i=1;i<=t;i++)
    {
        solve(i);
    }
    return 0;
}

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

int main() {
  int H, W, D;
  cin >> H >> W >> D;
  vector<vector<int>> A(H + 1, vector<int>(W + 1));
  for (int i = 1; i <= H; ++i)
    for (int j = 1; j <= W; ++j)
      cin >> A[i][j];
  int Q;
  cin >> Q;
  vector<int> L(Q + 1), R(Q + 1);
  for (int i = 1; i <= Q; ++i)
    cin >> L[i] >> R[i];

  vector<pair<int, int>> a(H * W + 1);
  for (int i = 1; i <= H; ++i)
    for (int j = 1; j <= W; ++j)
      a[A[i][j]] = make_pair(i, j);

  vector<int> sum(H * W + 1);
  for (int i = 0; i < D; ++i)
    for (int j = i + D; j <= H * W; j += D)
      sum[j] += sum[j - D] + abs(a[j].first - a[j - D].first) +
                abs(a[j].second - a[j - D].second);

  for (int i = 1; i <= Q; ++i)
    cout << sum[R[i]] - sum[L[i]] << endl;
}

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

using i64=int64_t;

#define rep(i,x,y) for(i64 i=i64(x),i##_max_for_repmacro=i64(y); i<i##_max_for_repmacro; ++i)
#define debug(x) #x << "=" << (x)
 
#ifdef DEBUG
#define _GLIBCXX_DEBUG
#define print(x) std::cerr << debug(x) << " (L:" << __LINE__ << ")" << std::endl
#else
#define print(x)
#endif
 
const int inf=1.01e9;
const i64 inf64=4.01e18;
const double eps=1e-9;
 
template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec){
    os << "[";
    for (const auto &v : vec) {
        os << v << ",";
    }
    os << "]";
    return os;
}

void solve(){
    string S_,T;
    cin >> S_ >> T;

    string inf_str(100,max('?','z')+1),ans=inf_str;
    rep(i,0,S_.size()){
        if(i+T.size()>S_.size()) continue;
        bool ok=true;
        rep(j,0,T.size()) if(S_[i+j]!=T[j] and S_[i+j]!='?'){
            ok=false;
            break;
        }
        if(!ok) continue;

        auto S=S_;
        rep(j,0,T.size()) S[i+j]=T[j];
        for(char &ch:S) if(ch=='?') ch='a';

        ans=min(ans,S);
    }

    if(ans==inf_str) cout << "UNRESTORABLE" << endl;
    else cout << ans << endl;

}

int main(){
    std::cin.tie(0);
    std::ios::sync_with_stdio(false);
    cout.setf(ios::fixed);
    cout.precision(16);
    solve();
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define INF 2e9
using namespace std;
typedef long long llong;
typedef long double ldouble;

using Graph = vector<vector<int>>;

int main(){
  string S;
  cin >> S;
  for(int i=0; i<S.length(); ++i) cout << 'x';
  cout << endl;
}

Measured memory_bytes: 256
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <iostream>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <fstream>
#include <numeric>
#include <iomanip>
#include <bitset>
#include <list>
#include <stdexcept>
#include <functional>
#include <utility>
#include <ctime>
#include <random>
#include <cassert>
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
#define MEM(a,b) memset((a),(b),sizeof(a))
const LL INF = 1e9 + 7;
const int N = 1e5 + 10;
class UnionFind
{
public:
	int p[N];
	void init(int n = N)
	{
		memset(p, -1, sizeof(int) * n);
	}
	int treesize(int x)
	{
		return -p[Find(x)];
	}
	int Find(int x)
	{
		int s = x;
		while (p[s] >= 0) s = p[s];
		while (x != s)
		{
			int t = p[x];
			p[x] = s;
			x = t;
		}
		return s;
	}
	void Union(int x, int y)
	{
		int px = Find(x);
		int py = Find(y);
		if (p[px] > p[py]) swap(px, py);
		p[px] += p[py];
		p[py] = px;
	}
} uf;
int main()
{
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	int n, m;
	cin >> n >> m;
	uf.init();
	for (int i = 1; i <= m; i++)
	{
		int x, y, w;
		cin >> x >> y >> w;
		if (uf.Find(x) != uf.Find(y))
			uf.Union(x, y);
	}
	int ans = 0;
	for (int i = 1; i <= n; i++)
	{
		if (uf.Find(i) == i)
			ans++;
	}
	cout << ans << endl;
	return 0;
}

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

using namespace std;

int main()
{
    int N,R=0,R1=0,ans=1000000;
    cin>>N;
    vector<int>W(N);
    for(int i=0;i<N;i++){
        cin>>W[i];
        R+=W[i];
    }
    reverse(W.begin(),W.end());
    for(int i=0;i<N;i++){
        R1+=W[i];
        R-=W[i];
        ans=min(ans,abs(R1-R));
    }
    cout<<ans<<endl;


}

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

using namespace std;

const int maxn = 500000 + 10;

char s[maxn];
short int a[maxn];
int len;

bool check(int val) {
	int sum = val * 9, s = 0;
	for(int i = 0; i < len; ++i) {
		sum = sum + a[i]; 
		s += sum % 10; 
		sum /= 10;
	}
	while(sum) {
		s += sum % 10; 
		sum /= 10;
	}
	return s <= val * 9;
}

int main() {
	scanf("%s", s);
	len = strlen(s);
	reverse(s, s + len);
	for(int i = 0; i < len; ++i) a[i] = (s[i] - '0') * 9;
	for(int i = 0; i < len; ++i) a[i + 1] += a[i] / 10, a[i] %= 10;
	if(a[len]) ++len;

	int l = 0, r = len * 2;
	while(r - l > 1) {
		int mid = (l + r) >> 1;
		check(mid) ? r = mid : l = mid;
	}

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


Measured memory_bytes: 1664
s = str(input())
L = [0] * len(s)
cnt = 0
flag = 0
for i in range(len(s)):
    if flag == 0:
        cnt += 1
        if s[i] == 'R':
            continue
        else:
            L[i-1] += cnt // 2
            L[i] +=  cnt // 2 + cnt % 2
            l = i - 1
            r = i
            cnt = 0
            flag = 1
    else:
        if s[i] == 'L':
            cnt += 1
            if i == len(s) - 1:
                L[l] += cnt // 2 + cnt % 2
                L[r] += cnt // 2 
        else:
            L[l] += cnt // 2 + cnt % 2
            L[r] += cnt // 2
            cnt = 1
            flag = 0
print(*L)


Measured memory_bytes: 6400
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <bitset>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <numeric>
#include <iostream>
#include <iomanip>
#include <string>
#include <chrono>
#include <random>
#include <cmath>
#include <cassert>
#include <climits>
#include <cstring>
#include <cstdlib>
#include <functional>
#include <sstream>

using namespace std;


int main(int argc, char** argv) {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(12);

    vector<string> S{"AC", "WA", "TLE", "RE"};

    int n;
    cin >> n;
    map<string, int> cnts;
    for (int i = 0; i < n; ++i) {
        string s;
        cin >> s;
        cnts[s] += 1;
    }

    for (auto s : S) {
        cout << s << " x " << cnts[s] << '\n';
    }

    return 0;
}

Measured memory_bytes: 3624
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n=sc.nextInt();
		int m=sc.nextInt();
		int Q=sc.nextInt();
		
		int[][] se=new int[n+1][n+1];		
		for(int i=0;i<m;i++){
			int l=sc.nextInt();
			int r=sc.nextInt();
			se[l][r]++;
		}
		
		int[][] s_se=new int[n+1][n+1];
		int[][] ss_se=new int[n+1][n+1];
		for(int i=1;i<=n;i++){
			for(int j=1;j<=n;j++){
				s_se[i][j]=se[i][j]+s_se[i][j-1];
			}
		}
		for(int i=1;i<=n;i++){
			for(int j=1;j<=n;j++){
				ss_se[i][j]=s_se[i][j]+ss_se[i-1][j];
			}
		}
		
		for(int i=0;i<Q;i++){
			int p=sc.nextInt();
			int q=sc.nextInt();			
			System.out.println(ss_se[q][q]-ss_se[p-1][q]-ss_se[q][p-1]+ss_se[p-1][p-1]);
		}		
	}
}


Measured memory_bytes: 155860
#include <iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<set>
#include<queue>
#include<map>
#define debug(a) cout << "*" << a << "*" << endl
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
int n, m, mod = 12805;
int x, a[85][85], b[85][85];
bool dp[2][85][12805];
int main()
{   
	while (scanf("%d%d", &n, &m) != EOF)
	{
		memset(a, 0, sizeof(a));
		memset(b, 0, sizeof(b));
		memset(dp, 0, sizeof(dp));
		dp[0][1][0] = true;
		for (int i = 1; i <= n; i++)
		{
			for (int j = 1; j <= m; j++)
			{
				scanf("%d", &a[i][j]);
			}
		}
		for (int i = 1; i <= n; i++)
		{
			for (int j = 1; j <= m; j++)
			{
				scanf("%d", &x);
				a[i][j] = abs(a[i][j] - x);
				b[i][j] = a[i][j] + max(b[i - 1][j], b[i][j - 1]); 
			}
		}
		for (int i = 1; i <= n; i++)
		{
			memset(dp[i & 1], 0, sizeof(dp[i & 1]));
			for (int j = 1; j <= m; j++)
			{
				for (int k = 0; k <= max(b[i - 1][j], b[i][j - 1]); k++)
				{
					if (dp[(i + 1) & 1][j][k] || dp[i & 1][j - 1][k])
					{
						dp[i & 1][j][abs(a[i][j] - k)] = true;
						dp[i & 1][j][abs(a[i][j] + k)] = true;
					}
				}
			}
		}
		int i;
		for (i = 0; i < mod; i++)
		{
			if (dp[n & 1][m][i])	break;
		}
		printf("%d\n", i);
	}
}


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

int main() {

    string S,T;
    bool ans = true;

    cin >> S >> T;

    for (int i=0; i<S.size();i++){
        if (S.at(i)!=T.at(i)){
            ans = false;
            break;
        }
        
    }
    if (ans){
            cout << "Yes" << endl;
    }
    else
            cout << "No" << endl;
}


Measured memory_bytes: 3628
#include<stdio.h>

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


Measured memory_bytes: 128
retu = int(input())
gyo1 = list(map(int,input().split()))
gyo2 = list(map(int,input().split()))
goal=[]
for i in range(retu):
    kai = sum(gyo1[0:i+1]) + sum(gyo2[i:])
    goal.append(kai)
print(max(goal))

Measured memory_bytes: 3060
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cctype>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <functional>
#include <iomanip>
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...);
}
#ifndef ONLINE_JUDGE
#define show(...) cerr << "[" << #__VA_ARGS__ << "] :", debug_out(__VA_ARGS__)
#else
#define show(...) 42
#endif
#define ff first
#define ss second
#define endl "\n"
#define pb push_back
#define  oo 1e15
#define limit 1000000007
#define two pair<int,int>
#define ll long long int
#define int long long int
#define double long double
#define mod(x,m) ((x%m+m)%m)
#define all(v) v.begin(),v.end()
#define max3(x,y,z) max(x,max(y,z))
#define min3(x,y,z) min(x,min(y,z))
#define fori(x,n) for(int i = x; i < n; i++)
#define forj(y,m) for(int j = y; j < m; j++)
#define fork(z,p) for(int k = z; k < p; k++)
#define speedforces std::ios::sync_with_stdio(false)
#define input_from_file  freopen("input.txt", "r", stdin);
#define output_to_file  freopen("output.txt", "w", stdout);

double dp[3005][3005];

signed main(){
  //input_from_file;
  int n; cin>>n;
  memset(dp,0,sizeof dp);
  vector<double> ph(n+1);
  for(int i=1;i<=n;i++) cin>>ph[i];
  dp[0][0] = 1;
  for(int i=1;i<=n;i++) dp[i][0] = dp[i-1][0]*(1-ph[i]);
  for(int i=1;i<=n;i++)
  for(int nh=1;nh<=n;nh++) {
    dp[i][nh] = dp[i-1][nh-1]*ph[i] + dp[i-1][nh]*(1-ph[i]);
  }
  double ans = 0;
  for(int i=1;i<=n;i++) if(2*i > n) ans += dp[n][i];
  cout<<fixed<<setprecision(10)<<ans<<endl;
}


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

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

x, y = input().split()
if ord(x) < ord(y):
    print('<')
elif ord(x) == ord(y):
    print('=')
else:
    print('>')

Measured memory_bytes: 65520