akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/rope>

#define ll long long
#define pb push_back
#define sz(x) (int)(x).size()
#define mp make_pair
#define f first
#define s second
#define all(x) x.begin(), x.end()

using namespace std;
using namespace __gnu_pbds;
using namespace __gnu_cxx;

template<class T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>; ///find_by_order(),order_of_key()
template<class T1, class T2> ostream& operator<<(ostream& os, const pair<T1,T2>& a) { os << '{' << a.f << ", " << a.s << '}'; return os; }
template<class T> ostream& operator<<(ostream& os, const vector<T>& a) {
	os << '{';
	for(int i=0;i<sz(a);i++)
	{
		if(i>0&&i<sz(a)-1)
			os << ", ";
		os << a[i];
	}
	os << '}';
    return os;
}
const int N=2e5+5;
vector<ll> update(N);
vector<vector<pair<int,ll> > > up(N);
vector<ll> dp(N);
struct segTree{
    vector<ll> maxx;
    vector<ll> lazy;
    void init()
    {
        maxx.resize(4*N);
        lazy.resize(4*N);
    }
    void prop(int i)
    {
        lazy[2*i]+=lazy[i];
        maxx[2*i]+=lazy[i];
        lazy[2*i+1]+=lazy[i];
        maxx[2*i+1]+=lazy[i];
        lazy[i]=0;
    }
    void update(int i)
    {
        maxx[i]=max(maxx[2*i],maxx[2*i+1]);
    }
    void add(int qs,int qe,ll val,int l=0,int r=N-1,int i=1)
    {
        if(qs>qe)
            return;
        if(qs>r||qe<l)
            return;
        if(qs<=l&&qe>=r)
        {
            lazy[i]+=val;
            maxx[i]+=val;
            return;
        }
        prop(i);
        int m=(l+r)>>1;
        add(qs,qe,val,l,m,2*i);
        add(qs,qe,val,m+1,r,2*i+1);
        update(i);
    }
    ll get(int qs,int qe,int l=0,int r=N-1,int i=1)
    {
        if(qs>qe)
            return 0;
        if(qs>r||qe<l)
            return LLONG_MIN;
        if(qs<=l&&qe>=r)
            return maxx[i];
        prop(i);
        int m=(l+r)>>1;
        ll sol=max(get(qs,qe,l,m,2*i),get(qs,qe,m+1,r,2*i+1));
        update(i);
        return sol;
    }
    void print(int n,int l=0,int r=N-1,int i=1)
    {
        if(l>n)
            return;
        if(l==r)
        {
            printf("%i ",maxx[i]);
            return;
        }
        prop(i);
        int m=(l+r)>>1;
        print(n,l,m,2*i);
        print(n,m+1,r,2*i+1);
        update(i);
        if(i==1)
            printf("\n");
    }
}st;
int main()
{
    st.init();
    int n,m;
    scanf("%i %i",&n,&m);
    for(int i=0;i<m;i++)
    {
        int l,r,a;
        scanf("%i %i %i",&l,&r,&a);
        update[l]+=a;
        up[r+1].pb({l,-1*a});
    }
    ll sol=0;
    for(int i=1;i<=n;i++)
    {
        st.add(0,i-1,update[i]);
        for(auto p:up[i])
        {
            st.add(0,p.f-1,p.s);
        }
        dp[i]=st.get(0,i-1);
        //printf("%lld\n",dp[i]);
        sol=max(sol,dp[i]);
        st.add(i,i,dp[i]);
    }
    printf("%lld\n",sol);
    return 0;
}


Measured memory_bytes: 28800
using System;

namespace ITP1_10_D
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            string[] Xdata = Console.ReadLine().Split(' ');
            string[] Ydata = Console.ReadLine().Split(' ');
            int[] Xnumbers = new int[n];
            int[] Ynumbers = new int[n];
            double[] result = new double[n];

            for (int i = 0; i < n; i++)                       　　　   //要素を数字に変換
            {
                Xnumbers[i] = int.Parse(Xdata[i]);
                Ynumbers[i] = int.Parse(Ydata[i]);
                result[i] = Math.Abs(Xnumbers[i] - Ynumbers[i]);
            }

            double Dxy1 = 0;
            for (int i = 0; i < n; i++)                                //p=1のとき
            {
                Dxy1 += result[i];                                     
            }

            double sum2 = 0;
            for (int i = 0; i < n; i++)                               //p=2のとき
            {
                double square = Math.Pow(result[i], 2);
                sum2 += square;
            }
            double Dxy2 = Math.Sqrt(sum2);

            double sum3 = 0;
            for (int i = 0; i < n; i++)                               //p=3のとき
            {
                double square = Math.Pow(result[i], 3);
                sum3 += square;
            }
            double Dxy3 = Math.Pow(sum3, 1.0 / 3.0);

            double Dxy4 = 0;
            for (int i = 0; i < n; i++)                              //p=∞のとき
            {
                if (Dxy4 < result[i])
                    Dxy4 = result[i];
            }

            Console.WriteLine("{0:F8}", Dxy1);
            Console.WriteLine("{0:F8}", Dxy2);
            Console.WriteLine("{0:F8}", Dxy3);
            Console.WriteLine("{0:F8}", Dxy4);
        }
    }
}


Measured memory_bytes: 7940
N = int(input())
p = input().split()
P = sorted(p, key = float)
w = 0
i = 0
while i <= N-1:
  if p[i] == P[i]:
    i += 1
  
  else:
    w += 1
    i += 1
    
if w == 0 or w == 2:
  print('YES')
  
else:
  print('NO')
  


Measured memory_bytes: 3060
#include<iostream>
#include<vector>
#include<algorithm>
#include<cctype>
#include<utility>
#include<string>
#include<cmath>
#include<cstring>
#include<queue>
#include<map>
#include<climits>

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
using namespace std;
typedef pair<int, int> P;
typedef long long int ll;
typedef pair<ll,ll> LLP;
#define INF 1000000007

#define ARRAY_MAX 105

int main(){

    int n;
    while(cin >> n,n){

        int mp[25][25];
        REP(i,25){
            REP(j,25){
                mp[i][j] = 0;
            }
        }
        REP(i,n){
            int a,b;
            cin >> a >> b;
            mp[b][a] = 1;
        }
        
        int m;
        cin >> m;
        int xnow = 10,ynow = 10;
        int cnt = 0;
        REP(i,m){
            char c;
            int d;
            cin >> c >> d;
            if(c == 'N'){
                REP(i,d){
                    ynow++;
                    if(mp[ynow][xnow]){
                        cnt++;
                        mp[ynow][xnow] = 0;
                    }
                }
            }
            if(c == 'E'){
                REP(i,d){
                    xnow++;
                    if(mp[ynow][xnow]){
                        cnt++;
                        mp[ynow][xnow] = 0;
                    }
                }
            }
            if(c == 'W'){
                REP(i,d){
                    xnow--;
                    if(mp[ynow][xnow]){
                        cnt++;
                        mp[ynow][xnow] = 0;
                    }
                }
            }
             if(c == 'S'){
                REP(i,d){
                    ynow--;
                    if(mp[ynow][xnow]){
                        cnt++;
                        mp[ynow][xnow] = 0;
                    }
                }
            }
        }
        if(cnt == n){
            cout << "Yes" << endl;
        }else{
            cout << "No" << endl;
        }
    }


    return 0;
}


Measured memory_bytes: 3088
#include<stdio.h>
int main()
{
	int a,b;
	char c;
	while(scanf("%d %c %d",&a,&c,&b)!=EOF)
	{
		if(c=='?')
		{
			break;
		}
		if(c=='+')
			{
				printf("%d\n",a+b);
			}
		if(c=='-')
			{
				printf("%d\n",a-b);
			}
		if(c=='*')
			{
				printf("%d\n",a*b);
			}
		if(c=='/')
			{
				printf("%d\n",a/b);
			}
	}
	return 0;
 } 

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

int main() {
  int n, k;
  int ans = 0;
  int td = 0;
  int a = 0;
  cin >> n >> k;

  if (n==0) {
    cout << 1 << endl;
    return 0;
  }
  
  int i = 0;
  while(n!=0){
    td = n / k;
    a = n % k;
    ans += pow(k,i);
    n = td;
    i++;
  }

  cout << i << endl;
  return 0;
}


Measured memory_bytes: 256
from collections import Counter, deque, OrderedDict
# from copy import copy, deepcopy
# from functools import reduce
# from heapq import heapify, heappop, heappush
# from itertools import accumulate, permutations, combinations, combinations_with_replacement, groupby, product
# import math
# import numpy as np  # Pythonのみ！
# from operator import xor
# import re
# from scipy.sparse.csgraph import connected_components  # Pythonのみ！
# ↑cf.  https://note.nkmk.me/python-scipy-connected-components/
# from scipy.sparse import csr_matrix
# import statistics # Pythonのみ
# import string
import sys
sys.setrecursionlimit(10 ** 5 + 10)


def input(): return sys.stdin.readline().strip()


def resolve():

    N = int(input())
    A = list(map(int, input().split()))

    AA = Counter(A)
    ans = 0
    val = 0
    for k, v in AA.items():
        if v % 2 == 0:
            ans += 1
        else:
            val += 1
    if ans % 2 !=0:
        ans -= 1
    print(val+ans)


resolve()

Measured memory_bytes: 61548
//http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ITP1_7_C
#include <iostream>
using namespace std;

int main(){

  int r,c;
  cin >> r >> c;
  int sheet[r+1][c+1];

  for(int i = 0; i <= r; i++){
    for(int j = 0; j <= c; j++){
      sheet[i][j] = 0;
    }
  }

  for(int i = 0; i < r; i++){
    for(int j = 0; j < c; j++){
      cin >> sheet[i][j];
    }
  }
  //?????\

/*
  //??????????¨?????¨????
  for(int i = 0; i < r; i++){
    int sum = 0;
    for(int j = 0; j < c; j++){
      sum += sheet[i][j];
    }
    sheet[i][c+1] = sum;
  }

  //??????????¨?????¨????
  for(int j = 0; j < c; j++){
    sum = 0;
    for(int i = 0; i < r; i++){
      sum += sheet[i][j];
    }
    sheet[r+1][j] = sum;
  }

  sum =0;
  for(int j = 0; j < c; j++){
    for(int i = 0; i < r; i++){
      sum += sheet[i][j];
    }
  }
*/

  for(int i = 0; i < r; i++){
    for(int j = 0; j < c; j++){
        sheet[i][c] += sheet[i][j];
        sheet[r][j] += sheet[i][j];
        sheet[r][c] += sheet[i][j];
    }
  }
  for(int i = 0; i < r+1; i++){
    for(int j = 0; j < c; j++){
      cout << sheet[i][j] << " ";
    }
    cout << sheet[i][c] << endl;
    }
}

Measured memory_bytes: 1196
#include<bits/stdc++.h>
using namespace std;
int main(){
  long N;cin>>N;
  vector<long>A(N),B(N);
  for(long i=0;i<N;i++)cin>>A[i]>>B[i];
  long c=0;
  for(long i=N-1;i>=0;i--){
    if((A[i]+c)%B[i]!=0){
      c+=B[i]-(A[i]+c)%B[i];
    }
  }
  cout<<c;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
int main(){
  ll n,a[200010],max=0,i;
  cin >> n;
  for(i=0;i<n;i++){
    cin >> a[i];
  }
  ll sum=0;
  for(i=0;i<n;i++){
    if(max<a[i]){
      max=a[i];
    }
    else{
      sum+=(max-a[i]);
    }
  }
  cout << sum << endl;
}

Measured memory_bytes: 5192
import java.util.Scanner;

public class Main{
	public static void main(String[] args){
		int k,s, ans = 0;
		Scanner sc = new Scanner(System.in);
		k = sc.nextInt();
		s = sc.nextInt();
			
		for(int x=0; x <=k; x++){
			for(int y=0; y<=k; y++){
				int z = s - x -y;
				if(0 <= z && z <=k){
					ans += 1;
					}
				}
			}
		System.out.println(ans);
	}
}



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

namespace AOJ1_1_B
{
    class Program
    {
        static void Main(string[] args)
        {
            int x;
            x = int.Parse(Console.ReadLine());
            Console.WriteLine(x*x*x);
        }
    }
}



Measured memory_bytes: 15940
#include <bits/stdc++.h>
#define pb push_back
#define f first
#define s second
#define ind(a) scanf("%d", &a)
#define inlld(a) scanf("%lld", &a)
#define ind2(a, b) scanf("%d%d", &a, &b)
#define inlld2(a, b) scanf("%lld%lld", &a, &b)
#define ind3(a, b, c) scanf("%d%d%d", &a, &b, &c)
#define inlld3(a, b, c) scanf("%lld%lld%lld", &a, &b, &c)

using namespace std;

const int N=1e3+5;
const int MOD=1e9+7;

typedef long long ll;
typedef long double ld;

ll n, m, dp[N][N];

int main() 
{
    cin>>n>>m;
    for(ll a=1; a<=n; a++)
        for(ll b=1; b<=m; b++)
        {
            dp[1][1]=1;
            char x;
            cin>>x;
            if(x=='#')
                dp[a][b]=0;
            else
                dp[a][b]=(dp[a-1][b]+dp[a][b-1])%MOD;
        }
    printf("%lld\n", dp[n][m]);
    return 0;
}



Measured memory_bytes: 8064
#include <bits/stdc++.h>
using namespace std;
int main() {
    int N; cin >> N;
    vector<int> w(N);
    for(int i = 0; i < N; i++) cin >> w.at(i);
    
    int ans = 1000000;
    for(int t = 0; t < N; t++) {
        int a = 0;
        for(int i = 0; i <= t; i++) {
            a += w.at(i);
        }
        int b = 0;
        for(int i = t+1; i < N; i++) {
            b += w.at(i);
        }
        ans = min(ans, abs(a-b));
    }
    
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<cstring>
#include<cmath>
#include<iterator>
#include<cstdlib>
#define IOS   ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ses   "\n"
#define whp   " "
#define mxi 99999

#define rep0(i,a,b) for(int i=a; i<b; i++)
#define rep1(i,a,b) for(int i=a; i<=b; i++)
#define rep0in(i,a,b) for(int i=a-1; i>=b; i--)
#define rep1in(i,a,b) for(int i=a; i>b; i--)
#define repv(i,a) for(auto i=a.begin(); i!=a.end();++i)

///set <int, greater <int> > ::iterator it;
///vector<pair<int,int> >a;
#define MS(a,b) memset(a,b,sizeof(a));

typedef long long ll;
typedef unsigned long long ull;
using namespace std;
ll fx[4]= {1,-1,0,0};
ll fy[4]= {0,0,1,-1};
int smallest(int x, int y, int z)
{
    int c = 0;
    while (x && y && z) {
        x--;
        y--;
        z--;
        c++;
    }
    return c;
}
bool rs(ll a, ll b){
    return(a>b);

    }
int main()
{
    char ch;cin>>ch;
    if(ch>='A' && ch<='Z') cout<<"A"<<endl;
    else cout<<"a"<<endl;

return 0;
}


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

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

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

    vector<int> c(m), d(m);
    for (int j = 0; j < m; j++) {
        cin >>c[j] >>d[j];
    }

    for (int i = 0; i < n; i++) {
        int cp, dist = 400000001;
        for (int j = 0; j < m; j++) {
            int t = abs(a[i]-c[j]) + abs(b[i]-d[j]);
            if (t<dist) {
                dist = t;
                cp = j + 1;
            }
        }
        cout << cp << endl;
    }
    return 0;
}

Measured memory_bytes: 256
S = input()

marker = len(S)
flag = True

while flag and (marker > 0):

    if S[marker-7:marker] == "dreamer":
        marker -= 7
    elif S[marker-6:marker] == "eraser":
        marker -= 6
    elif S[marker-5:marker] == "dream":
        marker -= 5
    elif S[marker-5:marker] == "erase":
        marker -= 5
    else:
        flag = False
if flag:
    print("YES")
else:
    print("NO")

Measured memory_bytes: 3188
n = int(input())
a = []
for i in range(n):
  a.append(int(input()))
b = []
b += a
b.sort()
if b[-1] == b[-2]:
  maxi = max(a)
  for i in range(n):
    print(maxi)
else:
  maxi = max(a)
  for i in range(n):
    if a[i] != maxi:
      print(maxi)
    else:
      print(b[-2])

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

using E = System.Linq.Enumerable;

public class Program
{
    public static void Main()
    {
        var s = Console.ReadLine().Trim();
        var t = Console.ReadLine().Trim();


        Console.WriteLine(s == t.Substring(0, t.Length - 1) ? "Yes" : "No");
    }
}


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


void solve()
{
    long long a,x,y;
    cin >> x >> y;
    a = x;
    int cnt = 0;
    long long dbl = 2;
    while (a <= y){
        ++cnt;
        a = dbl * x;
        dbl *= 2;
    }
    cout << cnt << endl;
}

int main()
{
    cin.tie();
    ios::sync_with_stdio(false);
    // int ti = clock();
    // input();
    solve();
    // printf("Execution Time: %.4lf sec\n", 1.0 * (clock() - ti) / CLOCKS_PER_SEC);
    return 0;
}

Measured memory_bytes: 3568
#include<iostream>
#include<vector>
#include<map>
#include<set>
#include<unordered_map>
#include<unordered_set>
#include<queue>
#include<stack>
#include<algorithm>
#include<string>
using namespace std;

int main()
{
	long long int n,i,ans=0,j,low;cin>>n;
	string s;cin>>s;
    vector<long long int>v[3];
    for(i=0;i<n;i=i+1)
    {
    	if(s[i]=='R'){v[0].push_back(i);}
    	else if(s[i]=='G'){v[1].push_back(i);}
    	else{v[2].push_back(i);}
    }
    for(i=0;i<n-2;i=i+1)
    {
    	for(j=i+1;j<n-1;j=j+1)
    	{
    		if(s[i]!=s[j])
    		{
               if(s[i]!='R' && s[j]!='R')
               {
               	  low = lower_bound(v[0].begin(),v[0].end(),j)-v[0].begin();
               	  ans=ans+(v[0].size()-low);
               	  if(binary_search(v[0].begin(),v[0].end(),2*j-i)){ans=ans-1;}
               }
               else if(s[i]!='G' && s[j]!='G')
               {
               	  low = lower_bound(v[1].begin(),v[1].end(),j)-v[1].begin();
               	  ans=ans+(v[1].size()-low);
               	  if(binary_search(v[1].begin(),v[1].end(),2*j-i)){ans=ans-1;}
               }
               else 
               {
               	  low = lower_bound(v[2].begin(),v[2].end(),j)-v[2].begin();
               	  ans=ans+(v[2].size()-low);
               	  if(binary_search(v[2].begin(),v[2].end(),2*j-i)){ans=ans-1;}
               }
    		}
    	}
    }
    cout<<ans<<endl;
	
	
}

Measured memory_bytes: 3712
import java.io.*;
import java.util.*;

public class Main {
  private static void execute(ContestReader reader, PrintWriter out) {
    int n = reader.nextInt();
    int m = reader.nextInt();
    out.println(n == m ? "Yes" : "No");
  }
  
  public static void main(String[] args) {
    ContestReader reader = new ContestReader(System.in);
    PrintWriter out = new PrintWriter(System.out);
    execute(reader, out);
    out.flush();
  }
}

class ContestReader {
  private BufferedReader reader;
  private StringTokenizer tokenizer;
  
  ContestReader(InputStream in) {
    reader = new BufferedReader(new InputStreamReader(in));
  }
  
  public String next() {
    while (tokenizer == null || !tokenizer.hasMoreTokens()) {
      try {
        tokenizer = new java.util.StringTokenizer(reader.readLine());
      } catch (Exception e) {
        throw new RuntimeException(e);
      }
    }
    return tokenizer.nextToken();
  }
  
  public int nextInt() {
    return Integer.parseInt(next());
  }
  
  public long nextLong() {
    return Long.parseLong(next());
  }
  
  public double nextDouble() {
    return Double.parseDouble(next());
  }
  
  public String[] next(int n) {
    String[] array = new String[n];
    for (int i = 0; i < n; i++) {
      array[i] = next();
    }
    return array;
  }
  
  public int[] nextInt(int n) {
    int[] array = new int[n];
    for (int i = 0; i < n; i++) {
      array[i] = nextInt();
    }
    return array;
  }
  
  public long[] nextLong(int n) {
    long[] array = new long[n];
    for (int i = 0; i < n; i++) {
      array[i] = nextLong();
    }
    return array;
  }
  
  public double[] nextDouble(int n) {
    double[] array = new double[n];
    for (int i = 0; i < n; i++) {
      array[i] = nextDouble();
    }
    return array;
  }
  
  public char[] nextCharArray() {
    return next().toCharArray();
  }
  
  public int[][] nextInt(int n, int m) {
    int[][] matrix = new int[n][m];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        matrix[i][j] = nextInt();
      }
    }
    return matrix;
  }
  
  public long[][] nextLong(int n, int m) {
    long[][] matrix = new long[n][m];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        matrix[i][j] = nextLong();
      }
    }
    return matrix;
  }
  
  public double[][] nextDouble(int n, int m) {
    double[][] matrix = new double[n][m];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        matrix[i][j] = nextDouble();
      }
    }
    return matrix;
  }
  
  public char[][] nextCharArray(int n) {
    char[][] matrix = new char[n][];
    for (int i = 0; i < n; i++) {
      matrix[i] = next().toCharArray();
    }
    return matrix;
  }
}


Measured memory_bytes: 21204
import java.util.Scanner;

public class Main {

	static int h, w;
	static char[][] a;
	static int[] dx = {0, -1, 0, 1};
	static int[] dy = {-1, 0, 1, 0};

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		h = sc.nextInt();
		w = sc.nextInt();
		a = new char[h][w];
		for(int i = 0 ; i < h ; i++) a[i] = sc.next().toCharArray();
		int cnt = 0;
		for(int i = 0 ; i < h ; i++) {
			for(int j = 0 ; j < w ; j++) {
				if(a[i][j] == '#') cnt++;
			}
		}
		if(cnt != h + w - 1) {
			System.out.println("Impossible");
			return;
		}
		if(dfs(0, 0)) System.out.println("Possible");
		else System.out.println("Impossible");
	}

	static boolean dfs(int x, int y) {
		if(x == h - 1 && y == w - 1) return true;
		for(int i = 0 ; i < 4 ; i++) {
			int nx = x + dx[i];
			int ny = y + dy[i];
			if(h - 1 < nx && w - 1 < ny) {
				return false;
			}
			if(0 <= nx && nx < h && 0 <= ny && ny < w && a[nx][ny] == '#' && (i == 2 || i == 3)) {
				a[x][y] = '.';
				if(dfs(nx, ny)) return true;
				a[x][y] = '#';
			} else if(0 <= nx && nx < h && 0 <= ny && ny < w && a[nx][ny] == '#' && (i == 0 || i == 1)) {
				return false;
			}
		}
		return false;
	}

}


Measured memory_bytes: 21844
fun main(args: Array<String>) {
  val ab = readLine()!!.split(" ").map { it.toInt() }
  var a = ab.max()!!
  var b = ab.min()!!

  var r = a % b
  while( r != 0 ){
    a = b
    b = r
    r = a % b
  }

  print(ab[0].toLong()*ab[1]/b)
}

Measured memory_bytes: 37908
#include<bits/stdc++.h>
#include<boost/variant.hpp>
using namespace std;
typedef long long ll;
typedef vector<boost::variant<bool, ll, int, string, double, char*, const char*>> any;
template<typename T> inline void pr(const vector<T> &xs){
	for(int i=0; i<xs.size()-1; i++) cout<<xs[i]<<" ";
	(xs.empty()?cout:(cout<<xs[xs.size()-1]))<<endl;
}
#ifdef DEBUG
#define debug(...) pr(any{__VA_ARGS__})
#define debugv(x) pr((x))
#else
#define debug(...)
#define debugv(x)
#endif

template<typename T>
struct Point {
	T x, y;
	Point(T x=0, T y=0):x(x), y(y) {}
	Point(std::pair<T, T> p): x(p.first), y(p.second) {}
	Point& operator+= (const Point &o){ x += o.x; y += o.y; return *this; }
	friend Point operator+ (Point a, const Point &b) { a += b; return a; }
	Point& operator-= (const Point &o){ x -= o.x; y -= o.y; return *this; }
	friend Point operator- (Point x, const Point &y) { x -= y; return x; }
	Point& operator*= (const T &a) { x *= a, y *= a; return *this; }
	friend Point operator* (const T a, Point x) { x *= a; return x; }
	Point& operator/= (const T &a) { x /= a, y /= a; return *this; }
	friend Point operator/ (Point x, const T a) { x /= a; return x; }
	T dot(const Point &o) const { return x*o.x+y*o.y; }
	T det(const Point &o){ return x*o.y-y*o.x; }
	// complex product
	Point cp(const Point &o) {
		complex<T> p = complex<T>(x, y) * complex<T>(o.x, o.y);
		return Point(p.real(), p.imag());
	}
	bool operator< (const Point &o) { return x<o.x || (x==o.x && y<o.y); };
};

typedef Point<double> P;
double dist2(P a, P b){
	return (a-b).dot(a-b);
}

vector<P> circles_intersections(P x1, double r1, P x2, double r2){
	P z = x2-x1;
	double d2 = dist2(z, P());
//	double cos = (r1*r1 + d2 - r2*r2)/(2*r1*sqrt(d2));
//	if(cos<-1 || 1<cos) return {};
//	P p(r1*cos, r1*sqrt(1-cos*cos));
//	vector<P> r{p, P(p.x, -p.y)};
//	for(P &t: r){
//		t = t.cp(z) / sqrt(d2) + x1;
//	}
//	return r;
	double a = (d2 + r1*r1 - r2*r2)/2;
	double b2 = d2 * r1*r1 - a*a;
	double c = d2;
	if(abs(b2) < 1e-10){
		return {P(a * z.x / c, a * z.y / c) + x1};
	}
	if(b2 < 0) return vector<P>();

	double b = sqrt(b2);
	return {P((a * z.x + z.y * b) / c,
			  (a * z.y - z.x * b) / c) + x1,
		   P((a * z.x - z.y * b) / c,
			 (a * z.y + z.x * b) / c) + x1};
}

int main(){
	int N, K;
	cin >> N >> K;
	vector<double> X(N), Y(N), C(N);
	for(int i=0; i<N; i++) cin >> X[i] >> Y[i] >> C[i];

	double lb = 0, ub = 1000000;
	double eps = 1e-8;
	for(int l=0; l<100; l++){
		double med = (lb+ub)/2;
		bool ok = false;
		vector<P> candidates;
		for(int i=0; i<N; i++){
			for(int j=0; j<N; j++){
				if(i==j) continue;
				vector<P> is = circles_intersections(P(X[i], Y[i]), med/C[i], P(X[j], Y[j]), med/C[j]);
				for(P p: is){
					candidates.push_back(p);
				}
			}
			candidates.push_back(P(X[i], Y[i]));
		}

		for(P p: candidates){
			int cnt = 0;
			for(int k=0; k<N; k++){
				if(C[k]*sqrt(dist2(P(X[k], Y[k]), p)) <= med+eps) cnt++;
			}
			if(cnt >= K){
				ok = true;
				debug(med, cnt, K, p.x, p.y);
			}
		}

		if(ok){
			ub = med;
		} else {
			lb = med;
		}
	}

	cout << setprecision(10) << lb << endl;

	return 0;
}


Measured memory_bytes: 384
#include<iostream>
#include<iostream>
#include<stdio.h>
#include<string>
#include<vector>
#include<map>
#include<math.h>
#include<algorithm>
#include<iomanip>

using namespace std;

long long n, m;

int main() {
	cin >> n >> m;
	if (n >= 0)
		cout << "Positive" << endl;
	else {
		if (m >= 0)
			cout << "Zero" << endl;
		else {
			if (abs(n - m) % 2 == 0)
				cout << "Negative" << endl;
			else
				cout << "Positive" << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 256
//g++  7.4.0

#include <iostream>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
    ll T = 1;
    while(T--)
    {
        ll N,M,K; cin>>N>>M>>K;
        ll b = 0;
        string s[N];
        for(ll i=0;i<N;++i)
        {
            cin>>s[i];
            for(ll j=0;j<M;++j)
            {
                if(s[i][j] == '#')
                    b++;
            }
        }
        ll ans = 0;
        
        for(ll mask = 0;mask < (1LL << (N + M));++mask)
        {
            vector<ll> row;
            vector<ll> col;
            ll tot = 0;
            
            for(ll i=0;i<(N + M);++i)
            {
                if(mask & (1LL << i))
                {
                    if(i >= N) //col
                    {
                        col.push_back(i - N);
                    }
                    else
                    {
                        row.push_back(i);
                    }
                }
                
            }
            
            ll done[N][M];
            memset(done,0,sizeof(done));
            
            for(auto it: row)
            {
                for(ll i=0;i<M;++i)
                {
                    if(s[it][i] == '#' && !done[it][i])
                    {
                        tot++;
                        done[it][i] = 1;
                    }
                }
            }
            
            for(auto it: col)
            {
                for(ll i=0;i<N;++i)
                {
                    if((s[i][it] == '#') && !done[i][it])
                    {
                        tot++;
                        done[i][it] = 1;
                    }
                }
            }
            
            if(b - tot == K)
                ans++;
        }
        
        cout<<ans<<endl;
    }
}

Measured memory_bytes: 3636
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String n = sc.next();
        int ans = 0;
        for (int i = 0; i < n.length(); i++) {
            if (n.charAt(i) == '1') {
                ans++;
            }
        }
        System.out.println(ans);
    }
}

Measured memory_bytes: 21716
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i, x, n) for (int i = x; i < (n); i++)
#define all(n) begin(n), end(n)
struct cww
{
    cww()
    {
        ios::sync_with_stdio(false);
        cin.tie(0);
    }
} star;
const long long INF = numeric_limits<long long>::max();
typedef long long ll;
typedef vector<int> vint;
typedef vector<char> vchar;
typedef vector<vector<int>> vvint;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef unsigned long long ull;
template <class T>
bool chmax(T &a, const T &b)
{
    if (a < b)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T &a, const T &b)
{
    if (b < a)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <typename T>
vector<T> make_v(size_t a) { return vector<T>(a); }

template <typename T, typename... Ts>
auto make_v(size_t a, Ts... ts)
{
    return vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...));
}
template <typename T, typename V>
typename enable_if<is_class<T>::value == 0>::type
fill_v(T &t, const V &v) { t = v; }

template <typename T, typename V>
typename enable_if<is_class<T>::value != 0>::type
fill_v(T &t, const V &v)
{
    for (auto &e : t)
        fill_v(e, v);
}
ll f(ll x)
{
    if (x % 2 == 0)
    {
        if ((x / 2 - 1) % 2 == 0)
        {
            return x;
        }
        else
        {
            return (1 xor x);
        }
    }
    else
    {
        if (((x - 1) / 2) % 2 == 0)
        {
            return 0;
        }
        else
        {
            return 1;
        }
    }
}
int main()
{
    ll A, B;
    cin >> A >> B;
    cout << (f(B) xor f(A - 1));
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
 
#define EPS 1e-10
#define equal(a,b) (fabs(a-b) < EPS)
#define lt(a,b) (a-b < -EPS)
#define le(a,b) (lt(a,b) || equal(a,b))
typedef long long ll;
 
class Point{
public:
    Point(){}
    Point(double x,double y,double z) : x(x), y(y), z(z) {}
   
    Point operator + (const Point &p)const{ return Point(x+p.x,y+p.y,z+p.z); }
    Point operator - (const Point &p)const{ return Point(x-p.x,y-p.y,z-p.z); }
    Point operator * (double k)const{ return Point(x*k,y*k,z*k); }
    Point operator / (double k)const{ return Point(x/k,y/k,z/k); }
    double x,y,z;
};
 
double dot(const Point &a,const Point &b){
    return a.x*b.x + a.y*b.y + a.z*b.z;
}
 
Point cross(const Point &a,const Point &b){
    return Point(a.y*b.z-a.z*b.y,a.z*b.x-a.x*b.z,a.x*b.y-a.y*b.x);
}
 
double norm(const Point &p){
    return dot(p,p);
}
 
double abs(const Point &p){
    return sqrt(norm(p));
}
 
istream &operator >> (istream &is,Point &p){
    return is >> p.x >> p.y >> p.z;
}
 
class Line{
public:
    Line(){}
    Line(Point s,Point t) : s(s), t(t) {}
    Point s,t;
};
 
Point projection(const Line &l,const Point &p){
    Point b = l.t - l.s;
    double t = dot(p-l.s,b)/norm(b);
    return l.s + b*t;
}
 
double distanceLP(const Line &l,const Point &p){
    return abs(p-projection(l,p));
}
 
class Cube{
public:
    Cube(){}
    Cube(Point p,double r) : p(p), r(r) {}
    Point p;
    double r;
};
 
#define COUNTER_CLOCKWISE 1
#define CLOCKWISE -1
#define ONLINE_BACK 2
#define ONLINE_FRONT -2
#define ON_SEGMENT 0
typedef Point Vector;
  
int ccw(Point p0,Point p1,Point p2){
    Vector a = p1 - p0;
    Vector b = p2 - p0;
    if(abs(cross(a,b)) > EPS) return COUNTER_CLOCKWISE; 
    if(abs(cross(a,b)) < -EPS) return CLOCKWISE; 
    if(dot(a,b) < -EPS) return ONLINE_BACK; 
    if(norm(a) < norm(b)) return ONLINE_FRONT; 
    return ON_SEGMENT;
}
 
bool isIntersectCL(const Cube &c,const Line &l){
    vector<Point> vec;
    double d = distanceLP(l,c.p);
    if(le(d,c.r)){
	Point p = projection(l,c.p);
	Point v = (l.t - l.s) / abs(l.t - l.s);
	d = sqrt(c.r*c.r-d*d);
	vec.push_back(p - v*d);
	vec.push_back(p + v*d);
	for(int i = 0 ; i < (int)vec.size() ; i++){
	    if(ccw(l.s,l.t,vec[i]) == ON_SEGMENT){
		return true;
	    }
	}
    }
    return false;
}
 
class Obj{
public:
    Obj(){}
    Obj(Cube c,ll l) : c(c), l(l) {}
    Cube c;
    ll l;
};
 
int main(){
    int N,Q;
    cin >> N >> Q;
    vector<Obj> obj(N);
    for(int i = 0 ; i < N ; i++){
	cin >> obj[i].c.p >> obj[i].c.r >> obj[i].l;
    }
    for(int i = 0 ; i < Q ; i++){
	Line l;
	cin >> l.s >> l.t;
	ll res = 0LL;
	for(int j = 0 ; j < N ; j++){
	    if(isIntersectCL(obj[j].c,l)){
		res += obj[j].l;
	    }
	}
	cout << res << endl;
    }
    return 0;
}

Measured memory_bytes: 3268
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>

// c++11
#include <array>
#include <tuple>
#include <unordered_map>
#include <unordered_set>

#define mp make_pair
#define mt make_tuple
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;

using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;

const int INF = 1 << 29;
const double EPS = 1e-9;
const ll MOD = 1000000007;

const int dx[] = {1, 0, -1, 0}, dy[] = {0, -1, 0, 1};
const int MAX_NV = 110;
const int MAX_T = 210;

int N;
vector<int> T,V;
map<int, int> limits;
double dp[MAX_NV * MAX_T * 2][MAX_NV * 2];
int sum;
double memo(int pos, int v){
    if (v < 0){
      return -INF;
    }

    if (v > limits[pos]){
      return -INF;
    }
    if (pos >= sum){
      if (v == 0){
        return 0;
      }
      return -INF;
    }

    double &res = dp[pos][v];
    if (res > -2 * INF){
      return res;
    }
    res = -INF;
    res = max(res, memo(pos + 1, v) + v);
    if (v < limits[pos]){
      res = max(res, memo(pos + 1, v + 1) + v + 0.5);
    }
    res = max(res, memo(pos + 1, v - 1) + v - 0.5);
    return res;
}

int main() {
  cin >> N;
  T.resize(N);
  V.resize(N);
  for (int i = 0; i < N; i++){
    cin >> T[i];
    T[i] *= 2;
    sum += T[i];
  }
  for (int i = 0; i < N; i++){
    cin >> V[i];
    V[i] *= 2;
  }
  for (int i = 1; i < N; i++){
    T[i] += T[i - 1];
  }
  int pre = 0;
  for (int i = 0; i < N; i++){
    for (int j = pre; j <= T[i]; j++){
      limits[j] = V[i];
    }
    pre = T[i];
  }
  // double dp[MAX_NV * MAX_T][MAX_NV * 2];
  for (int i = 0; i < MAX_NV * MAX_T * 2; i++){
    for (int j = 0; j < MAX_NV * 2; j++){
      dp[i][j] = -2 * INF;
    }
  }
  double result = (double)memo(0, 0) / 4;
  if (result <= 0){
    result = 0;
  }
  printf("%.20lf\n", result);
  return 0;
}


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

int main(){
	string game;
	while(cin >> game, game[0] != '0'){
		int a = 0; int b = 0;

		for(int i=1; i < game.length(); i++){
			if(game[i] == 'A') a++;
			else b++;
		}
		if(a < b) cout << a << " " << b+1 << endl;
		else cout << a+1 << " " << b << endl;

	}
}

Measured memory_bytes: 1180
# C
X=int(input())

def Primefact(n):
    Dic={}
    for i in range(2,int(pow(n,0.5))+1):
        if n%i==0:
            Dic[i]=0
            while True:
                n/=i
                Dic[i]+=1
                if n%i!=0:
                    break
        if n==1:
            break
    if n!=1:
        Dic[int(n)]=1
    return Dic

while True:
    D=Primefact(X)
    if len(D)==1:
        if X in D.keys():
            ans=X
            break
    X+=1
print(ans)

Measured memory_bytes: 39152
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#define ll long long
#define rep(i,n) for(ll i=0;i<(n);i++)
#define max(p,q) ((p)>(q)?(p):(q))
#define min(p,q) ((p)<(q)?(p):(q))
#define chmax(a,b) ((a)=(a)>(b)?(a):(b))
#define chmin(a,b) ((a)=(a)<(b)?(a):(b))
#define abs(p) ((p)>=(0)?(p):(-(p)))
#define MOD 1000000007
ll powll(ll a,ll b){ll r=1;rep(i,b){r*=a;}return r;}
#define swap(a,b) do{ll w=(a);(a)=(b);(b)=w;}while(0)
#define swapd(a,b) do{double w=(a);(a)=(b);(b)=w}while(0)
//your code here!
int main(void){
    ll N, ans=1, alph[30]={0}, i=0;
    char S[100100];
    scanf("%lld %s", &N, S);
    while(S[i]!='\0') alph[S[i++]-'a']++;
    rep(i, 30) if(alph[i]>0) ans = (ans*(alph[i]+1)) % MOD;
    if(ans>0) printf("%lld\n", --ans);
    else printf("%lld\n", MOD-1);
    return 0;
}


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


fn abc(n: i32, k: i32) -> i32 {
    if n % k == 0 {
        return 0
    } else {
        return 1
    }
}


fn main() {
    /*
    assert_eq!(abc(), "Yes");
    assert_eq!(abc(101), "No");
    assert_eq!(abc(999999999), "Yes");
    */
    let n: i32 = read();
    let k: i32 = read();

    let result = abc(n, k);
    
    println!("{}", result);
    
}


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

Measured memory_bytes: 4352
#include "bits/stdc++.h"
using namespace std;
const int maxn = 3555;
int M(){
    int a, b, c;
    if(!(cin >> a >> b >> c)) return 0;
    cout << (a ^ b ^ c) << endl;
    return 1;
}
int main(){
    while(M());
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define FIO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define DEBUG_ARR(x, a, b) for(int i=a; i<=b; i++) cerr<<x[i]<<" "; cerr<<endl;
#define DEBUG_STR(x, a, b) for(int i=a; i<=b; i++) cerr<<x[i]; cerr<<endl;


using namespace std;

typedef long long ll;
typedef unsigned long long llu;

int main() {
	FIO;
	int n,m;
	cin>>n>>m;
	ll ans = 0;
	if(n >= 2){
		ans += 1LL*(n*(n-1))/2;
	}
	if(m >= 2){
		ans += 1LL*(m*(m-1))/2;
	}
	cout<<ans;
	return 0;
}


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

class QuickUnion {
  public:
    vector<int> id;
    vector<long long int> size;
    void init(long long int s) {
      id.resize(s);
      iota(id.begin(), id.end(), 0);
      vector<long long int> vec(s, 1LL);
      size = vec;
    }
    int root(int i) {
      while(i != id[i]) i = id[i];
      return i;
    }
    long long int unite(int p, int q) {
      int i = root(p);
      int j = root(q);
      if(i == j) return 0LL;
      else {
        long long int res = size[i] * size[j];
        if(size[i] < size[j]) {
          id[i] = j;
          size[j] = size[i] + size[j];
        }
        else {
          id[j] = i;
          size[i] = size[i] + size[j];
        }
        return res;
      }
    }
};

int main() {
  long long int n;
  int m;
  cin >> n >> m;
  vector<pair<int, int>> v(m);
  for(int i=0;i<m;i++) {
    cin >> v[m-i-1].first >> v[m-i-1].second;
    v[m-i-1].first--;
    v[m-i-1].second--;
  }

  QuickUnion islands;
  islands.init(n);

  vector<long long int> ans(m);
  ans[0] = n * (n - 1) / 2;
  for(int i=0;i<m-1;i++) {
    if(ans[i] == 0) break;
    else ans[i+1] = ans[i] - islands.unite(v[i].first, v[i].second);
  }

  for(int i=0;i<m;i++) cout << ans[m-1-i] << endl;
}


Measured memory_bytes: 4080
#include "bits/stdc++.h"
using namespace std;
#define FAST ios_base::sync_with_stdio(false); cin.tie(0);
#define LLINF 1e18//1234567890987654321
#define INF 1234567890
#define pb push_back
#define ins insert
#define f first
#define s second
#define db 0
#define EPS (1e-7)    //0.0000001 the value
#define PI (acos(-1))
#define MAXN 200006
#define MAXK 26
#define MAXX 15000006
#define ll long long int
#define rep0(kk, l1, l2)for(ll kk = l1; kk < l2; kk++)
#define rep1(kk, l1, l2)for(ll kk = l1; kk <= l2; kk++)
#define forit(it, A) for(set<ll>::iterator it = A.begin(); it != A.end(); it++)
#define cr(x) cerr << #x << " = " << x << "\n";
#define crA(x, A) cerr << #x << " = " << A[x] << "\n";
#define mmst(x, v) memset((x), v, sizeof ((x)));
#define bg(ms) (*ms.begin())
#define ed(ms) (*prev(ms.end(), 1))
#define addedge(a, b, c, v) v[(a)].pb(pi((b), (c))); v[(b)].pb(pi((a), (c)))
#define ph push
#define btinpct(x) __builtin_popcountll(x)
#define p2(x) (1LL<<(x))
#define all(x) (x).begin(), (x).end()
#define lbd(x, y) lower_bound(all(x), y)
#define ubd(x, y) upper_bound(all(x), y)
typedef pair <ll, ll> pi;
typedef pair <ll, pi> spi;
typedef pair <pi, pi> dpi;
ll a, b, k;
int main()
{
	cin >> a >> b >> k;
	for(ll i = 0; i < k; i++)
	{
		if(i%2){if(b%2){b--; a+=b/2;b/=2;}else{a+=b/2; b/=2;}}
		else {if(a%2){a--; b+=a/2;a/=2;}else{b+=a/2; a/=2;}}
		if(db)cout << a << ' ' << b << "\n";
	}
	cout << a << ' ' << b << "\n";
}


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

int main(){

	ios::sync_with_stdio(0);
	cin.tie(0);

	#ifndef ONLINE_JUDGE
		freopen("input.txt","r",stdin);
		freopen("output.txt","w",stdout);
	#endif
	
	int n;
	cin>>n;

	if(n%10 == 3)
	cout<<"bon";
	
	else if( n%10 ==0 || n%10 ==1 || n%10 ==6 || n%10 ==8 )
	cout<<"pon";
	else
	cout<<"hon";
	
	return 0;
}

Measured memory_bytes: 3640
#include <algorithm>
#include <bitset>
#include <cctype>
#include <chrono>
#include <cmath>
#include <cstdio>
#include <ctime>
#include <deque>
#include <iostream>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <string>
#include <tuple>
#include <unordered_map>
#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;
/*----------------------------------------*/

int main() {
  cin.tie(0); ios::sync_with_stdio(false);
  // freopen("input.txt", "r", stdin);

  string n; cin >> n;
  string s = n;
  reverse(ALL(s));
  cout << (n == s? "Yes" : "No") << '\n';
  return 0;
}


Measured memory_bytes: 256
//
//  main.cpp
//  A - DDCC Finals
//
//  Created by Hashizo on 2019/11/23.
//  Copyright © 2019 Hashizo. All rights reserved.
//

#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <regex>
#include <cmath>

using namespace std;
 
#undef LONG_MAX
#undef LONG_MIN
 
#define LONG_MAX    9223372036854775807
#define LONG_MIN    (-LONG_MAX  -1)
 
#define ll long long
 
#define FOR(i, a, b) for (ll i = (a); i < (b); i++)
#define REP(i, n) FOR(i, 0, n)
 
#define SORT(c) sort((c).begin(), (c).end())
#define REVERSE(v) reverse((v).begin(), (v).end())

int main(int argc, const char * argv[]) {

	ll ans = 0;
	ll x,y;
	cin >> x >> y;

	if (x == 1 && y == 1) {
		cout << 1000000 << endl;
		return 0;
	}

	if (x == 1) {
		ans += 300000;
	}
	else if (x == 2) {
		ans += 200000;
	}
	else if (x == 3) {
		ans += 100000;
	}

	if (y == 1) {
		ans += 300000;
	}
	else if (y == 2) {
		ans += 200000;
	}
	else if (y == 3) {
		ans += 100000;
	}

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


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define __ ios_base::sync_with_stdio(0);cin.tie(0);
#define fi first
#define se second
#define pb push_back
#define all(x) x.begin(),x.end()
#define forn(i,a,n) for(int i=a; i < n; i++)
typedef long long int lli;
typedef long double Double;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
#define maxn 100005
int main(){__
	char c;
	cin >>c;
	if( c>= 'A' && c <= 'Z') cout << 'A';
	else cout << 'a';
	return 0;
}


Measured memory_bytes: 3636
//Pantyhose(black) + glasses = infinity

#include <bits/stdc++.h>
using namespace std;
 
#define debug(x) cerr << #x << " = " << x << '\n';
#define BP() cerr << "OK!\n";
#define PR(A, n) {cerr << #A << " = "; for (int _=1; _<=n; ++_) cerr << A[_] << ' '; cerr << '\n';}
#define PR0(A, n) {cerr << #A << " = "; for (int _=0; _<n; ++_) cerr << A[_] << ' '; cerr << '\n';}
#define FILE_NAME "data"

int main() {
	#ifdef GLASSES_GIRL
		freopen(FILE_NAME".inp", "r", stdin);
		freopen(FILE_NAME".out", "w", stdout);
	#endif
	ios::sync_with_stdio(0); cin.tie(0);
	string s;
	cin >> s;
	int64_t res = 0;
	int cnt = 0;
	for (int i=0; i<s.size(); ++i) {
		if (s[i]=='W')
			res += cnt;
		else
			++cnt;
	}
	cout << res;
}

Measured memory_bytes: 720
import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        String A = scan.next();
        String B = scan.next();
        String C = scan.next();
        if(A.charAt(A.length()-1) == B.charAt(0) && B.charAt(B.length()-1)==C.charAt(0)){
            System.out.println("YES");
        }else{
            System.out.println("NO");
        }
    }
}

Measured memory_bytes: 23764
//FIRST THINK THEN CODE.

#include <bits/stdc++.h>
 
 
using namespace std;
 
typedef long long ll;
 
//#define MOD 998244353
#define rep(i,a,b) for(ll i=a;i<b;++i)
#define rrep(i,a,b) for(ll i=a;i>b;--i)
#define FOR(i,n)  for(ll i=0;i<n;i++)
#define vi vector<int>
#define vl vector<ll>
#define ld long double
#define vvi vector<vector<int>>
#define vvl vector<vector<long long>>
#define pii pair<int,int>
#define pll pair<long,long>
#define vpii vector<pii>
#define vpll vector<pll>
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define lb lower_bound
#define ub upper_bound
#define bs binary_search
#define d1(x) cout<<(x)<<endl
#define d2(x,y) cout<<(x)<<" "<<(y)<<endl
#define d3(x,y,z) cout<<(x)<<" "<<(y)<<" "<<(z)<<endl
#define d4(a,b,c,d) cout<<(a)<<" "<<(b)<<" "<<(c)<<" "<<(d)<<endl
#define PI 3.1415926535897932384626433832795
#define fix(f,n) fixed<<setprecision(n)<<f
#define all(x) x.begin(),x.end()
#define rev(p) reverse(p.begin(),p.end());
#define endl "\n"
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define popcount(x) __builtin_popcountll(x)
#define sz(x) ((ll)x.size())
const int M=1000000007;
const int MM=998244353;
int begtime = clock();
#define end_routine() cout << "\n\nTime elapsed: " << (clock() - begtime)*1000/CLOCKS_PER_SEC << " ms\n\n";

 
ll newmod(ll a,ll b)
 {
  return ((a%b)+b)%b;
}
 
 
ll powM(ll a,ll b,ll m )
{ 
  if(m<=1)return 0;
  a%=m;
  ll ans=1LL;
  while(b)
  {
    if(b&1)ans=ans*a%m;
    a=a*a%m;
    b>>=1;
  }
 
return ans;
}


 
ll poww(ll a,ll b)
{ 
  
  ll ans=1;
  while(b)
  {
    if(b&1)ans=ans*a;
    a=a*a;
    b>>=1;
  }
 
return ans;

}

template<typename T,typename F>
void chmax( T &a,F b){
  if(b>a)a=b;
}

template<typename T,typename F>
void chmin( T &a,F b){
  if(b<a)a=b;
}

const ll N=5e5+5;

ll sp[N];

void fill(){
  for(int i=1;i<N;i++)sp[i]=i;

    for(int i=2;i<N;i++){
      for(int j=i;j<N;j+=i){
        if(sp[j]==j)sp[j]=i;
      }
    }
}

bool prime(ll x){
  if(x==2)return true;

for(ll i=2;i*i<=x;i++){
  if(x%i==0)return false;
}

  return true;
}

ll fac[N];

ll inv[N];

void gg(){
  fac[0]=inv[0]=1;

  for(int i=1;i<N;i++){
    fac[i]=fac[i-1]*i%M;
    inv[i]=powM(fac[i],M-2,M);
  }
}

ll c(ll a,ll b,ll M){
  if(b>a)return 0;

  return (fac[a]*inv[a-b]%M)*(inv[b])%M;
}

ll f[N];

int main()
{ 

IOS;

ll x,y,a,b,c;

cin>>x>>y>>a>>b>>c;

vpll pool;

for(int i=1;i<=a;i++){
  ll d;cin>>d;
pool.pb({d,1});
}


for(int i=1;i<=b;i++){
  ll d;cin>>d;
pool.pb({d,2});
}

for(int i=1;i<=c;i++){
  ll d;cin>>d;
pool.pb({d,0});
}

sort(all(pool));
reverse(all(pool));

ll tot=0;

ll c1=0;

for(int i=0;i<pool.size();i++){
  if(pool[i].ss==1){
    if(x){
      tot+=pool[i].ff;
      x--;
    }
  }
  else if(pool[i].ss==2){
if(y){
  tot+=pool[i].ff;
  y--;
}
  }
  else {
    c1++;
    tot+=pool[i].ff;
    //if(c1>=x+y)break;

  }
  if(!x&&!y)break;
  if(c1>=x+y)break;
}

cout<<tot<<endl;




//end_routine();

return 0;
 
}


Measured memory_bytes: 11692
import numpy as np
MOD = 10**9 + 7

def fft_convolve(f, g):
  Lf, Lg = f.shape[-1], g.shape[-1]
  L = Lf + Lg - 1
  fft_len = 1 << L.bit_length()
  fh, fl = f >> 15, f & (1 << 15) - 1
  gh, gl = g >> 15, g & (1 << 15) - 1
  def conv(f, g):
    Ff = np.fft.rfft(f, fft_len)
    Fg = np.fft.rfft(g, fft_len)
    h = np.fft.irfft(Ff * Fg)
    return np.rint(h)[..., :L].astype(np.int64) % MOD
  x = conv(fl, gl)
  z = conv(fh, gh)
  y = conv(fl + fh, gl + gh) - x - z
  return (x + (y << 15) + (z << 30)) % MOD

s = input()
x, y = map(int, input().split())

Rob = list(s.split("T"))

X = [len(r) for r in Rob[::2]]
Y = [len(r) for r in Rob[1::2]]

def solve():
  global X
  Xst = X[0]
  X = X[1:]
  if abs(x-Xst) <= sum(X) and abs(y) <= sum(Y):
    f = np.array([1], np.int64)
    for i in X:
      L = [0]*(2*i+1)
      L[0], L[-1] = 1, 1
      f = np.convolve(f, np.array(L, np.int64))
    FlagX = f[abs(x-Xst)+sum(X)]
    g = np.array([1], np.int64)
    for j in Y:
      L = [0]*(2*j+1)
      L[0], L[-1] = 1, 1
      g = np.convolve(g, np.array(L, np.int64))
    FlagY = g[abs(y)+sum(Y)]
    if FlagX and FlagY:
      print("Yes")
    else:
      print("No")
  else:
    print("No")

solve()

Measured memory_bytes: 27664