akhauriyash/Code-Regression huggingface dataset:
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author
 */

#include <algorithm>
#include <fstream>
#include <functional>
#include <iostream>
#include <iomanip>
#include <iterator>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>

#define ll long long int
#define REP(i, n) for(int i=0;i<n;++i)
#define ALL(a) (a).begin(),(a).end()

using namespace std;


class BCollatzProblem {
public:
    ll a[1000000]{0};
    ll s;

    void solve(std::istream& in, std::ostream& out) {
        in >> s;
        ll tmp = s;
        a[tmp]++;
        int i = 1;

        for(;;) {
            ++i;
            ll p = f(tmp);
            if (a[p] > 0) {
                out << i << endl;
                break;
            }
            a[p]++;
            tmp = p;
        }
    }

    ll f(ll a) {
        if (a % 2 == 0) return a / 2;
        else return 3 * a + 1;
    }
};


int main() {
    BCollatzProblem solver;
    std::istream& in(std::cin);
    std::ostream& out(std::cout);
    solver.solve(in, out);
    return 0;
}


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

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  int h, w, k;
  cin >> h >> w >> k;
  
  vector<vector<int>> s(h, vector<int>(w));
  for (int i = 0; i < h; i++) {
    for (int j = 0; j < w; j++) {
      char c;
      cin >> c;
      s.at(i).at(j) = (int) c - '0';
    }
  }
  
  /*for (int i = 0; i < h; i++) {
    for (int j = 1; j < w; j++) {
      s.at(i).at(j) += s.at(i).at(j);
    }
  }*/
  
  int ans = 1e9;
  for (int bit = 0; bit < (1 << (h - 1)); bit++) {
    int stand = 0;
    for (int i = 0; i < (h - 1); i++) {
      if (bit & (1 << i)) stand++;
    }
    vector<int> x(stand + 1), y(stand + 1);
    int count = 0;
    bool flag2 = false;
    for (int i = 0; i < w; i++) {
      int it = 0;
      for (int j = 0; j < h; j++) {
        y.at(it) += s.at(j).at(i);
        if (bit & (1 << j)) it++;
      }
      bool flag = false;
      for (int j = 0; j <= stand; j++) {
        if (x.at(j) + y.at(j) > k) flag = true;
        if (y.at(j) > k) flag2 = true;
      }
      if (flag2) break;
      if (flag) {
        count++;
        for (int j = 0; j <= stand; j++) {
          x.at(j) = y.at(j);
          y.at(j) = 0;
        }
      }
      else {
        for (int j = 0; j <= stand; j++) {
          x.at(j) += y.at(j);
          y.at(j) = 0;
        }
      }
      if (flag2) break;
    }
    if (flag2) continue;
    ans = min(ans, count + stand);
  }
  
  cout << ans << '\n';
}

Measured memory_bytes: 256
n, m, l = (int(i) for i in input().split())
A = []
B = []
#C = [[0] * n] * l
C = [[0 for i in range(l)] for j in range(n)]
#??\?????????????????????????´?
for i in range(n):
    #swap_list = input().split()
    #A.append(swap_list)
    A.append([int(i) for i in input().split()])
for i in range(m):
    #swap_list = input().split()
    #B.append(swap_list)
    B.append([int(i) for i in input().split()])
#????????????????¨????
for i in range(n):
    for j in range(l):
        for k in range(m):
            C[i][j] += A[i][k] * B[k][j]
#?????????????????????
#for i in range(n):
#    for j in range(l):
#        print("{0}".format(C[i][j]), end="\b")
#    print("")
for i in range(n):
    print(" ".join(map(str, C[i][:])))
#for r in C:
#    print(" ".join([str(d) for d in r]))

Measured memory_bytes: 8868
#include <cstdio>
#include <algorithm>
#include <functional>

int main()
{
  long long n;
  long long a[300000];
  scanf("%lld", &n);
  for (long long i = 0; i < 3 * n; ++i)
  {
    scanf("%lld", a + i);
  }
  std::sort(a, a + 3 * n, std::greater<long long>());
  long long ans = 0;
  for (long long i = 0; i < n; ++i)
  {
    ans += a[2 * i + 1];
  }
  printf("%lld\n", ans);
  return 0;
}

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

#define FOR(i, a, b) for(int i=(a); i<(b); i++)
#define RFOR(i, a, b) for(int i=(a); i>=(b); i--)
#define REP(i, n) FOR(i, 0, n)
#define RREP(i, n) RFOR(i, n, 0)
#define CEIL(n, m) ceil(n/pow(10.0, m))*pow(10.0, m)
#define FLOOR(n, m) floor(n/pow(10.0, m))*pow(10.0, m)
#define ROUND(n, m) round(n/pow(10.0, m))*pow(10.0, m)
#define ALL(x) (x).begin(),(x).end()
#define SORT(x) sort((x).begin(),(x).end())
#define RSORT(x) sort((x).begin(),(x).end(),greater<int>())
#define SZ(x) ((int)(x).size())
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
#define dump(x)  cout << #x << " = " << (x) << endl;
#define debug(x) cout << #x << " = " << (x) " (L" << __LINE__ << ") " << __FILE__ << endl;

typedef long long ll;
const int mod = 1e9+7;
const ll INF = 0x3f3f3f3f3f3f3f3f;
const int inf = 0x3f3f3f3f;

void solve()
{
  ll ans=0;

  int n; cin >> n;
  vector<int> a(n); REP(i, n) cin >> a[i];
  vector<int> b(n); REP(i, n) cin >> b[i];
  vector<int> c(n); REP(i, n) cin >> c[i];
  SORT(a);
  SORT(c);

  for (int i=0; i<n; i++) {
    auto aa = lower_bound(ALL(a), b[i]) - a.begin();
    auto cc = c.end() - upper_bound(ALL(c), b[i]);
    ans += (ll)aa * (ll)cc;
  }
  cout << ans << endl;
}

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


Measured memory_bytes: 1408
#include <stdio.h>
#include <string>
#include <cstdlib>
#include <iostream>
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; }
using namespace std;
int main(){
  int n;
    //cin >> n;
    //while(getline(cin,s)){}
  string s;
  getline(cin,s,'/');
  n = atoi(s.c_str());
  if(n < 2019) {cout << "Heisei" << endl; return 0;}
  else if (n == 2019) {
  	getline(cin,s,'/');
  	n = atoi(s.c_str());
  	if(n < 4) {cout << "Heisei" << endl; return 0;}
    else if(n == 4){
      getline(cin,s,'/');
  	  n = atoi(s.c_str());
  	  if(n <= 30) {cout << "Heisei" << endl; return 0;}
    }
  }
  cout << "TBD" << endl;
  return 0;
}


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

int main(){
	int N,L;
	cin >> N>>L;
	vector<pair<int,int>> ta(N);
	for (int i=0;i<N;i++){
		ta.at(i).first=abs(L+i);
		ta.at(i).second=L+i;
	}
	sort(ta.begin(),ta.end());
	int count=0;
	for(int i=1;i<N;i++){
		count +=ta.at(i).second;
	}
	cout<<count<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
using namespace std;
#define mod 1000000007
#define FAST                          \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);
bool vis[200005];
vector<int> vec[2000005], v1;
int child[2000005];
int parent[2000005];
int div1[100005];
int min_indx[200005];
int count1 = 0;
int height = 0;
int max_indx[200005];
void dfs(int node)
{

    vis[node] = 1;

    min_indx[count1] = node;
    max_indx[node] = min(max_indx[node], count1);
    count1++;

    //  count1++;
    child[node] = height++;
    for (int i = 0; i < vec[node].size(); i++)
    {
        if (!vis[vec[node][i]])
        {
            dfs(vec[node][i]);
            min_indx[count1] = node;
            max_indx[node] = min(max_indx[node], count1);
            count1++;
        }
    }
    height--;
}
int MAXN = 200005;
int LOGMAXN = (int)log2(200005) + 1;
int M[200005][60];
int ans[200005];
void fun(int a, int b, int c)
{
    //ll val = 1;

    while (a <= b)
    {
        ans[a] += c;
        int p = -a;
        a += (a & p);
    }
}
int find1(int a)
{
    int sum = 0;
    while (a != 0)
    {
        sum += ans[a];
        int p = -a;
        a -= (a & p);
    }
    return sum;
}
void process2(int A[], int N)
{
    int i, j;

    for (i = 0; i < N; i++)
        M[i][0] = i;
    for (j = 1; 1 << j <= N; j++)
        for (i = 0; i + (1 << j) - 1 < N; i++)
            if (find1(M[i][j - 1]) < find1(M[i + (1 << (j - 1))][j - 1]))
                M[i][j] = M[i][j - 1];
            else
                M[i][j] = M[i + (1 << (j - 1))][j - 1];
}
int arr1[1000005], arr2[1000005];
int32_t main()
{
    FAST;
    int n;
    cin >> n;
    int ans = 1000000000000;
    for (int i = 0; i < n; i++)
    {
        int x, y;
        cin >> x >> y;
        ans = min(ans, x + y);
    }
    cout << ans << "\n";
    return 0;
}

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

int main(int argc, char const *argv[]) {
    int n;
    cin >> n;
    string s;
    cin >> s;

    if (n%2 != 0) {
        cout << "No" << endl;
        return 0;
    }

    bool ok = true;
    for (size_t i = 0; i < n/2; i++) {
        if (s[i] != s[i + n/2]) ok = false;
    }

    if (ok) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}


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

const int mod = 1000000007;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res*=a;
  }
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const {
    return pow(mod-2);
  }
  mint& operator/=(const mint a) {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const {
    mint res(*this);
    return res/=a;
  }
};

mint choose(ll n, ll a){
    mint ans=1;
    rep(i,a) ans*=(n-i);
    rep(i,a) ans/=(a-i);

    return ans.x;
}

int main(){
    ll x,y;
    cin >> x >> y;
    ll xx,yy;
    xx = x; yy = y;
    ll count = 0;
    bool flag=false;
    while(xx!=2*yy){
        xx++; yy--;
        //cout << xx << yy << endl;
        count+=1;
        if(yy<0){
            flag = true;
            break;
        }
    }

    if(flag) {
        cout << 0 << endl;
        return 0;
    }
    ll n=0;
    n = xx/2;

    //cout << n << "choose" << count << endl;
    mint ans = 1;
    ans = choose(n,count);
    cout << ans.x << endl;

}

Measured memory_bytes: 256
x=10**9+7;import sys;sys.setrecursionlimit(x);n,k=map(int,input().split());t=[set()for _ in range(n)];c=k
for i in range(n-1):a,b=map(int,input().split());t[a-1].add(b);t[b-1].add(a)
def b(o):
  global c
  for i,j in enumerate(t[o-1]):c=(c*(k-2-i))%x;t[j-1].discard(o);b(j)
for i,j in enumerate(t[0]):c=(c*(k-1-i))%x;t[j-1].discard(1);b(j)
print(c)

Measured memory_bytes: 109896
#include<stdio.h>
#include<math.h>
#include<string.h>
#include<stdlib.h>
#include<string>
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<set>
#include<map>
using namespace std;
typedef long long ll;
const int MAXN= (int)2e5+10;
const ll MOD = (ll)1e9+7;
deque<int>q;
int main()
{	
	int n;
	scanf("%d",&n);
	for(int i=1;i<=n;i++){
		int x;
		scanf("%d",&x);
		if((i+n)%2){
			q.push_back(x);
		}
		else q.push_front(x);
	}
	while(!q.empty()){
		printf("%d ",q.front());
		q.pop_front();	
	}
	cout<<endl;
	return 0;
}

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

int main () {
  int x, a, b, A, B;
  cin >> x >> a >> b;
  
  A = x - a;
  if (A < 0) {
    A *= -1;
  }
  B = x -b;
  if (B < 0) {
    B *= -1;
  }
  if (A < B) {
    cout <<  "A" << endl;
  }
  else {
    cout << "B" << endl;
  }
}

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

int main() {
    long long k,a,b;
    cin >> k >> a >> b;
    if(b >= a && k > a) {
        cout << -1 << endl;
        return 0;
    }
    if(b >= a && k <= a) {
        cout << 1 << endl;
        return 0;
    }
    if(k<a) {
        cout << 1 << endl;
        return 0;
    }
    long long days = 0;
    if((k-a)%(a-b)==0){
        days = (k-a)/(a-b)*2+1;
    } else {
        days = (k-a)/(a-b)*2+2+1;
    }
    cout << days << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll          long long
#define pb          push_back
#define    endl        '\n'
#define pii         pair<ll int,ll int>
#define all(v) (v).begin(), (v).end()
using namespace std;
const int N = 1e3 + 5;
ll check(ll a, ll b, ll c)
{
    return (a + b > c) and (b + c > a) and (c + a > b) and a!=b and b!=c and c!=a;
}
void solve()
{
    ll n, ans = 0;
    cin >> n;
    std::vector<ll> v(n);
    for(auto &i : v) cin >> i;
    
    for(int i = 0; i < n; i++)
        for(int j = i + 1; j < n; j++)
            for(int k = j + 1; k < n; k++)
                ans += check(v[i], v[j], v[k]);
    cout << ans;
}


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



    int TESTS = 1;
    // cin >> TESTS;
    while(TESTS--)
    {
        solve();
        cout << endl;

    }
    return 0;
}

Measured memory_bytes: 3632
#include <iostream>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <map>
#include <queue>

static const int MOD = 1000000007;
using ll = long long;
using u32 = unsigned;
using namespace std;

template<class T>
constexpr T INF = ::numeric_limits<T>::max() / 2 - 170;

int main() {
    int n;
    cin >> n;
    vector<int> v, v2{0};
    v.emplace_back(0);
    for (int i = 0; i < n; ++i) {
        int k;
        cin >> k;
        v.emplace_back(k);
    }
    v.emplace_back(0);
    int sum = 0;
    for (int i = 0; i < n+1; ++i) {
        sum += abs(v[i+1]-v[i]);
        v2.emplace_back(sum);
    }
    for (int i = 1; i <= n; ++i) {
        cout << v2[i-1] + v2[n+1]-v2[i+1] + abs(v[i+1]-v[i-1]) << "\n";
    }
    return 0;
}


Measured memory_bytes: 2168
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
typedef long long ll;
ll n,m,v,p;
vector<ll> vec;
bool judge(ll pos){
  ll val=vec[pos];
  vector<ll> kv;
  for(int i=0;i<n;i++){
    if(i!=pos) kv.push_back(vec[i]);
  }

  sort(kv.begin(),kv.end(),greater<ll>());
  val+=m;
  if(kv[p-1]>val) return false;
  if(v<=p) return true;

  ll zan=(v-p)*m;
  for(int i=n-2;i>=p-1;i--){
    zan-=min(val-kv[i],m);
  }
  if(zan<=0) return true;
  else return false;
}

int main(){
  cin>>n>>m>>v>>p;
  for(int i=0;i<n;i++){
    ll a;
    cin>>a;
    vec.push_back(a);
  }
  sort(vec.begin(),vec.end());
  ll lb=-1,rb=n-1;
  while(rb-lb>1){
    ll mid=(lb+rb)/2;
    if(judge(mid)) rb=mid;
    else lb=mid;
  }
  cout<<n-rb<<endl;
}


Measured memory_bytes: 2896
module.exports=function(e){var t={};function r(n){if(t[n])return t[n].exports;var i=t[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)r.d(n,i,function(t){return e[t]}.bind(null,i));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=1)}([function(e,t,r){"use strict";e.exports=class{constructor(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.size=e.length,this.items=e,this.ind=0}enq(e){this.size+=1,this.items.push(e)}deq(){var e=this.items[this.ind];return this.size-=1,this.ind+=1,e}clear(){this.items=[],this.size=0,this.ind=0}}},function(e,t,r){"use strict";var n=r(2);r(3)(n.readFileSync("/dev/stdin","utf8"))},function(e,t){e.exports=require("fs")},function(e,t,r){"use strict";var n=r(4),i=r(5);e.exports=function(e){var t=new n(e);i(t)}},function(e,t,r){"use strict";var n=r(0);e.exports=class{constructor(e){var t=e.trim().split(/\s+/g);this.inp=new n(t)}inr(){return this.inp.deq()}in(){return parseInt(this.inp.deq(),10)}fin(){this.inp.clear()}}},function(e,t,r){"use strict";var n=r(0);e.exports=function(e){for(var t=e.in(),r=new Array(t),i=new Array(t),o=0;o<t;o++)r[o]=[];for(var s=0;s<t-1;s++){var u=e.in()-1,a=e.in()-1;i[s]=a,r[u].push(a),r[a].push(u)}var c=new Array(t).fill(0),f=new Array(t).fill(0);f[0]=1;var l=new n;l.enq({v:0,pc:-1});for(var p=0;l.size>0;){for(var v=l.deq(),d=1,h=r[v.v],y=0;y<h.length;y++)1!=f[h[y]]&&(f[h[y]]=1,d==v.pc&&d++,c[h[y]]=d,l.enq({v:h[y],pc:d}),d++);p=Math.max(p,h.length)}console.log(p);for(var b=0;b<t-1;b++){var g=c[i[b]];console.log(g)}}}]);


Measured memory_bytes: 76696
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <queue>
#include <unordered_map>
#include <unordered_set>
#include <map>
#include <set>
using namespace std;

#define INF (1ll<<60)


long long M = 1000000007;


int main(int argc, char const *argv[]) {
    int n;cin>>n;
    if(n==3){
        cout<<"2 5 63"<<endl;
        return 0;
    }
    int k = n/8, m = n%8;
    for(int i=0;i<k;++i){
        cout<<i*12+2<<" ";
        cout<<i*12+3<<" ";
        cout<<i*12+4<<" ";
        cout<<i*12+6<<" ";
        cout<<i*12+8<<" ";
        cout<<i*12+9<<" ";
        cout<<i*12+10<<" ";
        cout<<i*12+12<<" ";
    }
    map<int, set<int>> ma;
    ma[0] = set<int>();
    ma[1].insert(6);
    ma[2].insert(2);
    ma[2].insert(4);
    ma[3].insert(2);
    ma[3].insert(4);
    ma[3].insert(6);
    ma[4].insert(2);
    ma[4].insert(3);
    ma[4].insert(4);
    ma[4].insert(9);
    ma[5].insert(2);
    ma[5].insert(3);
    ma[5].insert(4);
    ma[5].insert(6);
    ma[5].insert(9);
    ma[6].insert(2);
    ma[6].insert(3);
    ma[6].insert(4);
    ma[6].insert(8);
    ma[6].insert(9);
    ma[6].insert(10);
    ma[7].insert(2);
    ma[7].insert(3);
    ma[7].insert(4);
    ma[7].insert(8);
    ma[7].insert(9);
    ma[7].insert(10);
    ma[7].insert(6);
    for(auto itr=ma[m].begin();itr!=ma[m].end();itr++){
        cout<<*itr + 12*k<<" ";
    }
    cout<<endl;
    return 0;
}

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

// Type alias
using ll=long long;
using ld=double;

using pi=pair<int,int>;
using pll=pair<ll,ll>;
using pld=pair<ld,ld>;
using ti3=tuple<int, int, int>;

using vi=vector<int>;
using vll=vector<ll>;
using vld=vector<ld>;
using vpi=vector<pi>;
using vpll=vector<ll>;
using vpld=vector<ld>;
using vti3=vector<ti3>;

// Constants
const double EPS = 1e-9;
const int inf = numeric_limits<int>::max();

// Macro
#define rep(i,n) for(int i=0;i<int(n);++i)
#define rrep(i,n) for(int i=int(n-1);i>=0;--i)
#define REP(i,a,b) for(int i=int(a);i<int(b);++i)
#define RREP(i,a,b) for(int i=int(b-1);i>=int(a);--i)
#define SHOW(a) cout << #a << " = " << a << endl
#define ARR(a,n) for(int i=0;i<int(n);++i) cout << #a << "[" << i << "]" << " = " << a[i] << endl

#define ALL(a) a.begin(),a.end()

// Funtcions
ll pow(ll base, ll i, ll mod){
  ll a = 1;
  while(i){
    if (i & 1) {
      a *= base;
      a %= mod;
    }
    base *= base;
    base %= mod;
    i >>= 1;
  }
  return a;
}
ll gcd(ll a, ll b){
  while(b){
    ll c = a % b;
    a = b;
    b = c;
  }
  return a;
}
ll lcm(ll a, ll b){
  return a / gcd(a, b) * b;
}


void solve(){
  int a, b;
  cin >> a >> b;
  cout << a * (a-1) / 2 + b * (b-1) / 2 << endl;
}

int main(){
  // FastIO
  //ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  solve();
  return 0;
}

Measured memory_bytes: 256
lines=3.times.map{gets.split.map(&:to_i)}
lines=[
  [lines[0][0],lines[0][1],lines[0][2]],
  [lines[1][0],lines[1][1],lines[1][2]],
  [lines[2][0],lines[2][1],lines[2][2]],
  [lines[0][0],lines[1][0],lines[2][0]],
  [lines[0][1],lines[1][1],lines[2][1]],
  [lines[0][2],lines[1][2],lines[2][2]],
  [lines[0][0],lines[1][1],lines[2][2]],
  [lines[0][2],lines[1][1],lines[2][0]],
]
ary=gets.to_i.times.map{gets.split.map(&:to_i)}.flatten
lines.each{|l|(puts 'Yes'; exit 0) if ary.include?(l[0])&&ary.include?(l[1])&&ary.include?(l[2])}
puts 'No'

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

using namespace std;

int main() {
    int n;
    cin>>n;
    vector<int> h(n);
    for(int i=0;i<n;i++) {
        cin>>h[i];
    }
    vector<int> dp(n);
    dp[0] = 0;
    dp[1] = abs(h[1] - h[0]);
    for(int i=2;i<n;i++){
        dp[i] = min(dp[i-1]+abs(h[i]-h[i-1]), dp[i-2] + abs(h[i-2]-h[i]));
    }
    cout<<dp[n-1]<<endl;
}

Measured memory_bytes: 1024
# Editorial

import sys
from itertools import accumulate

def main():
    input = sys.stdin.readline
    N, W = map(int, input().split())

    V = [[] for _ in range(4)]
    w0, v0 = map(int, input().split())
    V[0].append(v0)
    for _ in range(N-1):
        w, v = map(int, input().split())
        V[w-w0].append(v)

    for i in range(4):
        V[i] = list(accumulate([0] + sorted(V[i], key=lambda x: -x)))

    ans = 0
    for i in range(len(V[0])):
        for j in range(len(V[1])):
            for k in range(len(V[2])):
                weight = w0 * i + (w0 + 1) * j + (w0 + 2) * k
                if weight <= W:
                    l  = min(len(V[3]) - 1, (W - weight) // (w0 + 3))
                    ans = max(ans, V[0][i] + V[1][j] + V[2][k] + V[3][l])

    return ans


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


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

//////全探索したいときに開けよ////////
vector<vector<int>> fspattern;
vector<int> fspattern_draft;
int fspcnt = 0;

void setfspattern_core(int floor,int number,int degree){
  if(floor==degree){
    fspattern.at(fspcnt) = fspattern_draft;
    fspcnt++;
  }else{
    rep(i,number){
      fspattern_draft.at(floor) = i;
      setfspattern_core(floor+1,number,degree);
    }
  }
}

void setfspattern(int number,int degree){
  int64_t array_num = 1;
  rep(i,degree){
    array_num *= number;
  }
  fspattern = vector<vector<int>>(array_num,vector<int>(degree));
  fspattern_draft = vector<int>(degree);
  setfspattern_core(0,number,degree);
}

//////nCrのmodを求めたいときに開けよ/////////
//int64_t univMod = 1000000007;
//int64_t factnum = 100000
//vector<int64_t> modfact(factnum);
//vector<int64_t> modinvfact(factnum);

/*void setmodfact(){
  for(int i=0;i<factnum;i++){
    if(i == 0){
      modfact.at(i) = 1;
    }else{
      modfact.at(i) = (modfact.at(i-1)*i)%univMod;
    }
  }
}

int64_t calcmodpower(int64_t a,int64_t n){
  int64_t res = 1;
  while(n != 0){
    if(n & 1){
      res = (res * a) % univMod;
    }
    a = (a*a) % univMod;
    n = n >> 1;
  }
  return res;
}

int64_t calcinverse(int64_t n){
	return calcmodpower(n,univMod-2);
}

void setmodinvfact(){
  for(int i=0;i<factnum;i++){
    if(i==0){
      modinvfact.at(i) = 1;
    }else{
      modinvfact.at(i) = calcmodpower(modfact.at(i),univMod-2);
    }
  }
}

int64_t calcmodcomb(int64_t n,int64_t r){
  return (((modfact.at(n)*modinvfact.at(r))%univMod)*modinvfact.at(n-r))%univMod;
}

int64_t calcmodpositive(int64_t n){
  return (n + ((abs(n)+univMod-1)/univMod)*univMod)%univMod;
}
  
    */


/*
int64_t calcGCD(int64_t a,int64_t b){
	int64_t p = a;
	int64_t q = b;
	int64_t c = a%b;
	while(c != 0){
		p = q;
		q = c;
		c = p%q;
	}
	return q;
}
*/

int main(){
  char x,y;
  cin >> x >> y;
  if(x < y){
    cout << '<' << endl;
  }else if(x > y){
    cout << '>' << endl;
  }else{
    cout << '=' << endl;
  }
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <string>
#include <cmath>
#include <set>
#include <bitset>
#include <limits>
#include <queue>

using namespace std;

#define ll long long

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

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

    sort(a.begin(), a.end(), greater<int>());

    ll ans = 0;
    queue<int> cand;
    cand.push(a[0]);
    for(int i = 1;i < n;++i){
        ans += cand.front();
        cand.pop();
        cand.push(a[i]);
        cand.push(a[i]);
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 4848
alp = input()

list = [
  "a","b","c","d","e",
  "f","g","h","i","j",
  "k","l","m","n","o",
  "p","q","r","s","t",
  "u","v","w","x","y",
  "z"
]

if alp in list:
  print("a")
else:
  print("A")

Measured memory_bytes: 9116
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<set>
#include<map>
#include<queue>
#define REP(i,a) for (ll i = 0;i < (a);++i)
#define FOR(i,a,b) for (ll i = (a);i < (b); ++i)
#define FORR(i,a,b) for (ll i = (a);i >= (b); --i)
#define ALL(obj) (obj).begin(),(obj).end()
#define SORT(list) sort(ALL((list)));
#define MOD 1000000007
using namespace std;
using ll = long long;
int main(){
    ll n,k;
    cin >> n >> k;
    vector<ll>a(n),town(n+1,-1),junban(n);
    REP(i,n){
        ll tmp;
        cin >> tmp;
        a[i] = --tmp;

        junban[i]=-1;
    }

    ll now = 0,diff,offset;

    town[0] = 0;
    junban[0] = 0;

    REP(i,n){
        now = a[now];
        if(junban[now]!=-1){
            diff = (i+1)-junban[now];
            offset = junban[now];
            break;
        }else{
            junban[now] = i+1;
            town[i+1] = now;
        }
    }
    
    if(offset > k){
        cout << town[k] + 1 << endl;
    }else{
        cout << town[((k-offset)%diff)+offset]+1 << endl;
    }

    REP(i,n+1)
  
    return 0;
}

Measured memory_bytes: 8016
#include <iostream>

#define ll long long
using namespace std;

int main() {
    ll n;
    cin >> n;
    ll ret = 0;
    for (ll i = 1; i * i <= n; i++) {
        if ((n - i) % i == 0) {
            ll x = (n - i) / i;
            if (x > i) ret += x;
        }
    }

    cout << ret << endl;
    return 0;
}

Measured memory_bytes: 256
N, M = map(int, input().split())
H = [int(h) for h in input().split()]
AB = []
for i in range(M):
    A, B = map(int, input().split())
    AB.append([A,B])

H01 = [1]*N
for i in range(M):
    A,B = AB[i]
    if(H[A-1]<H[B-1]):
        H01[A-1] = 0
        if(H01[B-1]!=0):
            H01[B-1] = 1
    elif(H[A-1]==H[B-1]):
        H01[A-1] = 0
        H01[B-1] = 0
    else:
        if(H01[A-1]!=0):
            H01[A-1] = 1
        H01[B-1] = 0
print(sum(H01))

Measured memory_bytes: 28964
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
constexpr ll MAXN = 1e5 + 7;

ll dp[107][MAXN];

int main()
{
#ifdef LOCAL
    freopen("data.txt", "r", stdin);
#endif
    int n, m;
    scanf("%d%d", &n, &m);
    for (int i = 0; i != n; ++i) {
        ll w, v;
        scanf("%lld%lld", &w, &v);
        if (i) {
            for (int j = 0; j <= m; ++j)
                if (j < w)
                    dp[i][j] = dp[i - 1][j];
                else
                    dp[i][j] = max(dp[i - 1][j], dp[i - 1][j - w] + v);
        } else {
            for (int j = w; j <= m; ++j)
                dp[0][j] = v;
        }
    }
    printf("%lld\n", dp[n - 1][m]);
}

Measured memory_bytes: 80128
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
const int MOD = 1000000007;

int main()
{
    int N;
    cin >> N;
    vector<int> L(N);
    rep(i, N)
    {
        cin >> L.at(i);
    }
    sort(all(L));
    int ans = 0;
    for (int i = N - 1; i >= 0; i--)
    {
        for (int j = i - 1; j >= 0; j--)
        {
            for (int k = j - 1; k >= 0; k--)
            {
                if (L.at(i) < L.at(j) + L.at(k))
                {
                    ans++;
                }
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
fn main() {
    let v = read::<String>().chars().collect::<Vec<_>>();
    let x = v[0];
    let y = v[2];

    if x < y {
        println!("<");
    } else if x > y {
        println!(">");
    } else {
        println!("=");
    }
}

#[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");
    }
}


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

int main(){
	int n;
	cin>>n;
	vector<int> b(n);
	for(int i=0;i<n;i++)cin>>b[i];
	int ans[n],cnt=0;
	//cout<<"aa"<<endl;

	for(int i=0;i<n;i++){
		if(b.empty())break;
		for(int j=b.size()-1;j>=0;j--){
			if(b.empty())break;
			if(j+1==b[j]){
				ans[cnt]=b[j];
				//cout<<"a:"<<ans[cnt]<<endl;
				b.erase(b.begin()+j);
				cnt++;
				break;
			}
		}
		if(i==n-1&&!b.empty()){
			cout<<-1<<endl;
			return 0;
		}
	}
	for(int i=n-1;i>=0;i--)cout<<ans[i]<<endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

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

    Scanner sc = new Scanner(System.in);

    String[] a = sc.nextLine().split(" ");
    
    int[] nums = new int[a.length];
    
    for(int i=0; i<nums.length; i++) {
      nums[i] = Integer.parseInt(a[i]);
    }
    
    for(int i = 0; i<nums.length; i++) {
      if (nums[i] == 0) {
        System.out.println(i+1);
        break;
      }
    }
    
    


  }
}

Measured memory_bytes: 35700
#include <iostream>
#include <cstring>
#include <vector>
#include <cstdio>
#include <stack>
#include<queue>
#include<list>
//#include<bits/stdc++.h>

int main()
{

    int n,q,tmp,b,e;
    long k;
    long a[1000];
    std::cin>>n;
 
    for(int i = 0; i < n; i++)
    {
        std::cin>>a[i];
    }

    std::cin>>q;

    for(int i = 0; i < q; i++)
    {
        std::cin>>b>>e>>k;
        //std::cout<<"flag1"<<std::endl;
        int cnt = 0;
        for(int j=b; j<e; j++)
        {
            //std::cout<<"flag2"<<std::endl;
            if(a[j]==k)
            {
                //std::cout<<"flag3"<<std::endl;
                cnt++;
            }
        }
        std::cout<<cnt<<std::endl;
    }
    return 0;
}



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


int main() {
  int A, B, C;
  cin >> A >> B;
  C = A + B;
  if (A % 3 == 0 || B % 3 == 0 || C % 3 == 0) cout << "Possible" << endl;
  else cout << "Impossible" << endl;
}

Measured memory_bytes: 3572
n=int(input())
s=[int(input()) for i in range(n)]
s.sort()

ans=sum(s)
if ans%10!=0:
  print(ans)
  exit()

t_ans=ans
for i in range(n):
  t_ans-=s[i]

  if t_ans%10!=0:
    print(t_ans)
    exit()

  i+=1
  t_ans=ans

print(0)

Measured memory_bytes: 3064
using System;
using System.Collections;
using System.Collections.Generic;

namespace A
{
    class Program
    {
        public class TupleList<T1, T2, T3> : List<Tuple<int, int, string>>
        {
            public void Add(int item1, int item2, string s)
            {
                Add(new Tuple<int, int, string>(item1, item2, s));
            }
        }
        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split(' ');
            int count_5 = 0;
            int count_7 = 0;
            for(int i = 0; i<3; i++)
            {
                if (int.Parse(input[i]) == 5) count_5++;
                if (int.Parse(input[i]) == 7) count_7++;
            }

            if (count_5 == 2 && count_7 == 1) Console.WriteLine("YES");
            else Console.WriteLine("NO");
        }
    }
}


Measured memory_bytes: 2648
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define reps(i,s,n) for(int i=(s); i<(n); i++)
#define all(v) v.begin(),v.end()
#define res(n) resize(n)
#define rev(v) reverse(v.begin(),v.end())
#define sor(v) sort(v.begin(),v.end())
#define outve(v) for(auto i : v) cout << i << " ";cout << endl
#define in(n,v) for(int i=0; i<(n); i++){cin >> v[i];}
#define out(n) cout << (n) << endl
#define fi first
#define se second
#define ve vector
#define pq priority_queue
#define vi vector<int>
#define vl vector<long long>
#define vii vector<vector<int>>
using namespace std;
typedef long long ll;
typedef long double ld;
const ll mod = 1000000007;



int main()
{

    int N,M;
    cin >> N >> M;
    vi p(M);
    ve<string> S(M);
    rep(i,M){
        cin >> p[i] >> S[i];
    }
    
    vi ac(N,0),wa(N,0);

    rep(i,M){
        if(S[i] == "AC") ac[p[i]-1] = 1;
        else{
            if(ac[p[i]-1] == 0) wa[p[i]-1]++;
        }
    }
    int an_a = 0,an_b = 0;

    rep(i,N){
        an_a += ac[i];
        if(ac[i] == 1) an_b += wa[i];
    }
    
    cout << an_a << " " << an_b << endl;

    
    return 0;
}


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

typedef long long ll;
typedef pair<ll, ll> P;


#define rep(i,n) for(ll (i)=0; (i)<(ll)(n); (i)++)
#define frep(i,m,n) for(ll (i)=(m); (i)<=(ll)(n); (i)++)
#define rrep(i,n) for(ll (i)=(n)-1; (i)>-1; (i)--)
#define frrep(i,m,n) for(ll (i)=(n); (i)>(ll)(m); (i)--)
#define ALL(x) (x).begin(), (x).end()

const ll INF = 100100100100100100;
const ll MOD = 1000000007;

// get abs
ll my_abs(ll a);
// a^n
ll a_n(ll a, ll n);
// get gcd
ll my_gcd(ll a, ll b);
// a^(-1) % MOD 
ll inv(ll a);
// (a+b+c)%MOD
ll madd(ll a, ll b, ll c);
// (a-b)%MOD
ll msub(ll a, ll b);
// (a*b*c)%MOD
ll mtime(ll a, ll b, ll c);


int main() {
    ll n, ans = 0; cin >> n;
    vector<ll> l(n);
    rep(i, n) cin >> l[i];
    sort(ALL(l));

    frep(i, 0, n-3) {
        frep(j, i+1, n-2) {
            frep(k, j+1, n-1) {
                if(l[i] != l[j] && l[j] != l[k]) {
                    if(l[i]+l[j] > l[k]) ans++;
                }
            }
        }
    }
    cout << ans << endl;

    return 0;
}

ll my_abs(ll a) {
    if(a >= 0) return a;
    else return -1 *a;
}

ll a_n(ll a, ll n) { 
    if(n == 0) return 1;
    
    ll ret = a, count = 1;
    while(count * 2 < n) {
        ret *= ret;
        count *= 2;
    }
    if(count == n) return ret;
    else return (ret * a_n(a, n-count));
}

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

ll inv(ll a) {
    return a_n(a, MOD-2);
}

ll madd(ll a, ll b, ll c) {
    ll ret = (a+b) % MOD;
    return (ret+c) % MOD;
}

ll msub(ll a, ll b) {
    if(a < b) return (a-b+MOD) % MOD;
    else return (a-b) % MOD;
}

ll mtime(ll a, ll b, ll c) {
    ll ret = (a*b) % MOD;
    return (ret*c) % MOD;
}


Measured memory_bytes: 3596
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
using namespace std;
int main() {
    vector<int> cnt(4, 0);
    for (int i = 0; i < 6; ++i) {
        int a; cin >> a; cnt[a - 1]++;
    }
    if (cnt[0] == 1 && cnt[3] == 1 && cnt[1] == 2 && cnt[2] == 2) printf("%s\n", "YES");
    else printf("%s\n", "NO");
}


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

typedef long long ll;

using namespace std;

#define swap(a, b)    do { typeof(a) __tmp = (a); (a) = (b); (b) = __tmp; } while(0)
#define repd(i, a, b) for(typeof(b) i = a; i < (b); ++i)
#define rep(i, n)     repd(i, 0, n)
#define dump(x)       cerr << #x << " = " << (x) << endl
#define debug(x)      cerr << "L" << __LINE__ << ": " << #x << " = " << (x) << endl
#define YesNo(x)      cout << ((x) ? "Yes" : "No") << endl
#define YESNO(x)      cout << ((x) ? "YES" : "NO") << endl
#define absi(x)       ( ((x) >= 0) ? (x) : (-(x)) )

int main(int argc, const char* argv[]) {
	ll n;
	cin >> n;

	ll first_value = 0;
	ll second_value = 0;
	bool is_first_multiple = false;
	vector<ll> a(n);
	rep(i, n) {
		cin >> a[i];
		if(a[i] > first_value) {
			second_value = first_value;
			first_value = a[i];
			is_first_multiple = false;
		} else if(a[i] == first_value) {
			is_first_multiple = true;
		} else if(a[i] > second_value) {
			second_value = a[i];
		}
	}

	rep(i, n) {
		if(a[i] < first_value) {
			cout << first_value << endl;
		} else {
			if(is_first_multiple) {
				cout << first_value << endl;
			} else {
				cout << second_value << endl;
			}
		}
	}

	return 0;
}


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

int main() {

	ll n; cin >> n;
	ll Inf = 1000000000;
	vector<ll> dp(n + 1, Inf); // 回数
	dp[0] = 0;
	for (int i = 1; i <= n; i++) {
		for (int price = 1; price <= i; price *= 6) {
			dp[i] = min(dp[i], dp[i - price] + 1);
		}
		for (int price = 9; price <= i; price *= 9) {
			dp[i] = min(dp[i], dp[i - price] + 1);
		}		
	}
	cout << dp[n] << endl;
	return 0;
}

Measured memory_bytes: 3872
#include<iostream>
#include<stdio.h>
//#include <bits/stdc++.h>
#include<vector>
#include<float.h>
#include<iomanip>
#include<algorithm>
#include<string>
#include<cstring>
#include<math.h>
#include<cmath>
#include<sstream>
#include<set>
#include<map>
#include<queue>
#include<cassert>
#include<cmath>
#include<cstdint>
 
#define INF 1e9
#define LINF 1e19
#define rep(i,n)for(int i=0;(i)<(int)(n);i++)
#define REP(i,a,b)for(int i=(int)(a);(i)<=(int)(b);i++)
#define VEC(type, c, n) std::vector<type> c(n);for(auto& i:c)std::cin>>i;
#define vec(type,n) vector<type>(n)
#define vvec(m,n) vector<vector<int>> (int(m),vector<int>(n))
#define ALL(a)  (a).begin(),(a).end()
#define chmin(a, b) a = min(a, b)
#define chmax(a, b) a = max(a, b)
     
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
using P = pair<ll, ll>;
     
const ll MOD = 1e9 + 7;
const ll ZER = 0;
 


int main(){
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i, n)cin >> a[i];

  sort(ALL(a));
  int res = 0;
  rep(i, n){
    REP(j, i + 1, n - 2){
      REP(k, j + 1, n - 1){
        if(a[i] == a[j] || a[j] == a[k])continue;
        if(a[i] + a[j] > a[k])res++;
      }
    }
  }
  cout << res << endl;
}
 

Measured memory_bytes: 3632
#include<cstdio>
#include<cstring>
#include<algorithm>
const int N=58;
int x[N],y[N];
struct node
{
	int x,y;
}e[N];
inline long long min(long long a,long long b)
{
	return a<b?a:b;
}
int main()
{
	int n,k;
	scanf("%d %d",&n,&k);
	for(int i=1;i<=n;i++)
	{
		int u,v;
		scanf("%d %d",&u,&v);
		e[i].x=u,e[i].y=v;
		x[i]=u,y[i]=v;	
	}
	std::sort(x+1,x+1+n);
	std::sort(y+1,y+1+n);
	long long ans=(long long)(x[n]-x[1])*(y[n]-y[1]);
	for(int i=1;i<=n;i++)
	for(int j=i+1;j<=n;j++)
	for(int p=1;p<=n;p++)
	for(int q=p+1;q<=n;q++)
	{
		int sum=0;
		for(int k=1;k<=n;k++)
		if(e[k].x<=x[j]&&e[k].x>=x[i]&&e[k].y>=y[p]&&e[k].y<=y[q])	sum++;
		if(sum>=k)	ans=min(ans,(long long )(x[j]-x[i])*(y[q]-y[p]));	
	}
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 256
IDENTIFICATION DIVISION.
PROGRAM-ID. PROGRAM_ID.

DATA DIVISION.
WORKING-STORAGE SECTION.
01 a          PIC 9(10).
01 ans        PIC 9(10).
01 zs         PIC Z(9)9.

PROCEDURE DIVISION.
  ACCEPT a.
  COMPUTE ans = a + a ^ 2 + a ^ 3.
  MOVE ans TO zs.
  DISPLAY FUNCTION TRIM(zs).
  STOP RUN.


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

signed main() {
  int n,j;
  cin>>n;
  std::vector<int> v(n);
  int b=0;
  for(int i=0;i<n;i++)cin>>v[i];
  for(j=0;b==0;j++){
    for(int i=0;i<n;i++){
      if(v[i]%2==0)v[i]/=2;
      else b=1;
  }
}
cout<<j-1<<endl;
}


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

int main() {
  string s;cin>>s;
  int n=0;
  if (s=="RRR")cout<<3;
  else if (s=="RRS" || s=="SRR") cout<<2;
  else if (s=="SSS") cout<<0;
  else cout<<1;
}


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

using namespace std;

int main(){
   int X,Y;
   cin >> X>> Y;
   cout << X + Y/2 << endl;
   return 0;
}


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

using namespace std;

const unsigned long long MOD = 1000000007LL;
long long GCD(long long a, long long b){return b == 0 ? a : GCD(b, a % b);}
long long fast_exp(long long base, long long exp) {
    long long tot = 1;
    for(;exp > 0;exp >>= 1) {
       if((exp & 1) == 1) tot = tot * base % MOD;
       base = base * base % MOD;
    }
    return tot;
}

int main(){

    cin.sync_with_stdio(0); cin.tie(0); cout.tie(0);

    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);

    // aoki will only need to change a store that will give Takahashi the max profit.
    // so answer will be the number of ways to get the max profit

    // but what if you buy at more than 1 store? something like 1 5 2 6 ? wouldnt the expected profit by greater if you buy from 1 and 2, then sell at 5 and 6?
    // if thats the case isnt always just 1..?

    int n, t; cin >> n >> t;

    long long j, c = 0, m = -1, mi = 1e9;

    for(int i = 0; i < n; ++i){
        cin >> j;
        mi = min(mi, j);
        if(j - mi == m){
            ++c;
        } else if(j - mi > m){
            c = 1;
            m = j - mi;
        }
    }

    cout << c;

    return 0;

}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define int long long
#define FOR(i, a, b) for(int i=(a);i<(b);i++)
#define RFOR(i, a, b) for(int i=(b-1);i>=(a);i--)
#define REP(i, n) for(int i=0; i<(n); i++)
#define RREP(i, n) for(int i=(n-1); i>=0; i--)
#define REP1(i, n) for(int i=1; i<=(n); i++)
#define RREP1(i, n) for(int i=(n); i>=1; i--)
#define ALL(a) (a).begin(),(a).end()
#define UNIQUE_SORT(l) sort(ALL(l)); l.erase(unique(ALL(l)), l.end());
#define CONTAIN(a, b) find(ALL(a), (b)) != (a).end()
#define out(...) printf(__VA_ARGS__)
#if DEBUG
#define debug(...) printf(__VA_ARGS__)
#else
#define debug(...) /* ... */
#endif
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return true;}return false;}
template<class T>bool chmin(T &a,const T &b){if(b<a){a=b;return true;}return false;}

void solve();
signed main()
{
#if DEBUG
    std::ifstream in("input.txt");
    std::cin.rdbuf(in.rdbuf());
#endif
    cin.tie(0);
    ios::sync_with_stdio(false);
    solve();
    return 0;
}
/*================================*/
#if DEBUG
#define SIZE 100
#else
#define SIZE 223450
#endif

int N,Q,K;

typedef tuple<int,int,char> Key;
map<Key, set<int>> M;

struct Item2{int x,y; char u;};
vector<Item2> V;
map<int, set<int>> ds,ls;

void solve() {
    cin>>N;
    int x,y;
    char u;
    REP(i,N) {
        cin>>x>>y>>u;
        M[{1,y-x,u}].insert(x);
        M[{-1,y+x,u}].insert(x);
        V.push_back({x,y,u});
        if (u=='D') ds[x].insert(y);
        if (u=='L') ls[y].insert(x);
    }
    int ans = INT_MAX;
    REP(i,N) {
        auto [x,y,u] = V[i];
        if (u=='R') {
            {
                auto s = &M[{1,y-x,'D'}];
                auto it = s->upper_bound(x);
                if (it != s->end()) chmin(ans, (*it - x) * 10);
            }
            {
                auto s = &M[{-1,y+x,'U'}];
                auto it = s->upper_bound(x);
                if (it != s->end()) chmin(ans, (*it - x) * 10);
            }
            {
                auto s = &ls[y];
                auto it = s->upper_bound(x);
                if (it != s->end()) {
                    chmin(ans, (*it - x) * 5);
                }
            }
        }
        if (u=='L') {
            {
                auto s = &M[{1,y-x,'U'}];
                auto it = s->lower_bound(x);
                if (it != s->begin()) chmin(ans, (x - *(--it)) * 10);
            }
            {
                auto s = &M[{-1,y+x,'D'}];
                auto it = s->lower_bound(x);
                if (it != s->begin()) chmin(ans, (x - *(--it)) * 10);
            }
        }
        if (u=='U') {
            auto s = &ds[x];
            auto it = s->upper_bound(y);
            if (it != s->end()) {
                chmin(ans, (*it - y)*5);
            }
        }
    }
    
    if (ans==INT_MAX) {
        cout << "SAFE" << endl;
    } else {
        cout << ans << endl;
    }
}



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

struct Point {
    double x, y;
};

double th = M_PI * 60.0 / 180.0;

void koch(int N, Point p1, Point p2)
{
    if (N == 0)
        return;

    Point s, u, t;
    s.x = (2 * p1.x + 1 * p2.x) / 3;
    s.y = (2 * p1.y + 1 * p2.y) / 3;

    t.x = (1 * p1.x + 2 * p2.x) / 3;
    t.y = (1 * p1.y + 2 * p2.y) / 3;

    u.x = (t.x - s.x) * cos(th) - (t.y - s.y) * sin(th) + s.x;
    u.y = (t.x - s.x) * sin(th) + (t.y - s.y) * cos(th) + s.y;

    koch(N - 1, p1, s);
    // cout << s.x << " " << s.y << endl;
    printf("%.8f %.8f\n", s.x, s.y);

    koch(N - 1, s, u);
    // cout << u.x << " " << u.y << endl;
    printf("%.8f %.8f\n", u.x, u.y);

    koch(N - 1, u, t);
    // cout << t.x << " " << t.y << endl;
    printf("%.8f %.8f\n", t.x, t.y);

    koch(N - 1, t, p2);
    // cout << p2.x << " " << p2.y << endl;
}

int main() {
    int N;
    cin >> N;
    Point p1, p2;
    p1.x = 0.0;
    p1.y = 0.0;
    p2.x = 100.0;
    p2.y = 0.0;

    // cout << fixed << setprecision(8) << p1.x << " " << fixed << s p1.y << endl;
    printf("%.8f %.8f\n", p1.x, p1.y);
    koch(N, p1, p2);
    printf("%.8f %.8f\n", p2.x, p2.y);
}


Measured memory_bytes: 3392
import sys
import math
from collections import Counter
import itertools
#from functools import reduce

# 入力を整数に変換して受け取る
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def MI1(): return map(int1, sys.stdin.readline().split())
# 入力全てを整数に変換したものの配列を受け取る
def LI(): return list(map(int, sys.stdin.readline().split()))
# 入力全てを整数に変換して1引いたものの配列を受け取る
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def SR(): return sys.stdin.readline().rstrip()

ascii_lowercase = 'abcdefghijklmnopqrstuvwxyz'
ascii_uppercase = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
ascii_uppercase2 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ'

# リストを改行区切りで出力する
p2D = lambda x: print(*x, sep="\n")
p2E = lambda x: print(''.join(x))
p2S = lambda x: print(*x, sep=" ")

# ###########################################

s=SR()
atcoder=0
m=0
target=('A','C','G','T')

for i in range(len(s)):
    if s[i] in target:
        atcoder+=1
    else:
        m=max(m,atcoder)
        atcoder=0
print(max(atcoder,m))

Measured memory_bytes: 3316
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<tuple>
#include<cassert>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll mod = 1000000007;
const ll INF = (ll)1000000007 * 1000000007;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define Per(i,sta,n) for(int i=n-1;i>=sta;i--)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef long double ld;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<ll, ll> LP;
int dx[4]={1,-1,0,0};
int dy[4]={0,0,1,-1};

int n,m;
ll k;
ll a[200010],b[200010];
vector<ll> S;

void solve(){
    cin >> n >> m >> k;
    rep(i,n) cin >> a[i];
    S.resize(m+1);
    rep(i,m) {
        cin >> b[i];
        S[i+1]=S[i]+b[i];
    }
    int ans=0;
    ll A=0;
    int num_=upper_bound(S.begin(),S.end(),k-A)-S.begin()-1;
    ans=max(ans,num_);
    rep(i,n){
        A+=a[i];
        int num=upper_bound(S.begin(),S.end(),k-A)-S.begin()-1;
        if(num<0) continue;
        ans=max(ans,i+1+num);
    }
    cout << ans << endl;
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(50);
    solve();
}

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

int main() {
  int A,B,C;
  cin >>A>>B>>C;
  if(A==B && A!=C){
    cout << "Yes" << endl;
  }
  else if(A==C && B!=C){
    cout << "Yes" << endl;
  }
  else if(C==B && A!=C){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
}

// int型の2次元配列(3×4要素の)の宣言
  //vector<vector<int>> data(3, vector<int>(4));

  // 入力 (2重ループを用いる)
  //for (int i = 0; i < 3; i++) {
    //for (int j = 0; j < 4; j++) {
      //cin >> data.at(i).at(j);
    //}
  //}

Measured memory_bytes: 256