akhauriyash/Code-Regression huggingface dataset:
#include<iomanip>
#include<limits>
#include<thread>
#include<utility>
#include<iostream>
#include<string>
#include<algorithm>
#include<set>
#include<map>
#include<vector>
#include<stack>
#include<queue>
#include<cmath>
#include<numeric>
#include<cassert>
#include<random>
#include<chrono>
#include<unordered_map>
#include<fstream>
#include<list>
#include<functional>
#include<bitset>
#include<complex>
using namespace std;
typedef unsigned long long int ull;
typedef long long int ll;
typedef pair<ll,ll> pll;
typedef pair<int,int> pi;
typedef pair<double,double> pd;
typedef pair<double,ll> pdl;
#define F first
#define S second
const ll E=1e18+7;
const ll MOD=1000000007;

bool judge(string s){
    ll count[3]={};
    for(int i=0;i<s.size();i++){
        if(s[i]=='7'){count[0]++;}
        else if(s[i]=='5'){count[1]++;}
        else if(s[i]=='3'){count[2]++;}
        else{return false;}
    }
    return count[0] && count[1] && count[2];
}

vector<ll> A={7,5,3,0};

ll n;

ll dfs(ll num,ll depth){
    if(depth==9){
        return num<=n && num>0 && judge(to_string(num));
    }
    ll count=0;
    for(int i=0;i<4;i++){
        count+=dfs(num*10+A[i],depth+1);
    }
    return count;
}


int main(){
    cin>>n;
    cout<<dfs(0,0)<<endl;
    
    
    
    return 0;
}


Measured memory_bytes: 256
import java.util.*;

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

        int M = sc.nextInt();

        if(M >= 24){
            System.out.println(24-M);
        }else{
            System.out.println(24-M + 24);
        }
    }
}

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

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<string, string> pss;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vii;
typedef vector<ll> vl;
typedef vector<vl> vvl;

double EPS=1e-9;
int INF=1000000005;
long long INFF=1000000000000000005ll;
double PI=acos(-1);
int dirx[8]={ -1, 0, 0, 1, -1, -1, 1, 1 };
int diry[8]={ 0, 1, -1, 0, -1, 1, -1, 1 };
const ll MOD = 1000000007;

ll sum() { return 0; }
template<typename T, typename... Args>
T sum(T a, Args... args) { return a + sum(args...); }

#define DEBUG fprintf(stderr, "====TESTING====\n")
#define VALUE(x) cerr << "The value of " << #x << " is " << x << endl
#define OUT(x) cout << x << endl
#define OUTH(x) cout << x << " "
#define debug(...) fprintf(stderr, __VA_ARGS__)
#define READ(x) for(auto &(z):x) cin >> z;
#define FOR(a, b, c) for (int(a)=(b); (a) < (c); ++(a))
#define FORN(a, b, c) for (int(a)=(b); (a) <= (c); ++(a))
#define FORD(a, b, c) for (int(a)=(b); (a) >= (c); --(a))
#define FORSQ(a, b, c) for (int(a)=(b); (a) * (a) <= (c); ++(a))
#define FORC(a, b, c) for (char(a)=(b); (a) <= (c); ++(a))
#define EACH(a, b) for (auto&(a) : (b))
#define REP(i, n) FOR(i, 0, n)
#define REPN(i, n) FORN(i, 1, n)
#define MAX(a, b) a=max(a, b)
#define MIN(a, b) a=min(a, b)
#define SQR(x) ((ll)(x) * (x))
#define RESET(a, b) memset(a, b, sizeof(a))
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define ALL(v) v.begin(), v.end()
#define ALLA(arr, sz) arr, arr + sz
#define SIZE(v) (int)v.size()
#define SORT(v) sort(ALL(v))
#define REVERSE(v) reverse(ALL(v))
#define SORTA(arr, sz) sort(ALLA(arr, sz))
#define REVERSEA(arr, sz) reverse(ALLA(arr, sz))
#define PERMUTE next_permutation
#define TC(t) while (t--)
#define FAST_INP  ios_base::sync_with_stdio(false);cin.tie(NULL)
#define what_is(x) cerr << #x << " is " << x << endl;

bool ok(int n){
	FORSQ(i,1,n){
		if((n%i==0)&&(n/i==i)){
			return true;
		}
	}
	return false;
}

void solve() {

}

int main()
{
    FAST_INP;
//    #ifndef ONLINE_JUDGE
//    freopen("input.txt","r", stdin);
//    freopen("output.txt","w", stdout);
//    #endif

//    int tc; cin >> tc;
//    TC(tc) solve();

	int n, d, ans=0;
	cin >> n >> d;
	vvi x(n,vi(d));
	REP(i,n) REP(j,d) cin >> x[i][j];
	REP(i,n) {
		FOR(j,i+1,n) {
			int sq=0;
			REP(k,d){
				int diff=abs(x[i][k]-x[j][k]);
				sq+=diff*diff;
			}
			if(ok(sq)) ans++;
		}
	}
	OUT(ans);
    return 0;
}

Measured memory_bytes: 3636
#include <iostream>
#define ll long long
const int N=2e5+5;
ll a[N],b[N];
using namespace std;
int main(){
	int n;
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>b[i];
		a[b[i]]++;
	}
	long long sum=0;
	for(int i=1;i<N;i++){
		sum+=(a[i]*(a[i]-1)/2);
	}
	// cout<<"sum: "<<sum<<endl; 
	for(int i=0;i<n;i++)
		cout<<sum-a[b[i]]+1<<endl;
	return 0;
}

Measured memory_bytes: 4736
import collections as cl
from operator import itemgetter, attrgetter
n = int(input())
s = []
for i in range(n):
    s.append(input())
h = cl.Counter(s)
itm = h.items()

m = max(list(h.values()))
#mlist = [i[0] for i in itm if lambda x:x[1] == m]
mfil = list(filter(lambda x:x[1]==m ,itm))
mfil = sorted(mfil,key=itemgetter(0))
for j in mfil:
    print(j[0])

Measured memory_bytes: 49944
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <chrono>
#define _USE_MATH_DEFINES
#include <cmath>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iostream>
#include <iterator>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <tuple>
#include <utility>
#include <vector>
using namespace std;

#define FOR(i,m,n) for(int i=(m);i<(n);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()

const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;
const double EPS = 1e-8;
const int MOD = 1000000007; // 998244353;
const int dy[] = {1, 0, -1, 0}, dx[] = {0, -1, 0, 1};
/*-------------------------------------------------*/
int main() {
  cin.tie(nullptr); ios::sync_with_stdio(false);
  // freopen("input.txt", "r", stdin);

  int n, m; cin >> n >> m;
  vector<vector<int> > graph(n);
  while (m--) {
    int a, b; cin >> a >> b; --a; --b;
    graph[a].emplace_back(b);
    graph[b].emplace_back(a);
  }
  vector<int> path{0, graph[0][0]};
  vector<bool> visited(n, false);
  visited[0] = visited[graph[0][0]] = true;
  bool flag = true;
  while (flag) {
    int now = path.back();
    flag = false;
    for (int e : graph[now]) {
      if (!visited[e]) {
        visited[e] = true;
        path.emplace_back(e);
        flag = true;
        break;
      }
    }
  }
  reverse(ALL(path));
  flag = true;
  while (flag) {
    int now = path.back();
    flag = false;
    for (int e : graph[now]) {
      if (!visited[e]) {
        visited[e] = true;
        path.emplace_back(e);
        flag = true;
        break;
      }
    }
  }
  int sz = path.size();
  cout << sz << '\n';
  REP(i, sz) cout << path[i] + 1 << (i + 1 == sz ? '\n' : ' ');
  return 0;
}


Measured memory_bytes: 6776
//#include<bits/stdc++.h>
#include<iostream>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<set>
#include<map>

/*
#include<boost/multiprecision/cpp_int.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/rational.hpp>
namespace mp = boost::multiprecision;
using Real = mp::number<mp::cpp_dec_float<1024>>;
using Bint = mp::cpp_int;
*/

using namespace std;

#define int long long
#define REP(i,s,e) for((i)=(s);(i)<(e);(i)++)
#define RREP(i,s,e) for((i)=((s)-1);(i)>=(e);(i)--)
#define FOR(i,n) for((i)=(0);(i)<(n);(i)++)
#define RFOR(i,n) for((i)=((n)-1);(i)>=(0);(i)--)
#define MOD 1000000007
#define MAX 200

signed main(){
    int X,Y;
    cin>>X>>Y;

    int sum=0;
    if(X==1) sum+=300000;
    if(X==2) sum+=200000;
    if(X==3) sum+=100000;
    if(Y==1) sum+=300000;
    if(Y==2) sum+=200000;
    if(Y==3) sum+=100000;
    if(X==1&&Y==1) sum+=400000;

    cout<<sum<<endl;
}


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

int main() {
  int N,a,b,c,d;
  cin >> N;
  a=N/1000;
  b=(N-a*1000)/100;
  c=(N-a*1000-b*100)/10;
  d=N-a*1000-b*100-c*10;
  if (a==b&&b==c)
    cout << "Yes" << endl;
  else if (c==d&&b==c)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<cstring>
#include<queue>
#include<tuple>
#include<utility>
#include<map>
#include<math.h>
#include<iomanip>
#include<stdio.h>
#include<stdlib.h>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define range(a) a.begin(), a.end()
#define endl "\n"
#define Yes() cout << "Yes" << endl
#define No() cout << "No" << endl
using Graph = vector<vector<int>>;
const unsigned long long mod = 1e9 + 7;
const long long INF = 1LL<<60;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
void chmin(long long &a, long long b) { if (a > b) a = b; }
void chmax(long long &a, long long b) { if (a < b) a = b; }

int main(void){
	ios::sync_with_stdio(0);
	cin.tie(0);
	vector<ll>	data;
	int N,K;	cin>>N>>K;	ll A;
	FOR(i,0,N){
		cin>>A;
		data.push_back(A);
	}

	FOR(i,0,N-K){
		if(data.at(i)>=data.at(i+K))	No();
		else Yes();
	}


    return 0;
}




Measured memory_bytes: 5316
#include <stdio.h>

int main(void)
{
  int a,b;
  scanf("%d %d",&a,&b);

  int i=0;
  if(b==1)
    printf("0\n");
  else{
    b-=a;
    i++;
    while(b>0){
      b-=(a-1);
      i++;
    }
    printf("%d\n",i);
  }
  return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <math.h>
#include <queue>
using namespace std;
#define rep(i,m,n) for(int i=m;i<n;i++)

typedef long long ll;

class node {
  vector<int> vlist;
public:
  int append_edge(int v) {
    (this->vlist).push_back(v);
    return 0;
  };
  vector<int> edge_list() {
    return this->vlist;
  };
};

int main(int argc, char *argv[]) {
  int n,m,s,t,u,v;
  vector<int> list1,list2,list3;
  node *a;

  cin >> n >> m;
  a = new node[3*n];
  rep(i,0,m) {
    cin >> u >> v;
    u--; v--;
    a[3*u].append_edge(3*v+1);
    a[3*u+1].append_edge(3*v+2);
    a[3*u+2].append_edge(3*v);
  }
  cin >> s >> t;
  s--; t--;
  
  
  bool *b;
  b = new bool[3*n];
  rep(i,0,3*n) b[i] = false;

  priority_queue<pair<int,int> > q;
  pair<int,int> p,r;
  r.first = 0; r.second = 3*s;
  q.push(r);
  while(!q.empty()) {
    p = q.top(); q.pop();
    if(p.second==3*t) {
      cout << (-1*p.first)/3 << endl;
      return 0;
    }
    vector<int> list = a[p.second].edge_list();
    rep(i,0,list.size()) {
      if(!b[list[i]]) {
	r.first = p.first-1; r.second = list[i];
	q.push(r);
	b[list[i]] = true;
      }
    }
  }

  cout << -1 << endl;


  delete[] b;
  
  return 0;
}


Measured memory_bytes: 16896
process.stdin.resume();
process.stdin.setEncoding("utf8");

const reader = require("readline").createInterface({
  input: process.stdin,
  output: process.stdout,
});

const lines = [];

reader.on("line", (line) => {
  lines.push(line);
});

reader.on("close", () => {
  let [top, back, right, left, front, bottom] = lines[0].split(" ").map(Number);
  const rs = lines[1];
  for (let i = 0; i < rs.length; i++) {
    switch (rs[i]) {
      case "N":
        [top, front, bottom, back] = [back, top, front, bottom];
        break;
      case "S":
        [top, front, bottom, back] = [front, bottom, back, top];
        break;
      case "W":
        [top, left, bottom, right] = [right, top, left, bottom];
        break;
      case "E":
        [top, left, bottom, right] = [left, bottom, right, top];
        break;
    }
  }
  console.log(top);
});



Measured memory_bytes: 16480
#include<bits/stdc++.h>
 
using namespace std;
 
#define rep(i,n) for(int i=0 ; i<(n) ; i++)
#define repr(i,n) for(int i=(n) ; i>=0 ; i--)
#define ALL(x) (x).begin(),(x).end()
 
int GCD(int a,int b){ return b ? GCD(b,a%b) : a ;}
int LCM(int a,int b){ return a*b / GCD(a,b) ;}
 
typedef long long ll;
typedef unsigned long long ull;
 
const int INF = 1e9;
const int MOD = 1e9+7;

int main(){
      string s;
      cin >> s;
      if(count(ALL(s),'x')>=8)cout << "NO" << endl;
      else cout << "YES" << endl;
      return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
#ifdef _debug
#define dout(i) cout << #i << ' ' << i << ' '
#else 
#define dout(i) //
#endif
using ll = long long;
using ull = unsigned long long;
using ul = unsigned;
using db = double;
int n;
const int maxn = 300;
int con[maxn][maxn];
int res = -1;
int pick(int root){
	set<int> last, now, put, next;
	int res = 0;
	now.insert(root);
	for(;now.size();++res){
		for(auto &i : now){
			for(int j = 1;j <= n;++j){
				if(con[i][j]){
					if(!last.count(j)){
						if(put.count(j))return -1;
						next.insert(j);
					}
				}
			}
		}
		for(auto &i : next)put.insert(i);
		last = now;
		now = next;
		next.clear();
	}
	return res;
}
int main(){
	ios_base::sync_with_stdio(0), cin.tie(0);
	cin >> n;
	for(int i = 1;i <= n;++i)for(int j = 1;j <= n;++j){
		char c;
		cin >> c;
		con[i][j] = c == '1';
	}
	for(int i = 1;i <= n;++i)res = max(res, pick(i));
	cout << res << '\n';


}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i ,n) for(int i = 0 ; i < (n) ; i ++ )
#define mp(x,y) make_pair(x,y)
#define all(x) (x).begin(),(x).end()
using ll = long long;
using vin=vector<int>;
using vll=vector<ll>;
using P = pair<int, int>;
const int inf=1e9+7;
const ll INF=1e18;
template <typename T> void chmin(T &a, T b) { a = min(a, b); }
template <typename T> void chmax(T &a, T b) { a = max(a, b); }


int main() {
  int n,p;
  cin>>n>>p;
   vin a(n);
  rep(i,n) cin>>a[i];
  ////
  int iti=0,zero=0;
  rep(i,n){
    a[i]%=2;
    if(a[i]==1) iti++;
    else zero++;
  }
  if(iti>0)
  cout<<ll(pow(2,n-1))<<endl;
  else if(p==0) cout<<ll(pow(2,n))<<endl;
  else cout<<0<<endl;
}









Measured memory_bytes: 384
# -*- coding: utf-8 -*-
"""
Created on Sun May 26 20:55:50 2019

@author: Yamazaki Kenichi
"""

N = int(input())
sp = [list(map(str,input().split()))+[i] for i in range(N)]

for i in range(N):
    sp[i][1] = int(sp[i][1])

sp1 = sp[:]
sp1.sort(reverse = True, key=lambda x: x[1])
sp1.sort(key=lambda x: x[0])

#sp1.sort(reverse = True, key=lambda x: x[1])

for c in sp1:
    print(int(c[2])+1)

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

const int MOD = 1000000007;
#define p(var) std::cout<<#var" = "<<var<<std::endl
#define PI (acos(-1))
#define rep(i, n) for (int i = 0; i < (n); i++)
#define all(a) (a).begin(), (a).end()
#define pb push_back
using ll = long long;
template<typename T> inline T gcd(T a, T b) { return b ? gcd(b,a%b) : a;}
template<typename T> inline T lcm(T a, T b) { return a / gcd(a,  b) * b;}

int N;
//A=0 C=1 G=2 T=3
//arr[n][i][j][k] n+1文字の長さで、末尾3文字目がi,末尾3文字目がj,末尾3文字目がkで、条件を満たす文字列の数
ll arr[100][4][4][4];

//n+1文字の長さで、末尾4文字目がa4,末尾3文字目がa3,末尾2文字目がa2,末尾1文字目がa1で、条件を満たす文字列の数
ll isOK(int n,int a4,int a3,int a2,int a1){
    if(n<1)return 0;

    if(a3==0 && a2==2 && a1==1)return 0;
    if(a3==2 && a2==0 && a1==1)return 0;
    if(a3==0 && a2==1 && a1==2)return 0;

    if(n==2){
        return 1;
    }

    if(a4==0 && a2==2 && a1==1)return 0;
    if(a4==0 && a3==2 && a1==1)return 0;
    return arr[n-1][a4][a3][a2];
}



int main(){
    cin >> N;

    rep(i,4){
        rep(j,4){
            rep(k,4){
                arr[2][i][j][k]=isOK(2,-1,i,j,k);
            }
        }
    }

    rep(n,N){
        if(n<3)continue;
        rep(i,4){
            rep(j,4){
                rep(k,4){
                    //n文字の長さで条件を満たす文字列の数
                    // =n-1文字の長さの各パターンに、ACGTを付け足す
                    rep(l,4){
                        arr[n][j][k][l]+=isOK(n,i,j,k,l);
                        arr[n][j][k][l] %= MOD;
                    }
                }
            }   
        }   
    }

    ll a=0;
    rep(i,4){
        rep(j,4){
            rep(k,4){
                a+=arr[N-1][i][j][k];
                a %= MOD;
            }
        }   
    } 

    cout << a << endl;
    return 0;
    
}






Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cctype>
#include <complex>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>

using namespace std;

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
template<class T> inline T sqr(T x) {return x*x;}

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;

#define all(a)  (a).begin(),(a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define pb push_back
#define mp make_pair
#define each(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define exist(s,e) ((s).find(e)!=(s).end())
#define range(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)  range(i,0,n)
#define clr(a,b) memset((a), (b) ,sizeof(a))
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

const double eps = 1e-10;
const double pi  = acos(-1.0);
const ll INF =1LL << 62;
const int inf =1 << 29;

struct node {int to,cost; };

typedef vector< vector<node> > G;

inline void add_edge(G& g,int from,int to,int cost=1){
	node in; in.to=to; in.cost=cost;
	g[from].pb(in);
}

inline void add_both_edge(G& g,int from,int to,int cost=1){	
	add_edge(g,from,to,cost);
	add_edge(g,to,from,cost);
}

void dfs(const G& g,int cur,int prev,int &k,vi& order, vi& low,vi& parent) {
	order[cur]=k++;
	low[cur]=order[cur];

	rep(i,g[cur].size()){
		int to=g[cur][i].to;
		if(order[to]==-1){
			parent[to]=cur;
			dfs(g,to,cur,k,order,low,parent);
			low[cur]=min(low[cur],low[to]);
		}else if(to!=prev)
			low[cur]=min(low[cur],order[to]);
	}
	return;
}

void Lowlink(const G& g, vi& order,vi& low,vi& parent) {
	int v=g.size();
	order.assign(v,-1);
	low.resize(v);
	parent.resize(v);
	int k=0;
	parent[0]=-1;
	dfs(g,0,-1,k,order,low,parent);
	return ;
}

int main(void){
	int n,m;
	cin >> n >> m;
	G graph(n);
	rep(i,m){
		int a,b;
		cin >> a >> b;
		add_both_edge(graph,a,b);
	}
	vi order,low,parent;
	Lowlink(graph,order,low,parent);

	rep(i,n){
		if(i){
			bool ok=false;
			rep(j,graph[i].size()){
				int to=graph[i][j].to;
				if(i==parent[to]&&order[i]<=low[to])
					ok=true;
			}
			if(ok) cout << i << endl;
		}else{
			int d=0;
			rep(j,n) if(parent[j]==0) d++;
			if(d>=2) cout << i << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 3836
#include <iostream>
    #include <string>
    #include <cmath>
    using namespace std;
     
    int is_prime(int n){
        
        int i;
        i = 2;
        
        if (n == 1){
            return 0;
            
        } else if (n == 2){
            return 1;
            
        } else {
            while(1){
                if (n % i == 0){
                    return 0;
                    
                } else if (n < i * i){
                    return 1;
                    
                } else {
                    i++;
                }
            }
        }
        
        return 0;
    }
     
    int gcd(int m, int n){
        
        if (m % n == 0){
            return n;
        } else {
            return gcd(n, m % n);
        }
    }
     
    int is_set(int b[1145140], int n){
        
        int i;
        i = 2;
        
        if (n == 1) return 0;
        
        if (is_prime(n) == 1){
            if (b[n] == 1) {
                return 1;
            } else {
                b[n] = 1;
            }
            
        } else {
            while(n % i > 0){
                i++;
            }
                    
            if (b[i] == 1) {
                return 1;
                
            } else {
                b[i] = 1;
                
                while (n % i == 0){
                    n /= i;
                }
     
                return is_set(b, n);
            }
            
        }
        
        return 0;
    }
     
    int main(){
        
        int i, N, GCD, D, set;
        cin >> N;
        
        int a[N];
        int b[1145140];
        
        for (i = 0; i < N; i++){
            cin >> a[i];
        }
        
        for (i = 0; i < 100; i++){
            b[i] = 0;
        }
        
        for (i = 0; i < N; i++){
            if (i == 0){
                GCD = a[i];
                
            } else {
                D = gcd(GCD, a[i]);
                GCD = D;
            }
                    
            if (GCD == 1) break;
        }
        
        if (GCD > 1){
            cout << "not coprime\n";
            return 0;
        }
        
        for (i = 0; i < N; i++){
            set = is_set(b, a[i]);
            if (set == 1){
                cout << "setwise coprime\n";
                return 0;
            }
        }
        
        cout << "pairwise coprime\n";
        
        return 0;
    }

Measured memory_bytes: 7856
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

//Code Short
#define REP(i,n) for(int i = 0;i < n;++i)
#define PB(s) push_back(s)
#define DSORT(n) sort(n.begin(),n.end())
#define QECHO(n) cout << n
#define QECHOS(n) cout << n << " "

//Define Math
const double EPS = 1e-10;
const double PI  = acos(-1.0);

using namespace std;
typedef long long ll;
/* prototype */
int EDSum(ll);//各桁の和
vector<int> SOE(int,int);//素数 (Min,Max)
int MinCM(int,int);//最小公倍数(num1,num2)
int MaxCD(int,int);//最大公約数(num1,num2)
vector<int> igets(int);//cin * N
ll nPr(ll,ll); //(n,r)
ll nE(ll); //(n)
ll nCr(ll,ll); //(n,r)

void solve(){
    //START
    string S,T;
    cin >> S >> T;
    
    REP(i,S.length()+1){
      if(S==T){cout << "Yes" << endl;exit(0);}else{
        S = S[S.length()-1] + S;
        S.pop_back();
        //cout << S << endl;
      }
    }    
    cout << "No" << endl;
}

int main(void){cin.tie(0);ios::sync_with_stdio(false);solve();}
int EDSum(ll number) {
  int ans = 0;
  while (1) {
    ans += number % 10;
    number /= 10;
    if (number == 0) break;
  }
  return ans;
}

vector < int > SOE(int min, int max) {
  if (min < 2) min = 2;
  vector < int > int_array;
  for (int i = min; i <= max; i++) int_array.push_back(i);
  vector < int > sosu;
  double stop = sqrt(max);
  while (true) {
    sosu.push_back(int_array.front());
    int_array.erase(int_array.begin());
    if (stop < (double)(sosu.back())) break;
    for (int i = 0; i < (int) int_array.size(); i++) {
      if (int_array[i] % sosu.back() == 0)
        int_array.erase(int_array.begin() + i);
    }
  }
  sosu.insert(sosu.end(), int_array.begin(), int_array.end());
  return sosu;
}

int MinCM(int a, int b) {
  int c = a * b;
  if (a < b)
    swap(a, b);
  int r = a % b;
  while (r != 0) {
    a = b;
    b = r;
    r = a % b;
  }
  return c / b;
}

int MaxCD(int a, int b) {
  if (a < b)
    swap(a, b);
  int r = a % b;
  while (r != 0) {
    a = b;
    b = r;
    r = a % b;
  }
  return b;
}
vector < int > igets(int N) {
  vector < int > A;
  int temp;
  for (int i = 0; i < N; ++i) {
    cin >> temp;
    A.push_back(temp);
  }
  return A;
}

ll nPr(ll n, ll r) {
  ll ans = 1;
  r = n - r;
  while (n != r) {
    ans *= n;
    --n;
  }
  return ans;
}

ll nE(ll n) {
  return nPr(n, n);
}

ll nCr(ll n, ll r) {
  if (r == 0) return -1;
  else {
    if (0 != n - r && n - r < r) r = n - r;
    return nPr(n, r) / nE(r);
  }
}

Measured memory_bytes: 256
N, Y = map(int, input().split())

flag = False

for z in range(N + 1)[::-1]:
    rem1 = N - z + 1
    for y in range(rem1)[::-1]:
        x = N - z - y
        val = 10000 * x + 5000 * y + 1000 * z
        if val == Y:
            flag = True
            break
    if flag:
        break

if not flag:
    x = -1
    y = -1
    z = -1

print(x, y, z)


Measured memory_bytes: 3060
import sys
sys.setrecursionlimit(10**6)
input = sys.stdin.readline

n = int(input())
pata = ["abb", 
        "a.c", 
        "ddc"]

patb = ["abcc",
        "abdd",
        "eefg",
        "hhfg"]

patc = ["abbcc",
        "ad..e",
        "fd..e",
        "f.ggh",
        "iijjh"]

patd = [".aabbcc",
        "a.ddee.",
        "ad....d",
        "bd....d",
        "be....e",
        "ce....e",
        "c.ddee."]

pate = [".aabbcc....",
        "a.ddee.....",
        "ad....d....",
        "bd....d....",
        "be....e....",
        "ce....e....",
        "c.ddee.....",
        ".......abcc",
        ".......abdd",
        ".......ccab",
        ".......ddab"]

cnt = 0

def create_ab(w):
    val = [["."] * w for _ in range(w)]
    ok = False
    for fives in range(200):
        if (w - fives * 5) % 4 == 0:
            fours = (w - fives * 5) // 4
            if fours >= 0:
                ok = True
                break
    if not ok:
        return None
    t = 0
    for i in range(fives):
        for i, line in enumerate(patc):
            for j, ch in enumerate(line):
                val[t+i][t+j] = ch
        t += 5
    for i in range(fours):
        for i, line in enumerate(patb):
            for j, ch in enumerate(line):
                val[t+i][t+j] = ch
        t += 4 
    ret = []
    for line in val:
        ret.append("".join([str(item) for item in line]))
    return ret

def solve(n):
    global cnt
    if n % 3 == 0:
        repeat = n // 3
        for i in range(repeat):
            for line in pata:
                print(line * repeat)
    elif n % 4 == 0:
        repeat = n // 4
        for i in range(repeat):
            for line in patb:
                print(line * repeat)
    elif n % 5 == 0:
        repeat = n // 5
        for i in range(repeat):
            for line in patc:
                print(line * repeat)
    elif n % 7 == 0:
        repeat = n // 7
        for i in range(repeat):
            for line in patd:
                print(line * repeat)
    elif n % 11 == 0:
        repeat = n // 11
        for i in range(repeat):
            for line in pate:
                print(line * repeat)
    else:
        ret = create_ab(n)
        if ret:
            for line in ret:
                print(line)
        else:
            cnt += 1
            print(-1)

solve(n)

Measured memory_bytes: 12916
#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>
#include <queue>
#include <string>
#include <set>
#include <bitset>
#include <unordered_map>

using namespace std;
using ll = long long;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;
template <class T>
using Vvec = vector<vector<T> >;

template <class T>
void debug(T& v)
{
    for(auto& x: v) cout << x << " ";
    cout << endl;
}

// KMP
template <class T>
std::vector<int> KMP(T& S)
{
    std::vector<int> A(S.size()+1);
    A[0] = -1;
    int j = -1;

    for(int i=0; i<S.size(); i++){
        while(j > -1 && S[j] != S[i]) j = A[j];
        j++;
        if(i+1 < S.size() && S[i+1] == S[j]) A[i+1] = j;
        else A[i+1] = j;
    }

    return A;
}

// detect T from S
template <class Type>
std::vector<int> matchedIndex(Type& S, Type& T)
{
    std::vector<int> ret;
    std::vector<int> A = KMP(T);

    for(int m = 0, i = 0; m + T.size() <= S.size();){
        while(m+i < S.size() && i < T.size() && S[m+i] == T[i]) i++;
        if(i == T.size()) ret.push_back(m);
        m += std::max(i - A[i], 1);
        i = std::max(A[i], 0);
    }

    return ret;
}

int main()
{
    int N;
    cin >> N;
    vector<int> a(N), b(N);
    for(auto& x: a) cin >> x;
    for(auto& x: b) cin >> x;
    a.push_back(a[0]);
    b.push_back(b[0]);
    
    vector<int> c(N), d(2*N);
    for(int i=0; i<N; i++){
        c[i] = a[i] ^ a[i+1];
        d[i] = b[i] ^ b[i+1];
        d[N+i] = d[i];
    }
    d.pop_back();

    vector<int> index = matchedIndex(d, c);
    for(auto& k: index){
        k = (N-k)%N;
    }
    sort(index.begin(), index.end());

    for(auto& k: index){
        cout << k << " " << (a[k] ^ b[0]) << endl;
    }
}

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

int main() {
    int n;
    cin >> n;
    vector<int> x(n);
    int g = 0;
    rep(i,n) {
        cin >> x[i];
        g += x[i];
    }
    g /= n;
    vector<int> ans(2,0);
    rep(i,n) {
        ans[0] += (x[i]-g)*(x[i]-g);
        ans[1] += (x[i]-g-1)*(x[i]-g-1);
    }
    cout << min(ans[0],ans[1]) << endl;
    return 0;
}

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

#define each(i, c) for (auto& i : c)

typedef long long ll;
typedef unsigned long long ull;
const ll MOD = 1e9+7;

template <std::uint_fast64_t Modulus> class modint {
  using u64 = std::uint_fast64_t;

public:
  u64 a;

  constexpr modint(const u64 x = 0) noexcept : a(x % Modulus) {}
  constexpr u64 &value() noexcept { return a; }
  constexpr const u64 &value() const noexcept { return a; }
  constexpr modint operator+(const modint rhs) const noexcept {
    return modint(*this) += rhs;
  }
  constexpr modint operator-(const modint rhs) const noexcept {
    return modint(*this) -= rhs;
  }
  constexpr modint operator*(const modint rhs) const noexcept {
    return modint(*this) *= rhs;
  }
  constexpr modint operator/(const modint rhs) const noexcept {
    return modint(*this) /= rhs;
  }
  constexpr modint &operator+=(const modint rhs) noexcept {
    a += rhs.a;
    if (a >= Modulus) {
      a -= Modulus;
    }
    return *this;
  }
  constexpr modint &operator-=(const modint rhs) noexcept {
    if (a < rhs.a) {
      a += Modulus;
    }
    a -= rhs.a;
    return *this;
  }
  constexpr modint &operator*=(const modint rhs) noexcept {
    a = a * rhs.a % Modulus;
    return *this;
  }
  constexpr modint &operator/=(modint rhs) noexcept {
    u64 exp = Modulus - 2;
    while (exp) {
      if (exp % 2) {
        *this *= rhs;
      }
      rhs *= rhs;
      exp /= 2;
    }
    return *this;
  }
};

ll fac(ll a) {
  ll sum = 1;
  for (ll i = 1; i <= a; ++i) {
    sum = sum * i % MOD;
  }
  return sum;
}

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

  vector<ll> x(n);
  for (ll i = 0; i < n; ++i) {
    cin >> x[i];
  }

  modint<MOD> sum = 0;
  modint<MOD> c = 0;
  for (ll i = 0; i < n-1; ++i) {
      auto d = modint<MOD>(x[i+1] - x[i]);
      c +=  modint<MOD>(1) / (i+1);
      sum += (d * c);
  }

  cout << (sum * fac(n-1)).a << endl;
  
  return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <algorithm>
#include <tuple>
#include <vector>
#include <string>
#include <queue>
#include <cmath>
#include <set>
#include <map>

using namespace std;
using ll = long long;
int n, a, b, c;
int ans=1001001001;
vector<int> t;

void calc(vector<int> v){
    int at=0, bt=0, ct=0, tmp = 0;
    bool ab = false, bb = false, cb = false;
    for(int i = 0; i < v.size(); i++){
        if(v[i] == 0){
            continue;
        }else if(v[i] == 1){
            at += t[i];
            tmp += 10;
            ab = true;
        }else if(v[i] == 2){
            bt += t[i];
            tmp += 10;
            bb = true;
        }else if(v[i] == 3){
            ct += t[i];
            tmp += 10;
            cb = true;
        }
    }
    if(!ab || !bb || !cb){
        return;
    }
    tmp += abs(at-a);
    tmp += abs(bt-b);
    tmp += abs(ct-c);
    tmp -= 30;
    ans = min(tmp, ans);
}

void dfs(int depth, vector<int> &v){
    if(depth == n){
        calc(v);
        return ;
    }
    for(int i = 0; i< 4; i++){
        v[depth] = i;
        dfs(depth + 1, v);
    }
}

int main()
{
    cin >> n >> a >> b >> c;
    vector<int> v(n, 0);
    t.resize(n);
    for(int i = 0; i< n; i++){
        cin >> t[i];
    }
    dfs(0, v);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3640
n=int(input())
a=list(map(int,input().split()))
b=list(set(a))
if len(b)==1 and b[0]==0:
    print('Yes')
elif len(b)==2 and min(b)==0:
    b.sort()
    if n%3==0:
        if a.count(b[0])*2==a.count(b[1]):
            print('Yes')
        else:
            print('No')
    else:
        print('No')
elif n%3!=0:
    print('No')
else:
    if len(b)!=3:
        print('No')
    elif b[0]^b[1]==b[2]:
        if a.count(b[0])==a.count(b[1])==a.count(b[2]):
            print('Yes')
        else:
            print('No')
    else:
        print('No')

Measured memory_bytes: 14704
n,a,b = gets.chomp.split.map { |e| e.to_i }

s = gets.chomp.split("").map { |e| e.to_s }


n.times do |i|
	if s[i] == "a"
		if a > 0
			puts "Yes"
			a -= 1
		elsif b > 0
			puts "Yes"
			b -= 1
		else
			puts "No"
		end
	elsif s[i] == "b"
		if b > 0
			puts "Yes"
			b -= 1
		else
			puts "No"
		end
	else
		puts "No"
	end
end

Measured memory_bytes: 10620
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
using namespace std;
typedef long long ll;
namespace mp = boost::multiprecision;
using Mint = mp::cpp_int;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repi(i,a,b) for(int i = int(a); i < int(b); i++)
#define all(v) v.begin(), v.end()
#define uni(v) v.erase(unique(all(v)), v.end())
#define sort_g(v) sort(all(v), greater<int>())
#define dump(x) cerr << #x << ' ' << '=' << ' ' << x << endl

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

    string ans;
    rep(i, S.size()) {
        if(i % 2 == 0) ans += S.at(i);
    }

    cout << ans << endl;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#define ll long long
#define arena ios_base::sync_with_stdio(false); cin.tie(NULL);
using namespace std;

ll solve(ll arr[],ll n,ll s,ll dp[],ll k)
{
    if(s==n-1)
    return 0;
    
    if(dp[s]!=-1)
    return dp[s];
    
    ll res=LONG_MAX;
    for(ll i=1;i<=k;i++)
    {
        if(s+i<=n-1)
        res=min(res,abs(arr[s]-arr[s+i])+solve(arr,n,s+i,dp,k));
        else
        break;
    }
    dp[s]=res;
    return dp[s];
}

int main() 
{
    arena
    ll n,k;
    cin>>n>>k;
    ll arr[n];
    
    ll dp[n];
    for(ll i=0;i<n;i++)
    dp[i]=-1;
    
    for(ll i=0;i<n;i++)
    cin>>arr[i];
    
    ll s=0;
    ll x=solve(arr,n,s,dp,k);
    cout<<x<<'\n';
}

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

int main(){
  int N;
  cin >> N;
  int L[2 * N];
  for(int i = 0; i < 2 * N; i++) cin >> L[i];
  sort(L, L + 2 * N);
  int sum = 0;
  for(int i = 0; i < N; i++) sum += L[2 * i];
  cout << sum << endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
#define thaonguyen main
#define endl '\n'
#define pb push_back

using namespace std;

const int ThaoNguyen = 3e5+5, mod = 998244353, inf = 1e15;

int gt[ThaoNguyen];

namespace THAONGUYEN
{
	string sum1(string a, string b)
	{
		string res="";
		int carry=0, x;
		while(a.length()<b.length())
		{
			a='0'+a;
		}
		while(b.length()<a.length())
		{
			b='0'+b;
		}
		for(int i=a.length()-1; i>=0; i--)
		{
			x=a[i]+b[i]-96;
			res=(char)(x%10+48+carry)+res;
			carry=x/10;
		}
		if(carry)
		{
			res='1'+res;
		}
		return res;
	}
	
	string mul1(string a, int b)
	{
		string res="";
		int carry=0, x;
		for(int i=a.length()-1; i>=0; i--)
		{
			x=(a[i]-48)*b+carry;
			res=(char)(x%10+48)+res;
			carry=x/10;
		}
		if(carry>0)
		{
			res=(char)(carry+48)+res;
		}
		return res;
	}
	
	string mul2(string a, string b)
	{
		string res="";
		for(int i=0; i<a.length(); i++)
		{
			res+='0';
			res=sum1(res, mul1(b, (int)(a[i]-48)));
			cout<<res<<endl;
		}
		return res;
	}
	
	void prep()
	{
		gt[1]=1;
		for(int i=2; i<ThaoNguyen-1; i++)
		{
			gt[i]=(gt[i-1]*i)%mod;
		}
	}
	
	int binpow(int n, int k, int mod)
	{
		int m = n%mod, i=1, ans=1;
		{
			while(i<=k)
			{
				int temp=i&k;
				if(temp>0)
				{
					ans=(ans*m)%mod;
				}
				i<<=1, m=(m*m)%mod;
			}
		}
		return ans;
	}
	
	int rev_mod(int n, int mod)
	{
		return binpow(n, mod-2, mod);
	}
	
	int C(int k, int n)
	{
		if(k==0||k==n)
		{
			return 1;
		}
		else
		{
			return ((((gt[n]%mod)*rev_mod(gt[k], mod))%mod)*rev_mod(gt[n-k], mod))%mod;
		}
	}
}

using namespace THAONGUYEN;

int n, a, b, k;
signed thaonguyen()
{
	ios::sync_with_stdio(false), cin.tie(0);
	prep();
	cin>>n>>a>>b>>k;
	int ans=0;
	for(int i=0; i<=n; i++)
	{
		if((k-i*a)%b==0)
		{
			int cac=(k-i*a)/b;
			if(cac>n||cac<0)
			{
				continue;
			}
			ans+=(C(cac, n)*C(i, n))%998244353;
			ans%=998244353;
//			int mat=cac+i-n;
//			cac-=mat;
//			int j=i-mat;
//			ans+=(((C(cac, n)*C(j, n-cac))%998244353)*C(mat, n-cac-j))%998244353;
		}
	}
	cout<<ans%998244353;
	return 0;
}

Measured memory_bytes: 2560
#include <bits/stdc++.h>
//#pragma GCC optimize(2)
//author wjl

using namespace std;
#define LL long long
#define Rint register int
#define U unsigned
#define forn(i,a,b) for(int i = a;i <= b;++i)
#define nfor(i,a,b) for(int i = a;i >= b;--i)
#define pii pair<int ,int>
#define MS0(X) memset(X,0,sizeof(X))
#define MSf(X) memset(X,false,sizeof(X))
#define MS1(X) memset(X,-1,sizeof(X))
#define BR printf("--------------------\n")
#define pb push_back
#define rep(i,a,b) for(Rint i=a;i<=b;++i)
#define DEBUG(x) std::cerr << #x << '=' << x << std::endl
const double PI=atan(1.)*4.;
const int maxn=1e6+5;
const int inf = 0x3f3f3f3f;
const int mod=1e9+7;
const double e=2.71828182845904523536;
int dirx[8]={1,0,-1,0,1,-1,-1,1};
int diry[8]={0,1,0,-1,1,1,-1,-1};
int n,t;
struct node
{
    int a,b;
}st[maxn];

bool cmp(node a,node b)
{
    return a.a<b.a;
}

int dp[3005][6005];
int mx[3005];
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cin>>n>>t;
    for(int i=1;i<=n;i++)
    {
        cin>>st[i].a>>st[i].b;
    }
    sort(st+1,st+n+1,cmp);//排序很重要
    int ans=0;
    for(int i=1;i<=n;i++)
    {
        for(int j=t+st[i].a-1;j>=st[i].a;--j)
        {
            dp[i][j]=max(dp[i-1][j],dp[i-1][j-st[i].a]+st[i].b);
            ans=max(ans,dp[i][j]);
        }
        for(int j=st[i].a-1;j>=0;--j)
        {
            dp[i][j]=dp[i-1][j];
            ans=max(ans,dp[i][j]);
        }
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 71936
#include <bits/stdc++.h>
#define int long long
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
constexpr int MOD = 1000000007;
constexpr int INF = numeric_limits<int>::max() / 2;
typedef pair<int,int> P;
using Graph = vector<vector<int>>;

template<typename Monoid>
struct SegmentTree{
    using F = function<Monoid(Monoid, Monoid)>;
 
    int sz;
    vector<Monoid> seg;
 
    const F f;      // モノイドに対して二項演算を行う関数オブジェクト
    const Monoid M1;
 
    SegmentTree(int n, const F f, const Monoid &M1) : f(f), M1(M1){
        sz = 1;
        while(sz < n)   sz <<= 1;
        seg.assign(2 * sz, M1);
    }
 
    void set(int k, const Monoid &x){
        seg[k + sz] = x;
    }
 
    void build(){
        for(int k = sz - 1; k > 0; --k){
            seg[k] = f(seg[k << 1], seg[k << 1 | 1]);
        }
    }
 
    void update(int k, const Monoid &x){
        k += sz;
        seg[k] = x;
        while(k >>= 1){
            seg[k] = f(seg[k << 1], seg[k << 1 | 1]);
        }
    }
 
    Monoid query(int a, int b){
        Monoid L = M1, R = M1;
        for(a += sz, b += sz; a < b; a >>= 1, b >>= 1){
            if(a & 1)   L = f(L, seg[a++]);
            if(b & 1)   R = f(seg[--b], R);
        }
        return f(L, R);
    }
 
    Monoid operator[](const int &k) const{
        return seg[k + sz];
    }
};


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

    int n, q;
    string s;
    cin >> n >> s >> q;
    vector<SegmentTree<int>> seg(26, SegmentTree<int>(n, [](int a, int b){return max(a, b);}, 0));
    for(int i = 0; i < n; ++i){
        int foo = s[i] - 'a';
        seg[foo].update(i, 1);
    }
    for(int i = 0; i < q; ++i){
        int query;
        cin >> query;
        if(query == 1){
            int a;
            char c;
            cin >> a >> c;
            --a;
            int foo = s[a] - 'a';
            int bar = c - 'a';
            seg[foo].update(a, 0);
            seg[bar].update(a, 1);
            s[a] = c;
        }
        else{
            int a, b;
            cin >> a >> b;
            --a;
            int ans = 0;
            for(int j = 0; j < 26; ++j){
                if(seg[j].query(a, b) > 0)  ++ans;
            }
            cout << ans << "\n";
        }
    }
  
}

Measured memory_bytes: 222108
#include<iostream>
#include<algorithm>
#include<functional>
#include<cmath>
#include<string>
#include<vector>
#include<stack>
#include<queue>
#include<map>
using namespace std;
#define ll long long
const int mod = 1000000007;
const ll INF = 1000000000000000000;

int main()
{
	ll W, H, x, y;
	cin >> W >> H >> x >> y;
	if (x == (double)W / 2 && y == (double)H / 2) {
		printf("%f 1\n", (double)W * H / 2, 0);
	}
	else {
		printf("%f 0\n", (double)W * H / 2, 0);
	}
}


Measured memory_bytes: 256
from sys import stdin, exit
S = stdin.readline().rstrip()
odd = ['R', 'U', 'D']
even = ['L', 'U', 'D']
for s in S[0::2]:
    if s not in odd:
        print('No')
        exit()
for s in S[1::2]:
    if s not in even:
        print('No')
        exit()
print('Yes')

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

using namespace std;

typedef long long int Int;

int main(void)
{
    Int n,sum = 0;
    cin>>n;

    for(int i = 0;i < n;i++)
    {
	Int l,r;
	cin>>l>>r;
	sum += (r-l+1);
    }

    cout<<sum<<endl;

    return 0;
}


Measured memory_bytes: 256
def main():
  s = input()
  if len(s)%2==0:
    s=s[:len(s)-2]
  else:
    s=s[:len(s)-1]
  while True:
    if(s[0:int(len(s)/2)]==s[int(len(s)/2):len(s)]):
      print(len(s))
      break
    s=s[:len(s)-2]

main()

Measured memory_bytes: 8928
import java.util.Scanner;

class Main{
    public static void main(String args[]){
        Scanner sc  = new Scanner(System.in);
        int N = sc.nextInt();
        int count = N;

        for(int i = 0 ; i <= N ; i++){
            int cc  = 0;
            int tmp = i;
            
            while(tmp > 0){
                cc += tmp % 6;
                tmp /= 6;
            }

            tmp = N - i;

            while(tmp > 0){
                cc += tmp % 9;
                tmp /= 9;
            }

            if(count > cc){
                count = cc;
            }
        }

        System.out.println(count);
    }
}

Measured memory_bytes: 24916
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include<iostream>
#include<fstream>
#include<iomanip>
#include<cstdio>
#include<string>
#include<cstring>
#include<climits>
#include<algorithm>
#include<vector>
#include<cmath>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<deque>
#include<tuple>
#include<list>
#include<unordered_map>
#include<unordered_set>
#include<random>
#include<functional>
#define ll long long
#define ull unsigned long long
#define pii pair<int,int>
#define pp pair<pair<ll, ll>,pair<ll, ll>>
#define pll pair<ll,ll>
#define pdd pair<double,double>
#define vii vector<int>
#define vll vector<ll>
#define mat vector<vector<ll>>
#define lb lower_bound
#define pb push_back
#define mp make_pair
#define fi first
#define sc second
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep2(i,a,b) for(ll i=a;i<b;i++)
#define repr(i,n) for(ll i=n-1;i>=0;i--)
#define all(x) x.begin(),x.end()
#define LB(v,x) (lower_bound(v.begin(),v.end(),x)-v.begin())
#define UB(v,x) (upper_bound(v.begin(),v.end(),x)-v.begin())
#define ERASE(v) v.erase(unique(v.begin(),v.end()),v.end())
// #define int ll
using namespace std;
const ll INF = (1 << 30 ) - 1;
const ll LLINF = (1LL << 60LL);
const ll MOD = 1000000007;
const ll mod = 998244353;
const ll MAX = 1100000;
const double pi = acos(-1);
const double eps = 1e-10;
ll dx[4] ={1,0,-1,0} , dy[4] ={0,1,0,-1};


signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    ll x;
    cin>>x;
    ll ans=x/11*2;
    x%=11;
    ans+=x/6+(x%6!=0);
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
N, A, B = [int(x) for x in input().split()]
ResSum = 0

for i in range(1, N+1):
    Nsum = 0
    temp = i
    while (temp > 0):
        Nsum += int(temp % 10)
        temp /= 10
    if Nsum >= A and Nsum <= B:
        ResSum += i

print(ResSum)

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

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

  int s[3];

  s[0] = n /100;
  s[1] = n %100 /10;
  s[2] = n % 10;

  cout << s[0] + s[1] + s[2] << endl;


  return 0;
}

Measured memory_bytes: 256
n = int(input())
p = list(map(lambda x: int(x), input().split(" ")))
c = 0
for i in range(1, n-1):
    a = max(p[i-1:i+2])
    b = min(p[i-1:i+2])
    if a is not p[i] and b is not p[i]:
        c = c + 1
print(c)

Measured memory_bytes: 3060
package main

import (
	"bufio"
	"fmt"
	"io"
	"math"
	"os"
	"strconv"
)

var (
	readString func() string
	stdout     *bufio.Writer
)

func init() {
	readString = newReadString(os.Stdin)
	stdout = bufio.NewWriter(os.Stdout)
}

func newReadString(ior io.Reader) func() string {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), int(1e+11))
	r.Split(bufio.ScanWords)

	return func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
}

func readInt() int {
	return int(readInt64())
}

func readInt64() int64 {
	i, err := strconv.ParseInt(readString(), 0, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

func readIntSlice(n int) []int {
	b := make([]int, n)
	for i := 0; i < n; i++ {
		b[i] = readInt()
	}
	return b
}

func readLengthAndSlice() (int, []int) {
	n := readInt()
	return n, readIntSlice(n)
}

func printf(f string, args ...interface{}) (int, error) {
	return fmt.Fprintf(stdout, f, args...)
}

func println(args ...interface{}) (int, error) {
	return fmt.Fprintln(stdout, args...)
}

func eprintln(args ...interface{}) (int, error) {
	return fmt.Fprintln(os.Stderr, args...)
}

// readString() string
// readInt() int
// readIntSlice(n int) []int
// readLengthAndSlice() []int

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

func pred(x []int, D int) bool {
	for _, v := range x {
		if v%D != 0 {
			return false
		}
	}
	return true
}
func main() {
	defer stdout.Flush()
	N := readInt()
	X := readInt()
	x := make([]int, N)
	min := math.MaxInt32
	for i := range x {
		x[i] = absInt(readInt() - X)
		min = minInt(min, x[i])
	}
	m := min
	for i := 1; true; i++ {
		if m%i != 0 {
			continue
		}
		d := m / i
		if pred(x, d) {
			println(d)
			return
		}
	}
}

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

func minInt(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func minUint(a, b uint) uint {
	if a < b {
		return a
	}
	return b
}

func minInt64(a, b int64) int64 {
	if a < b {
		return a
	}
	return b
}

func minUint64(a, b uint64) uint64 {
	if a < b {
		return a
	}
	return b
}

func maxInt(a, b int) int {
	if a < b {
		return b
	}
	return a
}

func maxUint(a, b uint) uint {
	if a < b {
		return b
	}
	return a
}
func maxInt64(a, b int64) int64 {
	if a < b {
		return b
	}
	return a
}

func maxUint64(a, b uint64) uint64 {
	if a < b {
		return b
	}
	return a
}

func absInt(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

func absInt64(a int64) int64 {
	if a < 0 {
		return -a
	}
	return a
}


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


int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  int w[n];
  for(int i = 0; i<n ; i++) cin >> w[i];
  int min = 100 * n;
  int s1=0; int s2=0;
  for(int i = 0; i<n ; i++){
    for(int j = 0 ; j <= i ; j++) s1 += w[j];
    for(int j = i+1 ; j < n ; j++) s2 += w[j];
    if(min > abs(s1 - s2)) min = abs(s1-s2);
    s1 = 0; s2 = 0;
  }
  cout << min << "\n";
  return 0;
}


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

using namespace std;

void solve()
{
	int h, w;
	cin >> h >> w;
	vector<long> ps(h), qs(w), accp(h+1), accq(w+1);
	for (int i = 0; i < h; i++) cin >> ps[i];
	for (int i = 0; i < w; i++) cin >> qs[i];
	sort(ps.begin(), ps.end());
	sort(qs.begin(), qs.end());
	for (int i = 0; i < h; i++)
	{
		accp[i + 1] = accp[i] + ps[i];
	}
	for (int i = 0; i < w; i++)
	{
		accq[i + 1] = accq[i] + qs[i];
	}
	long ans = accp[h] + accq[w] * (h + 1);
	for (int i = 0; i < w; i++)
	{
		int l = -1, r = h;
		while(l+1<r)
		{
			int m = (l + r) / 2;
			(qs[i] >= ps[m] ? l : r) = m;
		}
		ans -= (l + 1) * qs[i] - accp[l + 1];
	}
	cout << ans << endl;
}

int main()
{
	solve();
	//cout << "yui(*-v・)yui" << endl;
	return 0;
}


Measured memory_bytes: 3328