akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define endl '\n';
#define rep(i,n) for(int i=0; i<(n); i++)
using namespace std;
using ll = long long;
using P = pair<int,int>;
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("Ofast")
constexpr ll INF = 1e18;
constexpr int inf = 1e9;
constexpr double INFD = 1e100;
constexpr ll mod = 1000000007;
constexpr ll mod2 = 998244353;
const double PI = 3.1415926535897932384626433832795028841971;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
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; }
// ios::sync_with_stdio(false);
// cin.tie(nullptr);
// ---------------------------------------------------------------------------

int main(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int N,p;
  cin >> N >> p;
  while(N != 0){
    vector<int> cnt(N,0);
    int pos = 0;
    while(1){
      if(p == 1){
        int temp = pos;
        temp++;
        bool fin = true;
        while(temp != pos){
          temp %= N;
          if(cnt[temp]) fin = false;
          temp++;
          temp %= N;
        }
        if(fin){
          cout << pos << endl;
          break;
        }
      }
      if(p == 0){
        p += cnt[pos];
        cnt[pos] = 0;
      }else{
        p--;
        cnt[pos]++;
      }
      pos++;
      pos %= N;
    }
    cin >> N >> p;
  }
  return 0;
}


Measured memory_bytes: 3028
#include<iostream>
using namespace std;
void insertionSort(int a[], int n){
  for(int i = 0; i < n; i++){
    int v = a[i], j = i - 1;
    while(j >= 0 && a[j] > v){
      a[j+1] = a[j];
      j--;
    }
    a[j+1] = v;
    
    for(int k = 0; k < n; k++){
      if(k != n-1) cout << a[k] << " ";
      else         cout << a[k] << "\n";
    }
    
  }
}

int main(){
  int n;
  cin >> n;
  int a[n];
  for(int i = 0; i < n; i++) cin >> a[i];
  insertionSort(a,n);
  return 0;
}

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

using ll = long long;
using ld = long double;

ll h, w;

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

  cin >> h >> w;
  if(h % 3 == 0 || w % 3 == 0) {
    cout << 0 << '\n';
    return 0;
  }
  ll ans = min(h, w);
  for(int lol = 0; lol < 2; lol++) {
    for(int i = 1; i < h; i++) {
      ll l1 = 1LL * i * w;
      ll l2 = 1LL * (h - i) * (w / 2);
      ll l3 = 1LL * (h - i) * w - l2;
      ll mn = min(l1, min(l2, l3));
      ll mx = max(l1, max(l2, l3));
      ans = min(ans, mx - mn);
    }
    swap(h, w);
  }
  cout << ans << '\n';
  return 0;
}

Measured memory_bytes: 3652
#include <bits/stdc++.h> //JuniorMonster a.k.a Sho10
#define ll long long
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#define all(a) (a).begin(), (a).end()
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define sz size
#define f first
#define s second
#define pb push_back
#define er erase
#define in insert
#define mp make_pair
#define pi pair
#define rc(s) return cout<<s,0
#define mod 1000000007
#define PI 3.14159265359
#define CODE_START  ios_base::sync_with_stdio();cin.tie();cout.tie();
using namespace std;
ll n,x=-1;
string s,a[5]={"dream","dreamer","erase","eraser"},ans;
int32_t main(){
CODE_START;
cin >> s;
n=s.size();
reverse(s.begin(),s.end());
for(ll i=0;i<4;i++)
    reverse(a[i].begin(),a[i].end());
for(ll i=0;i<n;i++){
    x=-1;
    for(ll j=0;j<4;j++)
    {
            ans=a[j];
            if(s.substr(i,ans.size())==ans){
            x=1;
          i=i+ans.size()-1;
            }
    }
        if(x==-1){
            rc("NO");
        }
    }
    cout << "YES";
}



Measured memory_bytes: 512
import java.util.Scanner;
class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		boolean b = a -700 == a%100 
				||  a%100 - 70 == a % 10
				||  a%10 -7 == 0;
		if (b) System.out.println("Yes");
		else System.out.println("No");
	}
}


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

using namespace std;

int main(){
  int l, r, d;
  cin >> l >> r >> d;
  int count = 0;
  for ( int i = l; i <= r; i++){
    if( i % d == 0){count++;}
  }
  cout << count << endl;
  return 0;
  
}

Measured memory_bytes: 3556
#include<iostream>
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<cstring>
#include<string>
using namespace std;
bool Prime(int x){
	for(int i=2;i*i<=x;i++)if(!(x%i))return 0;
	return 1;
}
int main(){
	int x,i;
	cin>>x;
	for(i=x;!Prime(i);i++);
	cout<<i<<endl;
}

Measured memory_bytes: 256
while 1:
 a=[list(map(int,input()))for _ in[0]*8]
 y=[sum(r)for r in a]
 x=[sum(c)for c in zip(*a)]
 print('B'if 4 in x else'C'if 4 in y else'DF'[a[y.index(1)][x.index(2)]]if 1 in y else'GE'[a[y.index(2)][x.index(1)]]if 1 in x else'A')
 try:input()
 except:break


Measured memory_bytes: 5612
#include<bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
#define FastIO      ios_base::sync_with_stdio(0);cin.tie(0),cout.tie(0)
#define pb          push_back
#define inf         2e9+5
#define mp          make_pair
#define ll          long long
#define pii         pair<int,int >
#define fileout     freopen("output.txt","w",stdout)
#define filein      freopen("input.txt","r",stdin)
#define mem(x,i)    memset(x,i,sizeof x)
#define PI          acos(-1.0)
#define ff          first
#define ss          second
#define all(x)      x.begin(),x.end()
#define Case(t)     for(int ks=1;ks<=t;ks++)
#define sf          scanf
#define pf          printf
/*------------------------------Graph Moves----------------------------*/
const int fx[]= {+1,-1,+0,+0};
const int fy[]= {+0,+0,+1,-1};
//const int fx[]={+0,+0,+1,-1,-1,+1,-1,+1};   // Kings Move
//const int fy[]={-1,+1,+0,+0,+1,+1,-1,-1};  // Kings Move
//const int fx[]={-2, -2, -1, -1,  1,  1,  2,  2};  // Knights Move
//const int fy[]={-1,  1, -2,  2, -2,  2, -1,  1}; // Knights Move
/*---------------------------------------------------------------------*/
using namespace std;
//using namespace __gnu_pbds;
//
//template <typename T>  using orderedSet =
//    tree<T, null_type, less<T>,
//    rb_tree_tag, tree_order_statistics_node_update>;//find_by_order,order_of_key
//

ll dp[2020][2020];
const int mod=1000000007;
void nCr()
{
    for(int i=0;i<=2008;i++)
    {
        for(int j=0;j<=i;j++)
        {
            if(j==0 || j==i) dp[i][j]=1;
            else dp[i][j]=(dp[i-1][j-1]+dp[i-1][j])%mod;
        }
    }
}

bool vis[1000006];
int main()
{
    int n,n2;
    cin>>n;n2=n;
    vector<pii>adj[30];
    int lg=log2(n);
    int edge=0;
    for(int i=2;i<=lg+1;i++)
    {
        adj[i-1].pb({i,0});
        adj[i-1].pb({i,(1<<(i-2))});
        edge+=2;
    }

    for(int i=0;i<lg;i++)
    {
        if(n &(1<<i))
        {
            adj[i+1].pb({lg+1,n2-(1<<i)});
            n2-=(1<<i);
            edge++;
        }
    }
    cout<<lg+1<<' '<<edge<<endl;
    for(int i=0;i<30;i++)
    {
        for(pii p:adj[i])
        {
            cout<<i<<' '<<p.ff<<' '<<p.ss<<endl;
        }
    }
}


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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
using P = pair<ll, ll>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
#define ALL(obj) (obj).begin(), (obj).end()
#define MOD 1000000007
#define INF 1000000000

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

	ll A, B;
	ll ans = 0;

	cin >> A >> B;

	if (A >= 13) {
		ans = B;
	}
	else if (A >= 6 && A <= 12) {
		ans = B / 2;
	}
	else {
		ans = 0;
	}

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

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

int main()
{
    int N, match_counts = 0;
    string S;
    cin >> N >> S;
    string match = "ABC";

    for (int i = 0; i + 2 < N; i++)
    {
        if (match == S.substr(i, match.size()))
        {
            match_counts++;
            //i += match.size();
        }
    }

    cout << match_counts << endl;
    return 0;
}

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

int main() {
  int n;
  cin >> n;
  vector<P> red(n), blue(n);
  rep(i, n) {
    int a, b;
    cin >> a >> b;
    red[i] = P(a, b);
  }
  rep(i, n) {
    int a, b;
    cin >> a >> b;
    blue[i] = P(b, a);
  }
  sort(all(red));
  reverse(all(red));
  sort(all(blue));
  rep(i, n) blue[i] = P(blue[i].second, blue[i].first);
  int ans = 0;
  for(auto rp : red) {
    int rx = rp.first;
    int ry = rp.second;
    rep(i, blue.size()) {
      int bx = blue[i].first;
      int by = blue[i].second;
      if(rx < bx && ry < by) {
        ans++;
        blue.erase(blue.begin() + i);
        break;
      }
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vi>;
using vvl = vector<vl>;
const ll INF = 1LL << 60;
const ll MOD = 1000000007;
template <class T>
bool chmax(T &a, const T &b) {
    return (a < b) ? (a = b, 1) : 0;
}
template <class T>
bool chmin(T &a, const T &b) {
    return (b < a) ? (a = b, 1) : 0;
}

struct UnionFind {
    vector<int> rank, parent, size;

    // +1 for 1-indexed nodes
    UnionFind(int n) : rank(n + 1, 0), parent(n + 1), size(n + 1, 1) {
        iota(parent.begin(), parent.end(), 0); // parent is itself
    }
    int root(int x) {
        if (x != parent[x]) {
            parent[x] = root(parent[x]);
        }
        return parent[x];
    }
    bool isSame(int x, int y) { return root(x) == root(y); }
    bool unite(int x, int y) { return link(root(x), root(y)); }
    bool link(int x, int y) {
        if (x == y)
            return false;
        if (rank[x] > rank[y]) {
            parent[y] = x;
            size[x] += size[y];
        } else {
            parent[x] = y;
            size[y] += size[x];
            if (rank[x] == rank[y]) {
                rank[y]++;
            }
        }
        return true;
    }
    int getSize(int x) { return size[root(x)]; }
};

int main() {
    int n, m;
    cin >> n >> m;
    vi k(n);
    vvi l(n);
    for (int i = 0; i < n; ++i) {
        cin >> k[i];
        l[i].resize(k[i]);
        for (int j = 0; j < k[i]; ++j) {
            cin >> l[i][j];
        }
    }
    UnionFind uf(n + m);
    for (int i = 0; i < n; ++i) {
        for (auto &lang : l[i]) {
            uf.unite(i, n + lang - 1);
        }
    }
    bool ok = true;
    for (int i = 0; i < n; ++i) {
        if (!uf.isSame(i, 0)) {
            ok = false;
            break;
        }
    }
    if (ok)
        cout << "YES"
             << "\n";
    else
        cout << "NO"
             << "\n";

    return 0;
}

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

// 最小公倍数を求める
int euqlid (int a, int b){
  int temp;
  temp = a % b;
  if(temp == 0)return b;
  return euqlid(b,temp);
}
ll conbination(ll a,ll b){
  ll u = 1;
  ll d = 1;
  while(b != 0){
    u *= a;
    d *= b;
    a--;
    b--;
  }
  return u / d;
}
int fact(int n){
  if(n == 1)return 1;
  return n * fact(n-1);
  }

int main(){
  int n,k;
  cin >>n >>k;
  cout << ((n % k == 0)?0:1) << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <unordered_map>
#include <ctime>
#include <list>
#include <numeric>
#include <utility>
#include <ctime>
#define INF 1000000000
#define LINF 9000000000000000000
#define mod 1000000007
 
#define rep(i,n) for(int i=0;i<int(n);i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define REP(i,a,b) for(int i=(a);i<int(b);i++)
#define all(x) (x).begin(),x.end()
#define pb push_back
#define mp make_pair
#define MOD(x) (x%(mod))
 
using namespace std;
 
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int,int> pi;

int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
bool debug=false;
 
/*---------------------------------------------------*/


struct Edge{
    long long to, cost;
    Edge(long t, long c){
        to = t;
        cost = c;
    }
};

class Bellman_Ford{
    private:
        const long long Inf = 1LL << 50;
        vector<long long> dist;
        vector<vector<Edge> > adj;
    public:
        Bellman_Ford(int v){
            dist = vector<long long>(v + 1);
            adj = vector<vector<Edge> >(v + 1);
            for(int i = 0; i < (int)dist.size(); i++)dist[i] = Inf;
        }

        void add_edge(int from, int to, int cost){
            adj[from].push_back(Edge(to, cost));
        }

        bool shortest_path(int s){
            dist[s] = 0;
            for(int k = 0; k < (int)dist.size(); k++){
                for(int i = 0; i < (int)dist.size(); i++){
                    for(int  j = 0; j < (int)adj[i].size(); j++){
                        Edge e = adj[i][j];
                        if(dist[e.to] > dist[i] + e.cost && dist[i] != Inf){
                            dist[e.to] = dist[i] + e.cost;
                        }
                    }
                }
            }
            return true;
        }

        long long get_distance(int x){
            return dist[x];
        }

        void DEBUG(){
            for(int i = 0; i < (int)dist.size(); i++){
                cout << 1 << " --> " << i << " = " << dist[i] << endl;
            }
        }
};

int main(){
    int n, m, a, b, c;
    cin >> n >> m;
    Bellman_Ford bel(n + 1);
    rep(i, m){
        cin >> a >> b >> c;
        bel.add_edge(a, b, -c);
    }
    bel.shortest_path(1);
    ll first = bel.get_distance(n);
    bel.shortest_path(1);
    ll second = bel.get_distance(n); 
    if(first == second){
        cout << -first << endl;
    }else{
        cout << "inf" << endl;
    }
    return 0;
}

Measured memory_bytes: 384
#include<iostream>
#include<vector>
#include <cmath>
#include <string>
#include <algorithm>
using namespace std;
int main(void){
    string a;
    cin >> a;
    size_t size = a.length();

    char d[size];
    
    for(int i=0;i<size;i++){
       d[i] ='x';
    }
    for(int j=0;j<size;j++){
       cout<< d[j];
    }



    
    cout <<endl;
    return 0;
}

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

int main() {
	// your code goes here
	cin.tie(NULL);
	cout.tie(NULL);
	string s;int k;
	cin>>k;
	cin>>s;
	string str=s.substr(0,k);
	if(s.length()>k)
	str+="...";
	cout<<str;
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,n) for(int i=0;i<n;i++)
#define why(n,x) int n;while(cin >>n,n!=x)
#define iFOR(i,x,n)for(int i=x;i<n;i++)
#define unless(flg) if ( !(flg) )
#define read cin<<
#define echo cout<<
#define fin <<'\n'
#define __ <<" "<<
#define ___ <<" "
#define bash push_back
#define ALL(x) x.begin(),x.end()
#define SWAP(a,b) ((a != b) && (a += b,b = a - b,a -= b))
#define cinf(n,x) for(int UNCH=0;UNCH<(n);UNCH++) cin >> x[UNCH];
#define fcin(n,x) for(int UNCH=1;UNCH<=(n);UNCH++) cin>> x[UNCH];
#define memmin(x) memset((x),-1,sizeof((x)))
#define memzer(x) memset((x), 0,sizeof((x)))
#define meminf(x) memset((x),0x3f,sizeof((x)))
typedef long long ll;
typedef pair < int , int >  pii;
typedef vector < int > vit;
typedef map < string , int > mstit;
typedef vector < pii > vpi ;
typedef greater < pii > gpi;
typedef priority_queue < pii , vpi , gpi > dijk ;
static const signed int INF = 0x3f3f3f3f;
static const signed long long LINF = 0x3f3f3f3f3f3f3f3fLL;
static const signed int SMOD = 1000000007;
static const signed int NMOD = 1000000009;
static const signed int dx[]={1,0,-1,0,1,1,-1,-1};
static const signed int dy[]={0,-1,0,1,-1,1,-1,1};

bool inside(int x,int y,int w,int h){return (x>=0 && y>=0 && x<w && y<h);}
template<class T>T abs(T &x){return x<0 ? -x : x;}
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
int qp(int a,ll b,int mo){int ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}
int gcd(int a,int b){return b?gcd(b,a%b):a;}



signed main(){

  int n,a,b;
  string str;

  cin >> str;
  str[5]=' ';
  str[13]=' ';
  cout << str fin;
  return 0;
}



struct xyz{ xyz(){ cin.tie(0), ios::sync_with_stdio(false); cout <<fixed<<setprecision(12);};}xyzzy;



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


int main() {
  ios::sync_with_stdio(false);
  cin.tie(0), cout.tie(0);
  int n;
  cin >> n;
  string s;
  cin >> s;
  int r = 0;
  for (char c : s) {
    if (c == 'R') ++r;
  }
  int ans = 0;
  for (int i = 0; i < r; ++i) if (s[i] == 'W') ++ans;
  cout << ans << endl;
}

Measured memory_bytes: 3768
import bisect
from collections import deque
from sys import stdin
input = stdin.readline


def main():
  N, M, K = list(map(int, input().split()))
  A = deque(list(map(int, input().split())))
  B = deque(list(map(int, input().split())))

  ac_A = [0]*(len(A)+1)
  for i, a in enumerate(A):
    ac_A[i+1] = ac_A[i] + a
  ac_A.append(float('inf'))

  ac_B = [0]*(len(B)+1)
  for i, b in enumerate(B):
    ac_B[i+1] = ac_B[i] + b
  ac_B.append(float('inf'))

  # print(ac_A)
  # print(ac_B)

  ai = 0
  bi = 0
  max_num_book = 0
  for ai, sa in enumerate(ac_A):
    if K - sa < 0:
      continue
    bi = bisect.bisect_right(ac_B, K-sa) -1
    max_num_book = max(max_num_book, ai+bi)
    # print(ai, bi, max_num_book, K-sa)

  print(max_num_book)
#   while (ai < len(A) or bi < len(B)):
#     if ai >= len(A):
#       bi += 1
#     elif bi >= len(B):
#       ai += 1
#     elif (ac_A[ai+1] < ac_B[bi+1]):
#       ai += 1
#     else:
#       bi += 1
# 
#     if K >= ac_A[ai] + ac_B[bi]:
#       num_book += 1
#     else:
#       break

if(__name__ == '__main__'):
  main()

Measured memory_bytes: 48956
a, b, c = map(int,input().split())
if a == 5 and b == 5 and c == 7:
    print('YES')
elif a == 5 and b == 7 and c == 5:
    print('YES')
elif a == 7 and b == 5 and c == 5:
    print('YES')
else:
    print('NO')


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

using namespace std;

using ll = long long;
const int limit = 100010;
using edge = struct
{
    int to;
    ll cost;
};
vector<edge> tree[limit];
ll depth[limit];
void dfs(int v, int p, ll d)
{
    depth[v] = d;
    for (auto &e : tree[v])
    {
        if (e.to == p)
            continue;
        dfs(e.to, v, d + e.cost);
    }
}

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

    for (int i = 0; i < n - 1; ++i)
    {
        int a, b, c;
        cin >> a >> b >> c;
        a--, b--;
        edge e;
        e.to = b;
        e.cost = c;
        tree[a].push_back(e);
        e.to = a;
        e.cost = c;
        tree[b].push_back(e);
    }

    int q, k;
    cin >> q >> k;
    k--;

    dfs(k, -1, 0);
    for (int i = 0; i < q; ++i)
    {
        int x, y;
        cin >> x >> y;
        x--, y--;
        cout << depth[x] + depth[y] << endl;
    }

    return 0;
}

Measured memory_bytes: 14336
//	Author : amnptl 
//	   Godbless
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define NeedForSpeed() ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define MOD (1000000007); // 1e9+7

int n,m,x; ll c[20], a[20][20], skill[20]={0}, ans; 

void solve(ll cost, int book)
{
	bool pos = true; if(book>n) return;
	for(int i=1; i<=m; i++)
	{
		skill[i] += a[book][i];
		if(skill[i] < x) pos = false;
	}
	if(pos) ans = min(ans,cost+c[book]);
	solve(cost+c[book],book+1);
	for(int i=1; i<=m; i++) skill[i] -= a[book][i];
	solve(cost,book+1);
}


int main()
{
	NeedForSpeed();
	cin>>n>>m>>x; ans = LLONG_MAX;
	for(int i=1; i<=n; i++)
	{
		cin>>c[i];
		for(int j=1; j<=m; j++)
			cin>>a[i][j];
	}
	solve(0LL,1); if(ans==LLONG_MAX) ans = -1; cout<<ans<<endl;

	return 0;
}

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


int main() {
  int n, y, k;
  cin >> n >> y;
  for (int k10 = 0; k10 <= n; k10++) {
    for (int k5 = 0; k5 + k10 <= n; k5++) {                                                          
      k = n - k10 - k5;
      if (k10 * 10000 + k5 * 5000 + k * 1000 == y)
        if (0 <= k && k <= n) {
          cout << k10 << " " << k5 << " " << k << endl;
          return (0);
        }
    }
  }
  cout << "-1 -1 -1" << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N;cin>>N;
  vector<int>A(N);for(int i=0;i<N;i++)cin>>A[i];
  vector<int>B(N,0);
  for(int i=N-1;i>=0;i--){
    int t=0;
    for(int j=2;j*(i+1)<=N;j++)t+=B[(i+1)*j-1];
    B[i]=(t+A[i])%2;
  }
  int M=0;
  for(int i=0;i<N;i++)M+=B[i];
  cout<<M<<endl;
  for(int i=0;i<N;i++)if(B[i])cout<<i+1<<" ";
}

Measured memory_bytes: 2432
#define _GLIBCXX_DEBUG //エラーを出すためのおまじない
#include <bits/stdc++.h>
#include <algorithm>
#include <iostream>
//#include <cstdlib>  // abs() for integer
#include <cmath>    // abs() for float, and fabs()
#include <math.h>
using namespace std;
#define coYES cout << "YES" << endl
#define coNO cout << "NO" << endl
#define coYes cout << "Yes" << endl
#define coNo cout << "No" << endl
#define coyes cout << "yes" << endl
#define cono cout << "no" << endl
//#define cocount cout << count << endl;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i < (int)(n); i++)
#define Cinint(n) int n;\
cin >> n;
#define Cinvecint(a, n) vector<int> a(n);\
for (int i = 0; i < (int)(n); i++) {\
  int num;\
  cin >> num;\
  a.at(i) = num;\
}
#define Cinstring(s) string s;\
cin >>s;

int main() {
  string s;
  cin >> s;
  int n = s.size();
  if (s.at(n-1) == 's') {
    cout << s + "es" << endl;
  }
  else {
    cout << s + "s" << endl;
  }
  
  
}


Measured memory_bytes: 3632
#include <iostream>
#include <algorithm>       // for next_permutation
#include <vector>
#include <bits/stl_numeric.h>

#define DEBUG 0
#define REP(i, n) for (long long i = 0; i < (n); i++) 
typedef long long ll;
static const ll MOD = 1000000007;
static const ll INF = 1000000000000000000LL;
using namespace std;

int main() {
    string s;
    cin >> s;

    int N = s.size();

    vector <int> a(N+1,0);

    for(int i = 0; i < N; ++i)
    {
        if(s[i] == '<')
        {
            a[i+1] = max(a[i+1], a[i] + 1);
        }
    }
    for(int i = N-1; i >= 0; --i)
    {
        if(s[i] == '>')
        {
            a[i] = max(a[i], a[i + 1] + 1);
        }
    }

    ll res = 0;
    REP(i,N+1)
    {
        res += a[i];
    }

    cout << res << endl;


    return 0;
}

Measured memory_bytes: 2820
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
template<class T> ostream& operator<<(ostream &os, vector<T> V) {
	os << "[ "; for(auto v : V) os << v << " "; return os << "]";
}
template<class L, class R> ostream& operator<<(ostream &os, pair<L,R> P) {
	return os << "(" << P.first << "," << P.second << ")";
}
#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template<typename Arg1> void __f(const char* name, Arg1&& arg1) {
	cerr << name << " : " << arg1 << endl;
}
template<typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
	const char* comma = strchr(names + 1, ',');
	cerr.write(names, comma - names) << " : " << arg1<<" | ";
	__f(comma+1, args...);
}
#else
#define trace(...) 1
#endif
#define pb push_back
#define F first
#define S second
#define all(x) (x).begin(), (x).end()
#define sz(x) (int)(x).size()
#define mems(x, y) memset(x, y, sizeof(x))
#define rep(i, n) for (int i = 0; i < n; ++i)
#define irep(i, n) for (int i = 1; i <= n; ++i)
#define print(x) cout << x << '\n'
#define err(x) clog << x << '\n'
typedef long long ll;
#define int ll
typedef long double ld;
#define double ld
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> pii;
typedef vector<pii> vpii;
const int INF = 0x3f3f3f3f;
const int LINF = 0x3f3f3f3f3f3f3f3f;
const int mod = (119<<23)+1;
const int M = 1e9+7;
const int N = 2e5+5;

int n;
int t[4*N], z[4*N];

void apply(int v, int x) {
	t[v] += x;
	z[v] += x;
}

void push(int v) {
	apply(v*2, z[v]);
	apply(v*2+1, z[v]);
	z[v] = 0;
}

void upd(int v, int l, int r, int ql, int qr, int x) {
	if (ql >= r || qr <= l) return;
	else if (l >= ql && r <= qr) apply(v, x);
	else {
		push(v);
		int m = (l+r)/2;
		upd(v*2, l, m, ql, qr, x);
		upd(v*2+1, m, r, ql, qr, x);
		t[v] = min(t[v*2], t[v*2+1]);
	}
}

int qry(int v, int l, int r, int ql, int qr) {
	if (ql >= r || qr <= l) return INF;
	else if (l >= ql && r <= qr) return t[v];
	else {
		push(v);
		int m = (l+r)/2;
		return min(qry(v*2, l, m, ql, qr), qry(v*2+1, m, r, ql, qr));
	}
}

inline void update(int ql, int qr, int x) { upd(1, 0, n+1, ql, qr, x); }

inline int query(int ql, int qr) { return qry(1, 0, n+1, ql, qr); }

vpii v[N];

signed main() {
	ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
	cout << fixed << setprecision(15);
	
	int m; cin >> n >> m;
	int s = 0;
	rep(i, m) {
		int l, r, a; cin >> l >> r >> a;
		v[r].pb({l, a});
		s += a;
	}

	irep(i, n) {
		update(i, i+1, query(0, i));
		for (auto p: v[i]) update(0, p.F, p.S);
	}

	print(s-query(0, n+1));
}


Measured memory_bytes: 22912
use std::io::*;
use std::str::FromStr;

#[allow(dead_code)]
fn read_option<T: FromStr>() -> Option<T> {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok()
}

#[allow(dead_code)]
fn read<T: FromStr>() -> T {
    let opt = read_option();
    opt.expect("failed to parse token")
}

fn main() {
    let n: i32 = read();
    let k: i32 = read();
    let s: String = read();
    let mut score: i32 = n - 1;
    let mut before = s.chars().collect::<Vec<_>>()[0];
    for c in s.chars() {
        if before != c {
            score = std::cmp::max(0, score - 1);
        }
        before = c;
    }
    println!("{}", std::cmp::min(n - 1, score + k * 2));
}


Measured memory_bytes: 4352
a,b,k = [int(i) for i in input().split()]
n = b-a+1

if n <= 2*k:
    for i in range(a,b+1):
        print(i)

else:
    for i in range(k):
        print(a+i)
    for i in range(b-k+1,b+1):
        print(i)

Measured memory_bytes: 3064
import sys
from operator import itemgetter

rl = sys.stdin.readline


def solve():
    N, K = map(int, rl().split())
    ab = [list(map(int, rl().split())) for _ in range(N)]
    ab.sort(key=itemgetter(0))
    
    cnt = 0
    for a, b in ab:
        cnt += b
        if K <= cnt:
            print(a)
            exit()


if __name__ == '__main__':
    solve()


Measured memory_bytes: 60380
#include<stdio.h>  
int p;
int main(){
	int n,i,num=1,min;
	scanf("%d",&n);scanf("%d",&p);
	min=p;
	for(i=1;i<n;i++){
		scanf("%d",&p);
		if(min>p)
		{
			min=p;
			num++;
		} 
}
	printf("%d",num); 
}

Measured memory_bytes: 128
n,x=map(int,input().split())
a=sorted(list(map(int,input().split())))
if x>sum(a):
    print(n-1)
    exit()
elif x==sum(a):
    print(n)
    exit()
for i in range(n):
    if a[i]>x:
        print(i)
        exit()
    else:
        x-=a[i]

Measured memory_bytes: 9192
#include <stdio.h>

int main()
{
    int i,x,y;
    for (i=1; ; i++) {
        scanf("%d %d",&x,&y);
        if (x==0&&y==0)
            break;
        
        if (x>y) {
            printf("%d %d\n",y,x);
        }
        else{
        printf("%d %d\n",x,y);
        }
        }
   
    return 0;
}

Measured memory_bytes: 600
import sys
iN,iK = [int(_) for _ in input().split()]
#aData = [[int(_) for _ in sLine.split()] for sLine in sys.stdin.readlines()]

d = {}
for a,b in [[int(_) for _ in sLine.split()] for sLine in sys.stdin.readlines()]:
    if a in d:
        d[a] += b
    else:
        d[a] = b
iC = 0
for a in sorted(d.keys()):
    iC += d[a]
    if iK <= iC :
        print(a)
        exit()


Measured memory_bytes: 28268
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template<class T,class U> using P = pair<T,U>;
template<class T> using vec = vector<T>;
template<class T> using vvec = vector<vec<T>>;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

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

const int INF = 1001001001;

int main(){
    string s;
    cin >> s;
    int leng = s.size();
    int ans = 0;
    for(int i=0; i<leng; i++){
        if (s[i]!=s[leng-i-1]) ans ++;
    }
    cout << ans/2 << endl;

}

Measured memory_bytes: 256
#include <cstdio>  //{{{
#include <iostream>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <algorithm>

#define ALL(c) (c).begin(), (c).end()
#define DUMP(x) std::cerr << #x << ':' << x << '\n'
#define REP(i, n) for (int i = 0; i < (int)(n); ++i)

typedef long long ll;
// clang-format off
template<typename T,typename U>inline bool chmax(T&x,U a){if(x>=a)return 0;x=a;return 1;}
template<typename T,typename U>inline bool chmin(T&x,U a){if(x<=a)return 0;x=a;return 1;}
inline int in(){int x;scanf("%d", &x);return x;}
// clang-format on
// }}}

//{{{ graph.hpp
#ifndef INCLUDE_GRAPH_HPP
#define INCLUDE_GRAPH_HPP
#include <vector>
#include <climits>
namespace orliv {
namespace graph {
struct Edge {
  typedef int weight_type;
  static constexpr weight_type INF =
      std::numeric_limits<weight_type>::max() - 100;

  int from, to;
  weight_type w;
  Edge(int from, int to, weight_type w = 1) : from(from), to(to), w(w) {}
  bool operator<(const Edge& rhs) const {
    if (w != rhs.w) return w > rhs.w;
    if (from != rhs.from) return from < rhs.from;
    return to < rhs.to;
  }
};

typedef Edge::weight_type Weight;
typedef std::vector<Edge> Edges;
typedef std::vector<Weight> Weights;
typedef std::vector<int> Path;
typedef std::vector<int> Nodes;
}
typedef std::vector<graph::Edges> Graph;
}
#endif
//}}}
// {{{ topological_sort.cc
#ifndef INCLUDE_GRAPH_HPP
#include "graph.hpp"
#endif

namespace orliv {
namespace graph {
namespace topological_internal {
struct TopologicalImpl {
  const Graph& G;
  std::vector<int> color;
  Nodes order;
  TopologicalImpl(const Graph& g) : G(g), color(g.size()) {}
  Nodes get() {
    for (int v = 0; v < G.size(); v++) {
      if (!color[v] && !dfs(v)) return Nodes();
    }
    reverse(order.begin(), order.end());
    return std::move(order);
  }

 private:
  bool dfs(int v) {
    color[v] = 1;
    for (const auto& e : G[v]) {
      int u = e.to;
      if (color[u] == 2) continue;
      if (color[u] == 1) return false;
      if (!dfs(u)) return false;
    }
    order.emplace_back(v);
    color[v] = 2;
    return true;
  }
};
}

Nodes topologicalSort(const Graph& g) {
  return std::move(topological_internal::TopologicalImpl(g).get());
}
}
}
// }}}

using namespace std;

int main() {
  int M = in(), N = in();
  orliv::Graph g(M);
  for (int i = 0; i < M; i++) {
    if (i == 1) continue;
    g[i].emplace_back(i, 1);
  }
  for (int i = 0; i < N; i++) {
    int s = in() - 1, t = in() - 1;
    g[s].emplace_back(s, t);
  }
  auto order = orliv::graph::topologicalSort(g);
  for (const auto& x : order) {
    cout << x + 1 << endl;
  }

  return 0;
}

Measured memory_bytes: 3200
#include<bits/stdc++.h>
using namespace std;
// -----------------<fast IO>------------------
#define IOS             ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define FLSH             fflush(stdout)
#define fileIO(name) \
    freopen(name".in", "r", stdin); \
    freopen(name".out", "w", stdout);
#define PRECISION(x)     cout << fixed << setprecision(x);
// -----------------<TypeDef Start>------------------
typedef long double ld;
typedef long long ll;
typedef unsigned long long ull;
// -----------------<Constants>------------------
const int MAXN = 1000005;
const int SQRTN = 1003;
const int LOGN = 22;
const double PI=acos(-1);

const int INF=1e9;

int MOD = 1000000007;
const int FMOD = 998244353;
const double eps = 1e-9;
/*ll gcd(ll a,ll b)
{
    if(a==0)
    return(b);
    return(gcd(b%a,a));
}*/
// --------------------------------------------------</TEMPLATE>--------------------------------------------------


void solve()
{
    int h,w;
    cin>>h>>w;
    string s[h];
    for(int i=0;i<h;i++)
        cin>>s[i];
    int dp[h][w];
    memset(dp,0,sizeof(dp));
    for(int i=0;i<w;i++)
    {
        if(s[0][i]=='#')
        {
            dp[0][i]=0;
            break;
        }
        dp[0][i]=1;
    }
    for(int i=0;i<h;i++)
    {
        if(s[i][0]=='#')
        {
            break;
        }
        dp[i][0]=1;
    }
    for(int i=1;i<h;i++)
    {
        for(int j=1;j<w;j++)
        {
            if(s[i][j]=='#')
                dp[i][j]=0;
            else
                dp[i][j]=(dp[i-1][j]%MOD+dp[i][j-1]%MOD)%MOD;
        }
    }
    cout<<dp[h-1][w-1]<<endl;
}

int main()
{
    IOS
    ll t=1;
    //cin>>t;
    while(t--)
    {
        solve();
    }
    return(0);
}


Measured memory_bytes: 8644
#include <algorithm>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <tuple>
#include <vector>

using namespace std;

#define rep(i, n) for (int64_t i = 0; i < (n); i++)
#define irep(i, n) for (int64_t i = 0; i <= (n); i++)
#define rrep(i, n) for (int64_t i = (n)-1; i >= 0; i--)
#define rirep(i, n) for (int64_t i = n; i >= 0; i--)

const int64_t MOD = 1'000'000'007L;

int64_t dpow(int64_t x, int64_t y) {
  if (y == 0) {
    return 1;
  }
  if (y % 2 == 0) {
    return dpow(x * x % MOD, y / 2);
  } else {
    return x * dpow(x, y - 1) % MOD;
  }
}

int64_t inv(int64_t x) { return dpow(x, MOD - 2); }

int64_t comb(int64_t n, int64_t k) {
  int64_t a = 1, b = 1;
  for (int64_t i = 0; i < k; i++) {
    a *= (n - i);
    a %= MOD;
    b *= i + 1;
    b %= MOD;
  }
  return a * inv(b) % MOD;
}

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

  cout << (((dpow(2, n) - 1 + MOD) % MOD - comb(n, a) + MOD) % MOD -
           comb(n, b) + MOD) %
              MOD
       << endl;

  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  long long N,Y;
  cin>>N>>Y;
  vector<long long>Ans(3);
  Ans.at(0)=-1;
  Ans.at(1)=-1;
  Ans.at(2)=-1;
  for(int i=0;i<=N;i++){
    for(int j=0;j<=N-i;j++){
      if(10000*i+5000*j+1000*(N-(i+j))==Y){
        Ans.at(0)=i;
        Ans.at(1)=j;
        Ans.at(2)=N-(i+j);
        break;
      }
    }
  }
  cout<<Ans.at(0)<<" "<<Ans.at(1)<<" "<<Ans.at(2)<<endl;
}


Measured memory_bytes: 256
/**
  *  Worg
  */
#include <string>
#include <vector>
#include <iostream>
#include <algorithm>

const int mod = 1e9 + 7;

void fix(int& value) {
	if (value >= mod) {
		value -= mod;
	}
}

int main() {
	std::string k; std::cin >> k;
	int d; std::cin >> d;

	std::vector<std::vector<int>> dp(d, std::vector<int>(2, 0));
	dp[0][0] = 1;

	for (int i = 0; i < (int)k.size(); i++) {
		std::vector<std::vector<int>> new_dp(d, std::vector<int>(2, 0));

		for (int sum = 0; sum < d; sum++) {
			for (int digit = 0; digit < 10; digit++) {
				for (int smaller = 0; smaller < 2; smaller++) {
					if (digit > k[i] - '0' && !smaller) continue;

					new_dp[(sum + digit) % d][smaller || (digit < k[i] - '0')] += dp[sum][smaller];
					fix(new_dp[(sum + digit) % d][smaller || (digit < k[i] - '0')]);
				}
			}
		}
		dp = new_dp;
	}
	int answer = (dp[0][0] + dp[0][1]) % mod;
	answer = (answer - 1 + mod) % mod;
	std::cout << answer << "\n";
	return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define MOD (long long int)(1e9+7)
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
#define REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define FOR(i,a,b) for(int i=a; i<(int)(b); i++)
#define ALL(x) (x).begin(),(x).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define CLR(a) memset((a), 0 ,sizeof(a))
#define PB push_back
#define MP make_pair
#define SP << " " <<
const int INF = 1001001001;
const ll LINF = 100100100100100100;
#define EPS (1e-10)
const long double PI  = acos(-1.0L);
typedef pair<int,int> PII;
typedef pair<ll,ll> PLL;
typedef pair<double,double> PDD;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VL;
#define chmax(a,b) a = (((a)<(b))?(b):(a))
#define chmin(a,b) a = (((a)>(b))?(b):(a))

__attribute__((constructor))
void initial(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(15);
}

signed main(){
	int n; cin>>n;
	VL a(n),b(n);
	// ll sa=0LL, sb=0LL;
	rep(i,n) cin>>a[i]; rep(i,n) cin>>b[i];
	ll s=0LL;
	int ans=0;
	rep(i,n){
		if(a[i]<b[i]) s+=b[i]-a[i], ans++;
	}
	if(s==0) return cout<<0<<endl,0;
	VL candi;
	rep(i,n) if(a[i]>=b[i]) candi.PB(a[i]-b[i]); sort(RALL(candi));
	rep(i,candi.size()){
		if(s<=0) continue;
		s-=candi[i]; ans++;
	}
	if(s>0) return cout<<-1<<endl,0;
	cout<<ans<<endl;

	return 0;
}


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

int main() {
	int r;
	bool band=false;
	cin>>r;
	for (int a=1; a<10;a++) {
		for (int b=1; b<10;b++) {
			if (a*b==r)
				band=true;
		}
	}
	if (band)
		cout<<"Yes";
	else
		cout<<"No";
	return 0;
}

Measured memory_bytes: 3600
#include<bits/stdc++.h>
#define sz(a) int((a).size()) 
#define pb push_back 
#define all(c) (c).begin(),(c).end() 
#define tr(c,i) for(auto i = (c).begin(); i != (c).end(); i++) 
#define present(c,x) ((c).find(x) != (c).end()) 
#define cpresent(c,x) (find(all(c),x) != (c).end())
#define F(i,n) for(int i=0;i<n;i++)
#define MOD 1000000007
#define VE(i,v) for(int i = 0;i < (v).size();i++)

using namespace std;
#define trace(...) cerr<<__FUNCTION__<<":"<<__LINE__<<" "; __f(#__VA_ARGS__, __VA_ARGS__)
template<typename Arg1>
void __f(const char *name, Arg1 &&arg1) {
	cerr<<name<<" : "<<arg1<<endl;
}
template<typename Arg1, typename ... Args>
void __f(const char *names, Arg1 &&arg1, Args &&... args) {
	const char *comma=strchr(names+1,',');
	cerr.write(names,comma-names)<<" : "<<arg1<<" | ";
	__f(comma+1,args...);
}
typedef vector<int> vi; 
typedef vector<vi> vvi; 
typedef pair<int,int> ii;
typedef vector<ii> vii;
typedef long long ll;
typedef unsigned int ui;
typedef vector<ll> vl; 
typedef vector<vl> vvl; 
typedef pair<ll,ll> pll;
typedef vector<pll> vpll; 
 




int main()

{
	std::ios::sync_with_stdio(false);
	cin.tie(NULL);
	int T;
	T=1;
	for(int tc=1; tc<=T;tc++)
	{
		string s;
		cin >> s;
		int lim = sz(s)/2;
		int ans = 0;
		for(int i =0, j = sz(s)-1; i < lim; i++, j--)
			if(s[i]!=s[j])
				ans++;
		cout<<ans<<"\n";
	}
 
 
 
	return 0;
}
 
 


Measured memory_bytes: 256
#include<cmath>
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
int n,m;
char a[10001];
int main(){
	scanf("%d",&n);
	cin>>a;
	int l=strlen(a);
	for(int i=0;i<l;i++){
		m=m*10+(a[i]-'0');
		n*=10;
	}
	if(ceil(sqrt(n+m))==(sqrt(n+m))) printf("Yes\n");
	else printf("No\n");
	return ~~(0-0);
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Math;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            A();
        }

        static void A()
        {
            var r = ReadInt();
            Println(r * r);
        }

        static List<long> ReadLines(long n)
        {
            var l = new List<long>();
            for (long i = 0; i < n; i++)
            {
                l.Add(ReadLong());
            }
            return l;
        }

        static void YESOrNO(bool e) => Println(e ? "YES" : "NO");

        static void YesOrNo(bool e) => Println(e ? "Yes" : "No");

        static IEnumerable<int> Range(int start, int stop)
        {
            if (start < 0 || stop < 0 || start > stop || (start <= 0 && stop <= 0))
                return new List<int>();

            return Enumerable.Range(start, stop - start);
        }

        static bool IsDigit(string str)
        {
            var i = 0;
            return int.TryParse(str, out i);
        }

        static int SumDigits(long num)
        {
            return num.ToString().Select(x => x.ToString()).Sum(int.Parse);
        }

        static int[] ToIntArray(string str)
        {
            return str.Select(x => x.ToString()).Select(int.Parse).ToArray();
        }

        static long Gcd(long a, long b) => b == 0 ? a : Gcd(b, a % b);
        static long Lcm(long a, long b) => a / Gcd(a, b) * b;

        static bool IsPrime(int x)
        {
            if (x <= 1 || (x != 2 && x % 2 == 0)) return false;
            if (x == 2) return true;

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

            return true;
        }

        static string Read() => Console.ReadLine();
        static int ReadInt() => int.Parse(Read());
        static long ReadLong() => long.Parse(Read());

        static List<string> ReadSplit() => Read().Split().ToList();
        static List<int> ReadSplitInt() => Read().Split().Select(int.Parse).ToList();
        static List<long> ReadSplitLong() => Read().Split().Select(long.Parse).ToList();

        static void Print(object value) => Console.Write(value.ToString());
        static void Println(object value) => Console.WriteLine(value.ToString());
        static string Join<T>(IEnumerable<T> list) => string.Join("", list);
    }

    public static class MyExtensions
    {
        public static string Slice(this string str, int start = 0, int stop = 0)
        {
            if (start > str.Length || stop > str.Length || start < 0 || stop < 0)
                return "";

            if (stop == 0) stop = str.Length;
            return str.Substring(start, stop - start);
        }
    }
}



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

using namespace std;

int main(){
  string S;
  cin >> S;
  long N = S.size();

  long sum = 0;
  for(int bit = 0; bit<(1<<N-1); bit++){
     long curPos = 0;
     for(int i=0; i<N-1; i++){
       if(bit & (1<<i)){
         string temp = S.substr(curPos, i-curPos+1);
         long v = atol(temp.c_str());
         sum += v;
         curPos = i+1;
       }
     }
     string temp = S.substr(curPos, N-curPos);
     long v = atol(temp.c_str());
     sum += v;
  }
  
  cout << sum;
  
  return 0; 
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
	int n;
	cin>>n;
	int minv=0x7fffffff,cnt=0;
	while(n--){
		int x;
		cin>>x;
		if(x<minv){
			++cnt;
			minv=x;
		}
	}
	cout<<cnt;
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int main()
{
	char s[101];
	scanf("%s",s);
	for (int i = 0; i < strlen(s); i++)
	{
		if (i % 2  == 0)
		{
			if (s[i] != 'R' && s[i] != 'U' && s[i] != 'D')
			{
				printf("No");
				return 0;
			}
		}
		if (i % 2 == 1)
		{
			if (s[i] != 'L' && s[i] != 'U' && s[i] != 'D')
			{
				printf("No");
				return 0;
			}
		}
	}
	printf("Yes");
	return 0;
}

Measured memory_bytes: 128
#[allow(dead_code)]
fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}
#[allow(dead_code)]
fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}
#[allow(dead_code)]
fn read_vec2<T: std::str::FromStr>(n: u32) -> Vec<Vec<T>> {
    (0..n).map(|_| read_vec()).collect()
}
#[allow(dead_code)]
fn yn(result: bool) {
    if result {
        println!("Yes");
    } else {
        println!("No");
    }
}

fn main() {
    let v = read_vec::<u32>();
    let n = v[0];
    let d = v[1];

    let d2 = d * 2 + 1;

    let ans = if n % d2 == 0 {
        n / d2
    } else {
        n / d2 + 1
    };
    println!("{}", ans);
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
const int MAXN=1000010;
int N,F[MAXN][2];char s[MAXN];
int main()
{
	scanf("%s",s+1);
	N=strlen(s+1);
	F[N][0]=s[N]-'0';
	F[N][1]=10-(s[N]-'0');
	for (int i=N-1;i;--i)
	{
		int v=s[i]-'0';
		F[i][0]=F[i+1][0]+v;
		if (v!=9) F[i][0]=min(F[i][0],F[i+1][1]+1+v);
		F[i][1]=F[i+1][0]+10-v;
		if (v==9) F[i][1]=min(F[i][1],F[i+1][1]);
		else F[i][1]=min(F[i][1],F[i+1][1]+10-(v+1));
	}
	cout<<min(F[1][0],F[1][1]+1)<<endl;
	return 0;
} 

Measured memory_bytes: 9088
#include <bits/stdc++.h>
using namespace std;
int n,k,a[100005],b[100005],c[100005],dp[100005][4];
int solve(int idx, int choice){
    if(idx >= n)
        return 0;
    int &ans = dp[idx][choice];
    if(ans != -1)
        return ans;
    ans = 0;
    if(!choice){
        ans = max(ans, a[idx] + solve(idx + 1, 1));
        ans = max(ans, b[idx] + solve(idx + 1, 2));
        ans = max(ans, c[idx] + solve(idx + 1, 3));
    }
    else if(choice == 1){
        ans = max(ans, b[idx] + solve(idx + 1, 2));
        ans = max(ans, c[idx] + solve(idx + 1, 3));
    }
    else if(choice == 2){
        ans = max(ans, a[idx] + solve(idx + 1, 1));
        ans = max(ans, c[idx] + solve(idx + 1, 3));
    }
    else if(choice == 3){
        ans = max(ans, a[idx] + solve(idx + 1, 1));
        ans = max(ans, b[idx] + solve(idx + 1, 2));
    }
    return ans;
}
int main()
{
    ios::sync_with_stdio(0);
    memset(dp , -1, sizeof dp);
    cin >> n;
    for(int i = 0; i < n; i++){
        cin >> a[i] >> b[i] >> c[i];
    }
    cout << solve(0,0) << endl;
    return 0;
}


Measured memory_bytes: 7680
#include<bits/stdc++.h>
#include<stdio.h>
#include<string.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<vector>
#include<set>
#include<iostream>
#define pb push_back
#define fi first
#define se second
#define sz(x)  x.size()
#define cl(x)  x.clear()
#define all(x)  x.begin() , x.end()
#define r(x)  scanf("%d", &x)
#define rr(x , y)  scanf("%d%d" , &x , &y)
#define rst(s)  scanf("%s" , s)
#define rl(x)  scanf("%lld" , &x)
#define rrl(x , y)  scanf("%lld%lld" , &x , &y)
#define w(x)  printf("%d" , x)
#define ww(x , y)  printf("%d %d" , x , y)
#define wl(x)  printf("%lld" , x)
#define wwl(x , y)  printf("%lld %lld" , x , y)
#define sp()  printf(" ")
#define en()  puts("")
#define rep(i , x , n)  for(int i = x ; i <= n ; i ++)
#define per(i , n , x)  for(int i = n ; i >= x ; i --)
#define mem0(x)  memset(x , 0 , sizeof(x))
#define mem_1(x)  memset(x , -1 , sizeof(x))
#define mem_inf(x)  memset(x , inf , sizeof(x))
#define mem__inf(x)  memset(x , -inf , sizeof(x))
#define p_queue priority_queue
#define debug(x)  cout << '*' << x << '\n'
#define ddebug(x , y)  cout << '*' << x << ' ' << y << '\n'
#define ios std::ios::sync_with_stdio(false) , cin.tie(0)
using namespace std ;
//mt19937  rnd(chrono::high_resolution_clock::now().time_since_epoch().count()) ;
typedef long long ll ;
typedef unsigned long long ull ;
typedef pair<int , int> pii ;
typedef pair<ll , ll> pll ;
typedef pair<int , ll> pil ;
typedef pair<ll , int> pli ;
typedef pair<double , double> pdd ;
const int inf = 0x3f3f3f3f ;
const ll mod = 998244353 ;
const int maxn = 55 ;
const int maxm = 30 ;
const double eps = 1e-6 ;
const double pi = acos(-1.0) ;
ll a , b , n ;
void solve()
{
	ll ans = 0 ;
	if(b - 1 <= n)  ans = a - (a / b + (a % b != 0)) ;
	else  ans = (a * n) / b - a * (n / b) ;
	wl(ans) , en() ; 
}
int main()
{
	rrl(a , b) , rl(n) ;
	solve() ;
	return 0 ;
}

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


int main(void){
    int i,j,n,m,k,a,b,c,h,w,r=0,l,t;
    int x1,y1,x2,y2;
    double d;
    char s[524288];
    scanf("%d%d%d%d",&x1,&y1,&x2,&y2);
    a=x1-x2;
    b=y1-y2;
    printf("%d %d %d %d\n",x2+b,y2-a,x1+b,y1-a);
    return 0;
}

Measured memory_bytes: 256