akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef string str;
#define rep(i, n) for(int i=0; i<n; ++i)
#define all(obj) (obj).begin(), (obj).end()
using P = pair<int, int>;
const int inf = 1e9;
const ll INF = 1e18;
const ll MOD = 1e9+7;
const ll MAX = 1e9+7;
template<typename T> T factorial(T n){
    if(n==1) return 1;
    else return n*factorial(n-1)%MOD;
}
template<typename T> T Pow(T x, T n, T m){
    if(n == 0) return 1;
    if(n % 2 == 0) return Pow(x * x % m, n / 2, m);
    else return x * Pow(x, n - 1, m) % m;
}
template<typename T> T combination(T n, T k, T m){
    return factorial<T>(n) * Pow<T>(factorial(k), m-2, m) % m * Pow<T>(factorial(n-k), m-2, m) % m;
}
struct edge{
    int to; // 辺の行き先
    int weight; // 辺の重み
    edge(int t, int w) : to(t), weight(w) { }
};
using graph = vector<vector<edge>>;
using Graph = vector<vector<int>>;

int main(){
    str s; cin >> s;
    bool kaibun = true;
    rep(i, s.size()){
        if(s[i] != s[s.size()-1-i]) kaibun = false;
    }
    rep(i, (s.size()-1)/2){
        if(s[i] != s[(s.size()-1)/2-1-i]) kaibun = false;
    }
    for(int i=(s.size()+1)/2; i<s.size(); i++){
        if(s[i] != s[s.size()-1-i+(s.size()+1)/2]) kaibun = false;
    }
    if(kaibun) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;

namespace AtCoder
{
    static class Program
    {
        static void Main()
        {
            //ここから

            long N = IO.ReadLineToLong();
            var a = IO.ReadLineToLongList();

            long sum = 0;

            foreach(var v in a)
            {
                var temp = v;
                while (temp % 2 == 0)
                {
                    sum++;
                    temp = temp / 2;
                }
            }

            //ここまで

            Console.WriteLine(sum);
            Console.ReadKey();
        }

    }

    static class Func
    {
        static public long mod = 1000000007;
        static public void Swap<T>(ref T a, ref T b) { T temp = a; a = b; b = temp; }
        static public long GCD(long a, long b) { return b != 0 ? GCD(b, a % b) : a; }
        static public long LCM(long a, long b) { return (long)a * b / GCD(a, b); }
        static public long Factorial(long a) { return a == 1 ? a : a * Factorial(a - 1); }


        public static double ToAngle(this double radian)
        {
            return (double)(radian * 180 / Math.PI);
        }

        public static double ToRadian(this double angle)
        {
            return (double)(angle * Math.PI / 180);
        }

        static public long Conbination(long n,long m)
        {
            if (m == 0) return 1;
            if (n == 0) return 0;
            return n * Conbination(n - 1, m - 1) / m;
        }

        static public void Factoring(long num, ref long[] vs)
        {
            if (num == 1)
            {
                vs[1]++;
            }
            for (long i = 2; i < Math.Sqrt(num); i++)
            {
                if (num % i == 0)
                {
                    vs[i]++;
                    Factoring(num / i, ref vs);
                }
            }
            vs[1]++;
        }
    }

    static class IO
    {
        static public string ReadLineToString() { return Console.ReadLine(); }
        static public long ReadLineToLong() { return long.Parse(Console.ReadLine()); }
        static public List<string> ReadLineToStringList() { return Console.ReadLine().Split(' ').ToList(); }
        static public List<long> ReadLineToLongList() { return Console.ReadLine().Split(' ').Select(long.Parse).ToList(); }

        static public List<double> ReadLineToDoubleList() { return Console.ReadLine().Split(' ').Select(double.Parse).ToList(); }

        static public void WriteStrings(object[] strings) { foreach (var o in strings) { Console.Write(o + " "); } }
    }
}

Measured memory_bytes: 14304
#include <bits/stdc++.h>
#include <math.h>
#include <vector>
#include <queue>
#include <iomanip>
#include <string>
#include <algorithm>
using namespace std;
using Graph = vector<vector<int>>;
#define rep(i,n) for(int i=0;i<n;i++)
#define rep_1 (i,j,n) for(int i=j;i<n;i++)
typedef long long ll;
typedef long l;
const ll l_INF = 1010101010101010;
const int INF = 1010101010;
const int dx[4] = {-1,0,1,0};
const int dy[4] = {0,-1,0,1};
using vi = vector<int>;
using vll = vector<ll>;
using vvi = vector<vi>;
using vvll = vector<vll>;
using pii = pair<int,int>;
using pll = pair<ll,ll>;

int main(){
  int n; cin>>n;
  vector<double> v(n); rep(i,n) cin>>v[i];
  cout<<setprecision(20);
  sort(v.begin(),v.end());
  rep(i,n-1){
    v[i+1]=(v[i]+v[i+1])/2;
  }
  cout<<v[n-1]<<endl;
}


Measured memory_bytes: 3832
#include <iostream>
#include <algorithm>
using namespace std;
typedef long long ll;
ll n, m, x[100010], dis[100010], ans;
int main(void){
    // Your code here!
    cin >> n >> m;
    for (ll i = 0; i < m; i++) cin >> x[i];
    sort(x, x + m);
    for (ll i = 1; i < m; i++){
        dis[i - 1] = x[i] - x[i - 1];
    }
    sort(dis, dis + (m - 1));
    reverse(dis, dis + (m - 1));
    ans = x[m - 1] - x[0];
    if (n >= m){
        cout << 0 << endl;
    } else {
        for (ll i = 0; i < n - 1; i++){
            ans -= dis[i];
        }
        cout << ans << endl;
    }
}


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

#define REP(i ,n) for(int i=0 ;i < n; i++)
#define REPB(i ,n) for(int i=n; i >= 0; i--)
#define FOR(i ,m ,n) for(int i=m; i < n; i++)
#define FORB(i, m, n) for(int i=m; i>= m; i--)
#define ll long long
#define pb push_back
#define popb pop_back
using namespace std;
int main(){
  int qcount[3] = {};
  int n , a , b , pt;
  int ans = 100;
  vector<int> p;
  cin >> n >> a >> b;
  REP(c,n){
      cin >> pt;
      p.pb(pt);
    }

    REP(i,n){
    if(p[i] <= a) qcount[0]++;
    else if(p[i] <= b) qcount[1]++;
    else qcount[2]++;
  }
  REP(i, 3){
      ans = min(ans, qcount[i]);
    }
    cout << ans << endl;
}

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

struct Node{
  int key;
  Node *right,*left,*parent;
};

Node *root, *NIL;

void insert(int k){
  Node *y = NIL;
  Node *x = root;
  Node *z;

  z = (Node *)malloc(sizeof(Node));
  z->key = k;
  z->left = NIL;
  z->right = NIL;

  while(x!=NIL){
    y=x;
    if(z->key < x->key){
      x = x->left;
    }else{
      x = x->right;
    }
  }
  z->parent = y;
  if(y==NIL){
    root = z;
  }else{
    if(z->key < y->key){
      y->left = z;
    }else{
      y->right = z;
    }
  }
}

void inorder(Node *u){
  if(u==NIL) return;
  inorder(u->left);
  printf(" %d",u->key);
  inorder(u->right);
}

void preorder(Node *u){
  if(u==NIL) return;
  printf(" %d",u->key);
  preorder(u->left);
  preorder(u->right);
}

int main(){
  int n,i,x;
  string com;

  scanf("%d",&n);

  for(i = 0;i < n; i++){
    cin >> com;
    if(com == "insert"){
      scanf("%d",&x);
      insert(x);
    }else if(com == "print"){
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    }
  }

  return 0;
}




Measured memory_bytes: 26608
#include <stdio.h>
#include <math.h>

int main(void){

  long n;
  scanf("%ld", &n);
  long prime_list[1000001];
  prime_list[0] = 0;
  prime_list[1] = 0;
  for (long i = 2; i <= 1000000; i++) {
    prime_list[i] = 1;
  }
  for (long i = 2; i <= 1000000; i++) {
    if (prime_list[i] == 1) {
      for (long j = 2; i*j <= 1000000; j++) {
        prime_list[i*j] = 0;
      }
    }
  }
  long ans = 0;
  long tmp = n;
  long e;
  long count;
  for (long i = 2; i <= sqrt(n); i++) {
    if (prime_list[i] == 1) {
      e = 0;
      while (tmp%i == 0) {
        e++;
        tmp /= i;
      }
      if (e != 0) {
        count = 0;
        for (long j = 1; ; j++) {
          count = j;
          e -= j;
          if (e <= count) {
            break;
          }
        }
        ans += count;
      }
    }
  }
  if (tmp != 1) {
    ans++;
  }
  printf("%ld\n", ans);

  return 0;
}

Measured memory_bytes: 9968
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin>>n;
  cout<<((n/1000==(n%1000)/100&&(n%1000)/100==(n%100)/10)||((n%1000)/100==(n%100)/10&&(n%100)/10==n%10)?"Yes":"No")<<endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define MOD(x) ((x)%mod)
long long n,m;
long long ans(long long x)
{
	long long a=1;
	for(long long i=1;i<=x;i++)
		a=MOD(a*i);
	return a;
}
int main()
{
	scanf("%lld%lld",&n,&m);
	if(abs(n-m)>=2)
	{
		printf("0");
	}
	else if(abs(n-m)==1)
	{
		printf("%lld",MOD(ans(n)*ans(m)));
	}
	else
	{
		printf("%lld",MOD(ans(n)*ans(m)*2));
	}
	return 0;
}

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

#define for(i, a, b) for(ll (i)=a;(i)<(b);++(i))
#define rep(i, n)    for(i, 0, n)

const ll inf = 1e15;
const ll mod = 1e9+7;

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

ll par[100001]; // 親
ll rnk[100001]; // 木の深さ
ll wgt[100001];
void init(ll n) {
    rep(i, n+1) par[i] = i, rnk[i] = 0, wgt[i] = 0;
}

ll find(ll x) {
    if (par[x] == x) return x;
    ll pa = find(par[x]);
    wgt[x] += wgt[par[x]];
    return par[x] = pa;
}

void unite(ll x, ll y, ll w) {
    w += wgt[x];
    w -= wgt[y];
    x = find(x);
    y = find(y);
    if (x == y) return;
    
    if (rnk[x] < rnk[y]) par[x] = y, wgt[x] = -w;
    else {
        par[y] = x;
        wgt[y] = w;
        if (rnk[x] == rnk[y]) rnk[x]++;
    }
}

bool same(ll x, ll y) {
    return find(x) == find(y);
}

ll weight(ll x) {
    find(x);
    return wgt[x];
}

ll diff(ll x, ll y) {
    return weight(y) - weight(x);
}

int main() {
    ll N, M; cin >> N >> M;
    
    init(N);
    rep(i, M) {
        ll l, r, d; cin >> l >> r >> d;
        if (same(l, r) && diff(l, r) != d) {
            cout << "No" << endl;
            return 0;
        }
        unite(l, r, d);
    }
    cout << "Yes" << endl;
    
    return 0;
}


Measured memory_bytes: 2560
#include <bits/stdc++.h>
#define ALL(A) (A).begin(), (A).end()
#define ll long long
#define rep(i, n) for (int i = 0; i < (n); i++)

using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int dx[] = { 0, 1, -1, 0, 1, -1, 1, -1 };  // i<4:4way i<8:8way
int dy[] = { 1, 0, 0, -1, 1, -1, -1, 1 };

const ll mod = 1e9 + 7;
const ll INF = -1 * ((1LL << 63) + 1);
const int inf = -1 * ((1 << 31) + 1);

int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);
    int x;
    cin >> x;
    if(x>=30)cout << "Yes" << endl;
    else cout << "No" << endl;
}

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

using i64 = int64_t;

i64 cnt[30]={0};

int main(){
    string a;
    cin >> a;
    i64 ans = ((i64)(a.size()) * ((i64)(a.size())-1)) / 2;
    for(auto c: a){
        cnt[c-'a']++;
    }
    for(int i='a';i<='z';++i){
        ans -= (cnt[i-'a'] * (cnt[i-'a']-1)) / 2;
    }

    cout << ans+1 << endl;

    return 0;
}


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

int main() {
    int h;
    cin >> h;
    int w;
    cin >> w;
    vector<string> a(h);
    for (int i = 0; i < h; i++) {
        cin >> a[i];
    }

    vector<bool> row(h);
    vector<bool> col(w);
    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            if (a[i][j] == '#') {
                row[i] = true;
                col[j] = true;
            }
        }
    }

    for (int i = 0; i < h; i++) {
        if (row[i]==true) {
            for (int j = 0; j < w; j++) {
                if (col[j]==true) {
                    cout << a[i][j];
                }
            }
            cout << endl;
        }
    }
}

Measured memory_bytes: 256
using System;
namespace a
{
  class Program
  {
    static void Main()
    {
      var line = Console.ReadLine();
      var data = line.Split(" ");
      var a = int.Parse(data[0]);
      var b = int.Parse(data[1]);
      if (a<=8 & b<=8)
      {
        Console.WriteLine("Yay!");
      }
      else
      {
        Console.WriteLine(":(");
      }
    }
  }
}

Measured memory_bytes: 27372
#include<stdio.h>
#include<algorithm>

using namespace std;

int N, K, h[100000];

void input(){
  scanf("%d %d", &N, &K);
  for(int i=0; i<N; i++){
    scanf("%d", &h[i]);
  }
}

int main(){
  input();
  int DP[100000] = {0};
  for(int i=1; i<N; i++){
    DP[i] = DP[i-1] + max(h[i] - h[i-1], h[i-1] - h[i]);
    for(int j=2; j<=K; j++){
      if(i < j){
        break;
      }
      DP[i] = min(DP[i], DP[i-j] + max(h[i] - h[i-j], h[i-j] - h[i]));
    }
  }
  printf("%d", DP[N-1]);
}

Measured memory_bytes: 896
#include<stdio.h>
#include<algorithm>
using namespace std;
int x[11000];
int y[11000];
int X[11000];
int Y[11000];
int ABS(int a){return max(a,-a);}
int dist(int X1,int Y1,int X2,int Y2){
	X1+=200000000;
	X2+=200000000;
	Y1+=200000000;
	Y2+=200000000;
	if(X1%20==0&&X2%20==0&&X1==X2)return ABS(Y1-Y2);
	if(Y1%20==0&&Y2%20==0&&Y1==Y2)return ABS(X1-X2);
	if(X1%20==0&&X2%20==0&&Y1/20==Y2/20)return ABS(X1-X2)+min(Y1%20+Y2%20,40-Y1%20-Y2%20);
	if(Y1%20==0&&Y2%20==0&&X1/20==X2/20)return ABS(Y1-Y2)+min(X1%20+X2%20,40-X1%20-X2%20);
	
	return ABS(X1-X2)+ABS(Y1-Y2);
}
int main(){
	int a;scanf("%d",&a);
	for(int i=0;i<a;i++)scanf("%d%d",x+i,y+i);
	for(int i=0;i<a;i++){
		x[i]*=2;y[i]*=2;
		X[i]=x[i]+y[i];
		Y[i]=x[i]-y[i];
	}
	std::sort(X,X+a);
	std::sort(Y,Y+a);
	int xx=(X[0]+X[a-1])/2;
	int yy=(Y[0]+Y[a-1])/2;
	int mx=(xx+yy)/2;
	int my=(xx-yy)/2;
	double ret=9999999999999.9;
	for(int i=mx-50;i<=mx+50;i++){
		for(int j=my-50;j<=my+50;j++){
			if(ABS(i)%20&&ABS(j)%20)continue;
			int tmp=0;
			for(int k=0;k<a;k++){
				tmp=max(tmp,dist(i,j,x[k],y[k]));
			}
		//	if(tmp<30)printf("%d %d: %d\n",i,j,tmp);
			ret=min(ret,(double)tmp/2);
		}
	}
	printf("%.12f\n",ret);
}

Measured memory_bytes: 1244
while True:
    a, op, b = input().split()
    a = int(a)
    b = int(b)
 
    if op == '?':
        break
 
    if op == '+':
        print(a + b)
 
    if op == '-':
        print(a - b)
 
    if op == '*':
        print(a *b)
 
    if op == '/':
        print(a // b)

Measured memory_bytes: 7644
#define _GLIBCXX_DEBUG
#define _LIBCPP_DEBUG 0 #include<iostream>
#include <iostream>
#include <queue>
#include <vector>
using namespace std;
#define FOR(i, n) for (int i = 0; i < (int)(n); i++)

void bfs(vector<int> &ans, vector<vector<int>> &Graph) {
  queue<int> que;
  que.push(0);
  ans[0] = 0;

  while (!que.empty()) {
    int cur = que.front();
    que.pop();
    for (int next : Graph[cur]) {
      if (ans[next] != -1) continue;
      que.push(next);
      ans[next] = cur;
    }
  }
  return;
}

int main() {
  int N, M;
  cin >> N >> M;
  vector<vector<int>> Graph(N);
  vector<int> ans(N, -1);
  for (int i = 0; i < M; i++) {
    int a, b;
    cin >> a >> b, a--, b--;
    Graph[a].emplace_back(b);
    Graph[b].emplace_back(a);
  }

  bfs(ans, Graph);

  cout << "Yes" << endl;
  for (int i = 1; i < N; i++) {
    cout << ans[i] + 1 << endl;
  }
  return 0;
}

Measured memory_bytes: 13424
M,D = map(int,input().split())
count = 0
for m in range(1,M+1):
    for d in range(1,D+1):
        d1 = d%10
        d10 = d//10
        if d1>=2 and d10>=2 and d1*d10==m:
            count += 1
print(count)

Measured memory_bytes: 3060
import sys
from collections import deque
input = sys.stdin.readline
def RD(): return input().rstrip()
def F(): return float(input().rstrip())
def I(): return int(input().rstrip())
def MI(): return map(int, input().split())
def MF(): return map(float,input().split())
def LI(): return list(map(int, input().split()))
def LF(): return list(map(float,input().split()))
def Init(H, W, num): return [[num for i in range(W)] for j in range(H)]


def main():
    move = [[i, j] for i in range(-1,2) for j in range(-1,2) if not(i==j and i == 0)]
    try:
        while True:
            w, h = MI()
            if w == h and h == 0:
                sys.exit()
            d = Init(h, w, True)
            mylist = [LI() for i in range(h)]
            result = 0
            for i in range(h):
                for j in range(w):
                    if d[i][j] and mylist[i][j] == 1:
                        result+=1
                        dq = deque()
                        dq.append([i, j])
                        while dq:
                            x, y = dq.pop()
                            for x2, y2 in move:
                                x2 += x
                                y2 += y
                                if x2 >= 0 and x2 < h and y2 >= 0 and y2 < w:
                                    if mylist[x2][y2] == 1 and d[x2][y2]:
                                        dq.append([x2,y2])
                                        d[x2][y2] = False
                                    elif d[x2][y2]:
                                        d[x2][y2] = False
            print(result)
    except:
        sys.exit()
    
    
    
if __name__ == "__main__":
    main()



Measured memory_bytes: 6056
n=int(input())
d=list(map(int,input().split()))

if d[0]!=0:
  print(0)
  exit(0)
  
m=max(d)
counts=[0]*(m+1)

import collections
counter=collections.Counter(d)

for key,val in counter.items():
  counts[key]=val
if counts[0]!=1:
  print(0)
  exit(0)
ans=1
div=998244353
for i in range(1,len(counts)):
  ans*=pow(counts[i-1],counts[i],div)
  ans%=div
  
print(ans)

Measured memory_bytes: 20576
#include <bits/stdc++.h>
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define REP(I, N) for (int I = 0; I < (N); ++I)
#define REPP(I, A, B) for (int I = (A); I < (B); ++I)
#define RI(X) scanf("%d", &(X))
#define RII(X, Y) scanf("%d%d", &(X), &(Y))
#define RIII(X, Y, Z) scanf("%d%d%d", &(X), &(Y), &(Z))
#define DRI(X) int (X); scanf("%d", &X)
#define DRII(X, Y) int X, Y; scanf("%d%d", &X, &Y)
#define DRIII(X, Y, Z) int X, Y, Z; scanf("%d%d%d", &X, &Y, &Z)
#define RS(X) scanf("%s", (X))
#define CASET int ___T, case_n = 1; scanf("%d ", &___T); while (___T-- > 0)
#define MP make_pair
#define PB push_back
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define LEN(X) strlen(X)
#define F first
#define S second
#define RF(x) freopen(x,"r",stdin)
#define WF(x) freopen(x,"w",stdout)
typedef long long LL;
using namespace std;
typedef pair<LL,LL> PLL;
typedef pair<int,int> PII;
const LL MOD = 1e9+7;
const int SIZE = 1e6+5;
const LL INF = 1LL<<60;
const double eps = 1e-7;

int a[100009];

int main(){
	DRI(n);
	REP(i,n){
		RI(a[i]);
	}
	LL ans=0;
	REP(i,n){
		if(a[i]%2&&a[i+1]){a[i]--;a[i+1]--;ans++;}
	}
	REP(i,n){
		ans+=a[i]/2;
	}
	printf("%lld",ans);
}


Measured memory_bytes: 640
n, k = gets.chomp.split(" ").map(&:to_i)
d = [0,0,0,0,0,0,0,0,0,0,0]
dds = gets.chomp.split(" ").map(&:to_i)
(0...k).each{|dd|
    d[dds[dd]] = 1
}
#dds.each{|dd|
#    d[dd] = 1
#}

(1..100000).each{|v|
    s = v.to_s
    has_kirai = false
    (0..9).each{|vv|
        if d[vv] == 1 && s.include?(vv.to_s)
            has_kirai = true
        end
    }
    if has_kirai
        next
    end
    if v >= n
        puts s
        exit
    end
}



Measured memory_bytes: 1788
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>

int main()
{
	int n;
	scanf("%d", &n);
	int ge = n % 10;
	int bai = n / 100;
	if (ge == bai)
		printf("Yes\n");
	else printf("No\n");
	return 0;
}

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

#define sc(x) scanf("%d",&x)
#define pf(c) scanf("%d",x);
#define deb(x) cout << #x << " " << x << endl;
#define fo(i,n) for(int i=0;i<n;i++)
#define Fo(i,k,n) for(int i=k;i<n;i++)
#define vi vector<int>
#define ii pair<int,int>
#define vii vector<ii>
#define ll long long
#define pb push_back
#define endl "\n"
#define mp map<int,int>

bool isPalindrome(string str, int l, int h) 
{ 
 
    while (h > l) 
    { 
        if (str[l++] != str[h--]) 
        { 
            return false;
        } 
    } 
    return true;
} 

int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	string s;
	cin >> s;
	
	int n = s.length();
	
	//bool flag = false;
	
	int first = (n-1)/2 - 1;
	int last = (n+3)/2 - 1;
	
	string s1 = s.substr(0,first+1);
	string s2 = s.substr(last);
	
	//cout << s1 << " " << s2 << endl;
	bool one = isPalindrome(s1, 0, s1.length()-1);
	bool sec = isPalindrome(s2,0,s2.length()-1);
	bool third = isPalindrome(s,0,n-1);
	
	if(one && sec && third) cout << "Yes" << endl;
	else cout << "No" << endl;
	
	
	return 0;
}


Measured memory_bytes: 384
h, w = map(int, input().split())
ab = []
for i in range(h * 2):
    ab.extend(list(map(int, input().split())))

abs_table = [[0] * w for _ in range(h)]
dp = [[0] * w for _ in range(h)]

s = h * w
i = 0
j = 0
for k in range(s):
    if w == j:
        j = 0
        i += 1
    a, b = ab[k], ab[k+s]
    abs_table[i][j] = abs(a - b)
    j += 1
   
n = abs_table[0][0]  
dp[0][0] = 2**(n * 2)  | 1
    
for i in range(h):
    for j in range(w):
        a = abs_table[i][j]
        u = 0
        l = 0
        if i:
            u = dp[i-1][j]
            u = u << a * 2 | u | u
        if j:
            l = dp[i][j-1]
            l = l << a * 2 | l | l
            
        if not u and not l:
            pass
        elif not l:
            dp[i][j] = u
        elif not u:
            dp[i][j] = l
        else:
            len_u = len(bin(u)[2:])
            len_l = len(bin(l)[2:])
            delta = len_u - len_l
            if delta == 0:
                dp[i][j] = u | l
            elif delta < 0:
                dp[i][j] = u << abs(delta) // 2 | l
            else:
                dp[i][j] = u | l << delta // 2

flag = bin(dp[-1][-1])[2:]
zero = len(flag) // 2
for i, v in enumerate(flag[zero:]):
    if v == '1':
        print(i)
        break

Measured memory_bytes: 16116
MOD = 10 ** 9 + 7

def nCk(n, k):
    if k > n or min(n, k) < 0:
        raise Exception('Not correct input values!')
    res = 1
    for i in range(1, k + 1):
        res = (res * (n - i + 1) * pow(i, MOD - 2, MOD)) % MOD
    return res

n, a, b = map(int, input().split())
ret = (pow(2, n, MOD) - 1 - nCk(n, a) - nCk(n, b)) % MOD
print(ret)

Measured memory_bytes: 72824
import Control.Monad
import Data.List
f n s
 |null s=n
 |null (init s)=n
 |s!!0=='A'&&s!!1=='B'=f(n+1)(drop 1 s)
 |otherwise=f(n)(drop 1 s)
main=do
 n<-readLn :: IO Int
 ss<-replicateM n getLine
 let sr=sum$map(f 0)ss
     sa=sum$map(\x->if head x=='B' &&last x/='A'then 1 else 0)ss
     sb=sum$map(\x->if last x=='A' &&head x/='B'then 1 else 0)ss
     ab=sum$map(\x->if head x=='B' &&last x=='A'then 1 else 0)ss
     sq=if sa==0&&sb==0&&ab==0 then sa+sb else if sa==0&&sb==0 then ab-1 else if sa==0||sb==0 then ab else ab+1+(min (sa-1) (sb-1))
 print$sr+sq

Measured memory_bytes: 6396
import java.util.Scanner;

public class Main {

	static Scanner sc = new Scanner(System.in);

	public static void main(String[] args) {
		long N = sc.nextLong();
		long D = sc.nextLong();
		long ans;
		if (D == 1) {
			ans = N * (N - 1) / 2;
		} else {
			long dense = N - D;
			ans = dense * (dense - 1) / 2;
			ans += 2 * dense;
			ans += D - 2;
		}
		System.out.println(ans);
	}

}

Measured memory_bytes: 26388
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>

int kakeru(int p){
  if(p==1)
  return 3;
  else if(p==2)
  return 2;
  else if(p==3){
    return 1;
  }
  else return 0;
}



using namespace std;
int main(void){

int x,y;
cin >> x >> y;
int sumx,sumy;
sumx=100000*kakeru(x);
sumy=100000*kakeru(y);
if(sumx==300000&&sumy==300000){
  cout << "1000000";
  return 0;
}
else{
  printf("%d\n",sumx+sumy);
}
}


Measured memory_bytes: 256
N = int(input())
S = dict()

ans = 0
for _ in range(N):
  s = list(str(input()))
  string = "".join(sorted(s))
  if S.get(string) is None:
  	S[string] = 1
  else:
    ans += S[string]
    S[string] += 1
     
print(ans)

Measured memory_bytes: 17932
using System;
using System.Linq;
using System.Text;

namespace CsTest
{
    class Program
    {
        static void Main(string[] args)
        {
            string n = Console.ReadLine();
            StringBuilder result = new StringBuilder();
            for (int i = 0; i < n.Length; ++i)
                if (n[i] == '1')
                    result.Append('9');
                else
                    result.Append('1');
            Console.WriteLine(result);

        }
    }
}


Measured memory_bytes: 13140
#include <bits/stdc++.h>
using namespace std;
#define ALL(a) (a).begin(),(a).end()
#define rALL(a) (a).rbegin(),(a).rend()
typedef pair<int, int> P;
typedef pair<int64_t, int64_t> Pll;
  
int main() {
    string S;
    cin >> S;
    cout << S.at(0) << S.size() - 2 << S.at(S.size() - 1) << endl;
}

Measured memory_bytes: 256
from collections import defaultdict
import math
import sys

def comb(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

input = sys.stdin.readline

N = int(input().strip())
dic = defaultdict(int)
for _ in range(N):
    string = "".join(sorted(list(input().strip())))
    dic[string] += 1

count = 0
for key in dic.keys():
    n = dic[key]
    if dic[key] >= 2:
        count += comb(dic[key], 2)
print(count)

Measured memory_bytes: 18184
#include <bits/stdc++.h>
using namespace std;
int main (){
  int i,a,b,c;
  cin>>a>>b>>c;
  if((a==b&&b!=c)||(a==c&&b!=c)||(b==c&&c!=a))
  cout<<"Yes"<<endl;
  else
  {
    cout<<"No"<<endl;
  }
  
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <iomanip>
#include <map>
#include <set>
#include <ctype.h>
#include <numeric>
using namespace std;

typedef long long ll;
typedef pair<int, int> P;
const ll MOD = 1e9 + 7;
const int INF = 1e9;

int dx4[4] = { 0, -1, 1, 0 };
int dy4[4] = { -1, 0, 0, 1 };
int dx8[8] = { 0, -1, 1, 0, -1, 1, -1, 1 };
int dy8[8] = { -1, 0, 0, 1, -1, -1, 1, 1 };

int main() {
  string s; cin >> s;
  int count = 0;

  for (int i = 0; i != s.size(); ++i) {
    if (s[i] == '0') {
      ++count;
    }
  }
  int diff = count - (s.size() - count);
  cout << s.size() - abs(diff) << endl;
  return 0;
}


Measured memory_bytes: 512
#![allow(non_snake_case)]
use proconio::input;
// use std::collections::HashMap;

fn next_ch(ch: char, ind: i64) -> char {
    let mod_ind = ind % 26;

    if mod_ind == 0 {
        return ch;
    }

    if ch == 'z' {
        return next_ch('a', mod_ind - 1);
    }

    let new_ch = ((ch as u8) + 1) as char;

    return next_ch(new_ch, mod_ind - 1);
}

fn main() {
    input! {
        S: String,
        K: i64,
    }

    // 最初の文字を捌けるならやったほうが得
    // そうでないなら、できるだけ後ろの文字を対応したほうがいい

    let len = S.len();
    let mut ans: String = String::from("");


    let mut rest: i64 = K as i64;
    for (i, ch) in S.char_indices() {
        let mut new_ch = ch;
        if ch != 'a' {
            let cand = (('z' as u8) - (ch as u8) + 1) as i64;
            new_ch = if rest >= cand { 'a' } else { ch };
            if rest >= cand {
                rest -= cand;
            }
        }

        // 最後については、余っているぶんを全適用する
        if i == len - 1 {
            let new_new_ch = next_ch(new_ch, rest);
            ans += &new_new_ch.to_string();
        } else {
            ans += &new_ch.to_string();
        }
    }

    println!("{}", ans);
}


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

using namespace std;

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

  int n;
  cin >> n;
  vector<string> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    reverse(a[i].begin(), a[i].end());
  }

  auto f = [](long long v, int c) {
    long long res = (1LL * 9487 * v + c) % 29996224275833;
    return res;
  };
  auto rh = [&](string &s) {
    int n = s.length();
    vector<long long> res(n + 1);
    for (int i = 0; i < n; i++) {
      res[i + 1] = f(res[i], s[i]);
    }
    return res;
  };

  const int N = 1e6 + 5;
  vector<vector<long long>> mp(N);

  auto hash = [&](string &s) {
    int L = s.length();
    vector<long long> h = rh(s);
    vector<int> last(26, -1);

    for (int i = 0; i < L; i++) {
      last[s[i] - 'a'] = i;
    }  
    
    for (int i = 0; i <= L; i++) {
      long long pref = h[i];
      for (int j = 0; j < 26; j++) {
        if (last[j] < i) continue;
        long long all = f(pref, j + 'a');
        mp[i].push_back(all);
      }
    }
  };
  for (auto s : a) {
    hash(s);
  }
  for (auto &i : mp) {
    sort(i.begin(), i.end());
  }

  long long ans = 0;
  for (auto s : a) {
    int L = s.length();
    long long cur = rh(s)[L];
    auto l = lower_bound(mp[L - 1].begin(), mp[L - 1].end(), cur);
    auto r = lower_bound(mp[L - 1].begin(), mp[L - 1].end(), cur + 1);
    ans += (r - l);
  }
  cout << ans - n << '\n';

  return 0;
}


Measured memory_bytes: 295312
#include<cstdio>

#define MAX_N 100000
#define MAX_Q 50000

using namespace std;

int S[MAX_N + 5], T[MAX_Q + 5];

bool searchS(int x, int length)
{
    int left = 0, right = length, mid;
    while (left < right) {
        mid = (left + right) / 2;
        if (S[mid] == x) {
            return true;
        }
        else if (S[mid] < x) {
            left = mid + 1;
        }
        else if (S[mid] > x) {
            right = mid;
        }
    }
    return false;
}

int main()
{
    int n, q, sum = 0;
    scanf("%d", &n);
    for (int i = 0; i < n; i++) {
        scanf("%d", &S[i]);
    }
    scanf("%d", &q);
    for (int i = 0; i < q; i++) {
        scanf("%d", &T[i]);
        if (searchS(T[i], n)) {
            sum++;
        }
    }
    printf("%d\n", sum);

    return 0;
}

Measured memory_bytes: 3248
#include<bits/stdc++.h>
#define ll long long

using namespace std;
int n,m,ans;
int table[10][100]={{0,0,0,0,0,0,0,0,0,0},
                   {0,1,-1,-1,-1,-1,-1,-1,-1,-1},
				   {0,2,4,-1,-1,-1,-1,-1,-1,-1},
				   {0,3,6,9,-1,-1,-1,-1,-1,-1,},
				   {0,4,8,12,16,-1,-1,-1,-1,-1},
				   {0,5,10,15,20,25,-1,-1,-1,-1},
				   {0,6,12,18,24,30,36,-1,-1,-1},
				   {0,7,14,21,28,35,42,49,-1,-1},
				   {0,8,16,24,32,40,48,56,64,-1},
				   {0,9,18,27,36,45,54,63,72,81}};

ll read(){
	ll ans=0;
	char last=' ',ch=getchar();
	while(ch<'0' || ch>'9')last=ch,ch=getchar();
	while(ch>='0' && ch<='9')ans=ans*10+ch-'0',ch=getchar();
	if(last=='-')ans=-ans;
	return ans;
}

int main(){
	memset(table,-1,sizeof(table));
	int table[100][100]={{-1,-1,-1,-1,-1,-1,-1,-1,-1,-1},
                   {-1,1,-1,-1,-1,-1,-1,-1,-1,-1},
				   {-1,2,4,-1,-1,-1,-1,-1,-1,-1},
				   {-1,3,6,9,-1,-1,-1,-1,-1,-1,},
				   {-1,4,8,12,16,-1,-1,-1,-1,-1},
				   {-1,5,10,15,20,25,-1,-1,-1,-1},
				   {-1,6,12,18,24,30,36,-1,-1,-1},
				   {-1,7,14,21,28,35,42,49,-1,-1},
				   {-1,8,16,24,32,40,48,56,64,-1},
				   {-1,9,18,27,36,45,54,63,72,81}};
	n=read();m=read();
	if(n>0&&n<=9&&m>0&&m<=9){
		ans=max(table[n][m],table[m][n]);
	printf("%d",ans);
	}
	else printf("-1");
	return 0; 
}

Measured memory_bytes: 256
using System;
using static System.Console;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace 自作プログラムテスト
{
    class Program
    {
        static void Main(string[] args)
        {
            //宣言・初期化↓
            bool TitleMatched = false;
            int CouldntListenTime = 0;

            List<string> Titles = new List<string>();
            List<int> Lengthes = new List<int>();
            int N = int.Parse(ReadLine());
            for (int loop = 0; loop < N; loop++) 
            {
                string[] StringReader = ReadLine().Split(' ');
                Titles.Add(StringReader[0]);
                Lengthes.Add(int.Parse(StringReader[1]));
            }
            string LastTitle = ReadLine();


            //演算処理↓
            for (int loop = 0; loop < Lengthes.ToArray().Length; loop++)
            {
                if (TitleMatched) CouldntListenTime += Lengthes[loop];
                else if (Titles[loop] == LastTitle) TitleMatched = true;
            }

            WriteLine(CouldntListenTime);
        }
    }
}


Measured memory_bytes: 11092
#include<iostream>
#include<vector>
#include<utility>
#include<deque>
#include<algorithm>
#include <iomanip>
#include<cmath>
#include<numeric>

using namespace std;
using ll = long long int;
constexpr int INF = 1 << 29;
constexpr ll MOD = ll(1e9 + 7);

int n, k;
string s;
vector<int> a;

int main(void) {
	cin >> n >> k;
	cin >> s;
	int num = 0;
	for (int i = 0; i < n; i++) {
		int cnt = 1;
		while (i < n && s[i] == s[i + 1]) {
			cnt++;
			i++;
		}
		a.push_back(cnt);
		if (num < k && a.size() == 3) {
			int tmp = a[0] + a[1] + a[2];
			a.clear();
			a.push_back(tmp);
			num++;
		}
	}

	while (num < k && a.size() >= 3) {
		int m = a.size();
		int tmp = a[m - 1] + a[m - 2] + a[m - 3];
		a.pop_back();
		a.pop_back();
		a.pop_back();
		a.push_back(tmp);
		num++;
	}
	int ret = accumulate(a.begin(), a.end(), 0) - a.size();
	if (a.size() == 2 && num < k)
		ret++;
	cout << ret << endl;
	return 0;
}

Measured memory_bytes: 1020
#include <bits/stdc++.h>
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
using namespace std;
using ll = long long;
using P = pair<int,int>;
constexpr int INF = 1001001001;
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 (a>b) { a=b; return 1; } return 0; }

const int mod = 1000000007;
struct mint {
    ll x;
    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 { return mint(*this) += a;}
    mint operator-(const mint a) const { return mint(*this) -= a;}
    mint operator*(const mint a) const { return mint(*this) *= a;}
    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t>>1);
        a *= a;
        if (t&1) a *= *this;
        return a;
    }
    mint inv() const { return pow(mod-2);}
    mint& operator/=(const mint a) { return *this *= a.inv();}
    mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}

int main() {
    string s;
    cin >> s;
    
    int n = s.size();
    vector<vector<mint>> dp(n, vector<mint>(13, 0));
    if (s[0] == '?') rep (i, 10) dp[0][i] = 1;
    else dp[0][s[0]-'0'] = 1;
    rep (i, 1, n) {
        char c = s[i];
        if (c == '?') {
            rep (j, 13) rep(k, 10) dp[i][(j*10+k)%13] += dp[i-1][j];
        }
        else {
            int d = c - '0';
            rep (j, 13) dp[i][(j*10+d)%13] += dp[i-1][j];
        }
    }
    /* 
    rep (i, n) {
        cout << s[i] << "|";
        rep (j, 13) cout << dp[i][j] << " ";
        cout << endl;
    }
     */
    cout << dp[n-1][5] << endl;
    
    return 0;
}


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

int main(){
    int n,k; cin>>n>>k;
    vector<int> a(n);
    rep(i,n) cin>>a[i];
    ll sum = 0;
    rep(i,n) sum += a[i];
    set<ll> candidates;
    for(int i=1;i*i<=sum;i++){
        if(sum%i==0){
            candidates.insert(i);
            candidates.insert(sum/i);
        }
    }
    ll ans = 1;
    for(ll x : candidates){
        ll need=0;
        {
            vector<ll> r(n);
            rep(i,n) r[i] = a[i]%x;
            sort(r.begin(),r.end());
            ll tot = 0;
            rep(i,n) tot += r[i];
            int l = n - tot/x;
            rep(i,l) need += r[i];
        }
        if(need<=k) ans = max(ans,x);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3656
#include <stdio.h>
#include <string>
#include <iostream>
#include <iomanip>
#include <map>
#include <algorithm>
#include <vector>
#include <math.h>
#define MOD 1000000007
using namespace std;

int main(void){
    int n,m,k,temp,ans=0;
    cin >> n >> m;
    vector<int> a(m+1,0);
    for(int i=0; i<n; i++){
      cin >> k;
      for(int j=0; j<k; j++){
        cin >> temp;
        a[temp]++;
      }
    }
    for(int i=1; i<=m; i++){
      if(a[i]==n)ans++;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
import java.util.*;
                public class Main{
                        public static void main(String[] args){ 
                                Scanner sc = new Scanner(System.in); 
                                int n = sc.nextInt(); 
                                int q = sc.nextInt(); 
                                RaddQ rq = new RaddQ(n); 
                                for (int i = 0; i < q; i++) { 
                                        int command = sc.nextInt(); 
                                        if(command == 0){ 
                                                int s = sc.nextInt(); 
                                                int t = sc.nextInt(); 
                                                int x = sc.nextInt(); 
                                                rq.add(0,n,0,s-1,t,x); 
                                        } 
                                        else if (command == 1) { 
                                                int t = sc.nextInt(); 
                                                System.out.println(rq.get(0,n,0,t-1)); 
                                        } 
                                } 
                        } 
                } 
                class RaddQ { 
                        int n, heap[]; 
                        RaddQ(int n){ 
                                this.n = n; 
                                int len = 1; 
                                while(len < n){ 
                                        len*=2; 
                                } 
                                len = 2*len; 
                                heap = new int[len]; 
                        } 
                        void add(int l, int r, int ih, int s, int t, int x){ 
                                if(s>=t){ 
                                        return; 
                                } 
                                if(s==l && t==r){
                                        heap[ih] += x; 
                                        return; 
                                } 
                                int med = (l+r)/2; 
                                add(l, med, ih*2+1, Math.max(s,l), Math.min(t,med), x); 
                                add(med, r, ih*2+2, Math.max(s,med), Math.min(t,r), x); 
                        } 
                        int get(int l, int r, int ih, int t){ 
                                if(r-l == 1){ 
                                        return heap[ih]; 
                                } 
                                int med = (l+r)/2; 
                                if(t<med){
                                        return heap[ih]+get(l, med, ih*2+1, t); 
                                } 
                                else { 
                                        return heap[ih]+get(med, r, ih*2+2, t); 
                                } 
                        } 
                }


Measured memory_bytes: 104812
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <queue>
#include <stack>
#include <map>
#include <algorithm>
#include <math.h>
#include <cassert>
#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 a,b;
  cin >> a >> b;

  if((a-b)%2==0){
    cout << (a+b)/2 << endl;
  }
  else {
    cout << "IMPOSSIBLE" << endl;
  }
}


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

//template
#define rep(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define ALL(v) (v).begin(),(v).end()
typedef long long int ll;
const int inf = 0x3fffffff; const ll INF = 0x1fffffffffffffff; const double eps=1e-12;
template<typename T>inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<typename T>inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
//end

typedef pair<int,int> P;

ll dp[50];

int main(){
   int n,t; cin>>n>>t;
   vector<P> a; vector<int> b;
   rep(i,0,n){
      int x,y; cin>>x>>y;
      if(x==0)b.push_back(y);
      else a.push_back({x,y});
   }
   rep(i,0,50)dp[i]=INF; dp[0]=0;
   sort(ALL(a),[&](P p,P q){return 1LL*p.first*(q.second+1)>1LL*q.first*(p.second+1);});
   for(auto p:a){
      for(int i=40;i>=0;i--)if(dp[i]<t){
         chmin(dp[i+1],(dp[i]+1)*(p.first+1)+p.second);
      }
   }
   sort(ALL(b)); vector<ll> sum(b.size()+1);
   sum[0]=0; rep(i,0,b.size())sum[i+1]=sum[i]+b[i]+1;
   int res=0;
   for(int i=45;i>=0;i--)if(dp[i]<=t){
      int add=lower_bound(ALL(sum),t-dp[i]+1)-sum.begin()-1;
      chmax(res,i+max(add,0));
   } cout<<res<<endl;
   return 0;
}

Measured memory_bytes: 2676
import math

n = int(input())

a = [0]*n

for x in range(1, int(math.sqrt(n))+1):
    for y in range(1, x+1):
        for z in range(1, y+1):
            t = x**2+y**2+z**2+x*y+y*z+z*x-1
            if t >= n:
                break
            if x == y == z:
                a[t] += 1
            elif (x!=y)and(y!=z)and(x!=z):
                a[t] += 6
            else:
                a[t] += 3

for i in range(n):
    print(a[i])

Measured memory_bytes: 9188
#include<bits/stdc++.h>
 
using namespace std;
int main()
 
{
    string s,t;
    cin>>s>>t;
    int x=0;
    for(int i=0;i<3;i++){
        if(s[i]==t[i]){
            x++;
        }
    }
    cout<<x<<endl;
 
 
return 0;
 
}

Measured memory_bytes: 256
N, A, B = map(int, input().split())
Total = 0
for i in range(1, N + 1):
    total = 0
    str_i = str(i)
    len_i = len(str_i)
    for l in range(len_i):
        total += int(str_i[l])
    if A <= total <= B:
        Total += i
print(Total)


Measured memory_bytes: 2940
use std::io;
use std::str::FromStr;

fn read_line() -> String {
    let mut s = String::new();
    io::stdin().read_line(&mut s).unwrap();
    s
}

macro_rules! from_line {
    ($($a:ident : $t:ty),+) => {
        $(let $a: $t;)+
        {
            let _line = read_line();
            let mut _it = _line.trim().split_whitespace();
            $($a = _it.next().unwrap().parse().unwrap();)+
                assert!(_it.next().is_none());
        }
    };
}

fn main() {
    from_line!(a: i64, b: i64);

    println!("{} {} {:.*}", a / b, a % b, 5, a as f64 / b as f64);
}



Measured memory_bytes: 5048
import java.util.*;

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

      if(R < 1200){
    System.out.println("ABC");
    }else if(R >=1200 && R <2800){
    System.out.println("ARC");      
      }else{
    System.out.println("AGC");        
      }
}
}

Measured memory_bytes: 22740
a = int(input())
n = [int(i) for i in input().split()]
count = 0
flag = True
while flag==True:
    for i in range(len(n)):
        if n[i]%2==1:
            flag = False
    
    if flag==False:
        break
    
    count += 1
    for i,j in enumerate(n):
        n[i]=j//2
    #print(n)
print(count)

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

using namespace std;

class Ufds
{
private:
    int n;
    int *p;
    int *s;
    int *r;

public:
    Ufds(int _n)
    {
        n = _n;
        p = new int[n];
        s = new int[n];
        r = new int[n];
        for (int i = 0; i < n; i++)
        {
            p[i] = i;
            s[i] = 1;
            r[i] = 0;
        }
    }
    int root(int i)
    {
        if (p[i] == i)
            return i;
        return p[i] = root(p[i]);
    }
    int size(int i)
    {
        return s[root(i)];
    }
    bool are_joined(int i, int j)
    {
        return root(i) == root(j);
    }
    void join(int i, int j)
    {
        if (are_joined(i, j))
            return;
        int pi = root(i);
        int pj = root(j);
        if (r[pi] == r[pj])
        {
            s[pi] += s[pj];
            r[pi]++;
            p[pj] = pi;
        }
        else if (r[pi] > r[pj])
        {
            s[pi] += s[pj];
            p[pj] = pi;
        }
        else
        {
            s[pj] += s[pi];
            p[pi] = pj;
        }
    }
    ~Ufds()
    {
        delete[] p;
        delete[] s;
        delete[] r;
    }
};

int main()
{
    int n, m, k;
    cin >> n >> m >> k;
    vector<pair<int, int>> f;
    vector<int> s(n, 0);
    Ufds u(n);
    for (int i = 0; i < m; i++)
    {
        int a, b;
        cin >> a >> b;
        a--;
        b--;
        u.join(a, b);
        f.push_back({a, b});
    }
    for (int i = 0; i < n; i++)
    {
        s[i] = u.size(i) - 1;
    }
    for (int i = 0; i < m; i++)
    {
        s[f[i].first]--;
        s[f[i].second]--;
    }
    for (int i = 0; i < k; i++)
    {
        int c, d;
        cin >> c >> d;
        c--;
        d--;
        if (u.are_joined(c, d))
        {
            s[c]--;
            s[d]--;
        }
    }
    for (int i = 0; i < n - 1; i++)
    {
        cout << s[i] << ' ';
    }
    cout << s[n - 1] << endl;
}

Measured memory_bytes: 3316
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#include <cmath>
#include <bitset>
#include <iomanip>
#include <stack>
#include <list>
#include <map>
#include <unordered_map>
#include <chrono>
#include <numeric>
using namespace std;
using ll = long long;
const ll INF = (ll)1e18+1;
const ll DIV = 1000000007;
//#define TEST
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
#ifdef TEST
    chrono::system_clock::time_point start, end;
    start = chrono::system_clock::now();
#endif
    ll K, X;
    cin >> K >> X;
    for(ll i=-K+1;i<K; i++)
    {
        cout << X + i << " ";
    }
    cout << endl;
#ifdef TEST
    end = chrono::system_clock::now();
    cerr << static_cast<double>(chrono::duration_cast<chrono::microseconds>(end - start).count() / 1000.0) << "[ms]" << endl;
#endif
    return 0;
}

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

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

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

const int MAX = 1005;
const int INF = 1001001001;
const int MOD = 1e9 + 7;

bool flg[MAX][MAX];

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

    vector<vector<int>> A(N, vector<int>(N - 1));
    rep(i, N)rep(j, N - 1) cin >> A[i][j], A[i][j]--;

    rep(i, N) reverse(A[i].begin(), A[i].end());

    set<P> st;
    rep(a, N) {
        int b = A[a].back();
        if (a > b) continue;

        if (A[b].back() == a) {
            flg[a][b] = 1;
            st.emplace(a, b);
        }
    }
    
    ll ans = 0;
    while(1) {
        if (st.empty()) break;

        for (auto p : st) {
            auto [a, b] = p;
            A[a].pop_back(), A[b].pop_back();
        }

        set<P> old;
        swap(st, old);
        for (auto p : old) {
            auto [a, b] = p;

            if (A[a].size()) {
                int nb = A[a].back();
                if (A[nb].size() && A[nb].back() == a) {
                    int na = min(a, nb);
                    nb = max(a, nb);
                    if (!flg[na][nb]) {
                        flg[na][nb] = 1;
                        st.emplace(na, nb);
                    }
                }
            }

            if (A[b].size()) {
                int na = A[b].back();
                if (A[na].size() && A[na].back() == b) {
                    int nb = max(na, b);
                    na = min(na, b);
                    if (!flg[na][nb]) {
                        flg[na][nb] = 1;
                        st.emplace(na, nb);
                    }
                }
            }
        }

        ans++;
    }

    rep(j, N)rep(i, j) {
        if (!flg[i][j]) {
            ans = -1;
            break;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 8552
#include<iostream>
#include<utility>
#include<cmath>
using namespace std;
double a;
pair<double,double>f()
{
	double ta=a,b,c,d;
	cin>>b>>c>>d>>a;
	return make_pair(c-ta,d-b);
}
double g(pair<double,double>p,pair<double,double>q)
{
	return p.first*q.first+p.second*q.second;
}
main()
{
	cin>>a;
	while(cin)
	{
		cout<<(abs(g(f(),f()))<1e-10?"YES":"NO")<<endl;
	}
}



Measured memory_bytes: 3176