akhauriyash/Code-Regression huggingface dataset:
/*

साहिल पे पहुंचने से इनकार किसे है लेकिन,
तूफ़ानो से लड़ने का मज़ा ही कुछ और है,
कहते है, कि किस्मत खुदा लिखता है लेकिन,
उसे मिटा के खुद गढ़ने का मजा ही कुछ और है।

*/


#include<bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp> 
// #include <ext/pb_ds/tree_policy.hpp> 
// using namespace __gnu_pbds; 
using namespace std;
 
#define int                 long long int
#define ull					unsigned int
#define ld                  long double
#define pb                  push_back
#define ff                  first
#define ss                  second
#define S(arr)              sort(arr.begin(),arr.end());
#define RS(arr)              sort(arr.rbegin(),arr.rend());
#define R(arr)              reverse(arr.begin(),arr.end());
#define si                  set <int>
#define vi                  vector <int>
#define vvi                 vector <vector <int>>
#define vs                  vector <string>
#define pii                 pair <int, int>
#define vpi                 vector <pii>
#define vpp                 vector <pair<int, pii>>
#define mii                 map <int, int>
#define mci                 map<char, int>
#define mpi                 map <pii, int>
#define spi                 set <pii>
#define speed               ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl                "\n"
#define all(p)              p.begin(), p.end()
#define T                   int tcf;cin>>tcf;while(tcf--)
#define que_max(t)             priority_queue <t>
#define que_min(t)             priority_queue <t, vector<t>, greater<t>>
#define debuga(a, l, r)     for(auto x:a)cout<<x<<" ";cout<<endl;
#define debug1(x)           cout << #x " = " << x << endl;
#define debug2(x,y)         cout << #x " = " << x << " " << #y " = " << y << endl;
#define debug3(x,y,z)       cout << #x " = " << x << " " << #y " = " << y << " " << #z " = " << z << endl;
#define debug4(x,y,z,w)     cout << #x " = " << x << " " << #y " = " << y << " " << #z " = " << z << " " << #w " = " << w << endl;
#define debug5(x,y,z,w,v)   cout << #x " = " << x << " " << #y " = " << y << " " << #z " = " << z << " " << #w " = " << w << " " << #v " = " << v << endl;
#define debug6(x,y,z,w,v,a) debug3(a, y, x)debug3(w, v, a)
#define p2d(v)     	    for(auto a:v){for(auto b:a)cout<<b<<" ";cout<<endl;}
#define p1d(v)      	    for(auto a:v)cout<<a<<" ";cout<<endl;
#define ppi(v)	for(auto a:v)cout<<a.ff<<" "<<a.ss<<endl;

 
void read(int n=10){
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    cout<<setprecision(n)<<fixed;
    #ifndef ONLINE_JUDGE
         freopen("input.txt",  "r",  stdin);
         freopen("output.txt", "w", stdout);
    #endif
}

int M = 1e9 + 7;
int M1 = 998244353;
#define qqq 4000005



int32_t main(){
	//read();
	int n;
	cin>>n;
	string arr,brr;
	cin>>arr>>brr;
	for(int i=0;i<n;i++){
		cout<<arr[i]<<brr[i];
	}
} 

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define ld long double
#define db double
#define pint pair<int,int>
#define mk(x,y) make_pair(x,y)
#define fir first
#define sec second
#define Rep(x,y,z) for(int x=y;x<=z;++x)
#define Red(x,y,z) for(int x=y;x>=z;--x)
using namespace std;
const int MAXN=200;
char buf[1<<12],*p1=buf,*p2=buf,nc;int ny;
//inline char gc() {return p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<12,stdin),p1==p2)?EOF:*p1++;}
inline char gc(){return getchar();}
inline int read(){
	int x=0;ny=1;while(nc=gc(),(nc<48||nc>57)&&nc!=EOF)if(nc==45)ny=-1;if(nc<0)return nc;
	x=nc-48;while(nc=gc(),47<nc&&nc<58&&nc!=EOF)x=(x<<3)+(x<<1)+(nc^48);return x*ny;
}int n,m,row[MAXN][MAXN],col[MAXN][MAXN],F[MAXN][MAXN][MAXN],G[MAXN][MAXN][MAXN],ans,cur1[MAXN][MAXN][MAXN],cur2[MAXN][MAXN][MAXN];char s[MAXN][MAXN];
inline void pre(){
	Rep(i,1,n)Red(j,m,1)row[i][j]=(s[i][j]==s[i][j+1]?row[i][j+1]:0)+1;
	Red(i,n,1)Rep(j,1,m)col[i][j]=(s[i][j]==s[i+1][j]?col[i+1][j]:0)+1;
	Rep(i,1,n)Rep(j,1,m){F[i][j][j]=col[i][j];Rep(k,j+1,m)F[i][j][k]=min(F[i][j][k-1],s[i][j]==s[i][k]?col[i][k]:0);}
	Rep(i,1,m)Rep(j,1,n){G[i][j][j]=row[j][i];Rep(k,j+1,n)G[i][j][k]=min(G[i][j][k-1],s[j][i]==s[k][i]?row[k][i]:0);}
}inline void Dp(){
	Rep(i,1,n)Rep(j,1,m)Rep(k,j,m)F[i][j][k]+=F[i+F[i][j][k]][j][k],(F[i][j][k]?cur1[j][i][i+F[i][j][k]-1]=max(cur1[j][i][i+F[i][j][k]-1],k-j+1):0);
	Rep(i,1,m)Rep(j,1,n)Rep(k,j,n)G[i][j][k]+=G[i+G[i][j][k]][j][k],(G[i][j][k]?cur2[j][i][i+G[i][j][k]-1]=max(cur2[j][i][i+G[i][j][k]-1],k-j+1):0);
	Rep(i,1,n)Rep(j,1,m)Red(k,m,j)F[i][j][k]=max(F[i][j][k],max(F[i][j][k+1],cur2[i][j][k]));
	Rep(i,1,m)Rep(j,1,n)Red(k,n,j)G[i][j][k]=max(G[i][j][k],max(G[i][j][k+1],cur1[i][j][k]));
}
int main(){
//	freopen("std.in","r",stdin);
//	freopen("std.out","w",stdout);
	n=read(),m=read();
	Rep(i,1,n)scanf("%s",s[i]+1);
	for(pre(),ans=0;F[1][1][m]<n;ans++,Dp());cout<<ans<<'\n';
	return 0;
}




Measured memory_bytes: 123136
#include <stdio.h>
//#include <windows.h>

#define SIZE 10

void display(int data1[], int data2[], int size);

int main()
{
	int data[SIZE];
	int data1[SIZE], data2[SIZE];
	int st,nd;
	int i,k;
	int n;
	int ret;
	int s2=2000;
	scanf("%d", &n);
	for(i=0; i<n; i++){
		st=0;
		nd=0;
		ret = 999;										//retの初期化
		for(k=0; k<SIZE; k++){							//データの入力と初期化
			scanf("%d", &data[k]);
			data1[k]=0;
			data2[k]=0;
		}
		
		k=0;
		while(k<SIZE){
			if(ret==0){								//ターニングポイントが0まで戻ってきたら、k=0([失敗])
				k=0;
				break;
			}
			else if(k==ret){									//ターニングポイント
				if(nd==0){										//nd1個目
					ret = k-1;
					k--;
					//printf("38行目！\n");
					//data2[nd] = data[k];
					//nd++;
					continue;
				}
				else{											//nd2個目以降
					/*if(data2[nd-1] < data[k]){
						data2[nd] = data[k];
						nd++;
						printf("47行目！\n");
					}
					else{										//どちらにも入らない
						ret = k-1;
						k--;
						nd--;
						printf("53行目！\n");
						continue;
					}*/
					ret = k-1;
					k--;
					nd--;
					//printf("59行目！\n");
					continue;
				}
			}
			else if(k==0){								//1個目
				data1[st] = data[k];
				st++;
			}
			else{										//2個目以降
				if(data1[st-1] <= data[k]){						//st
					data1[st] = data[k];
					st++;
				}
				else{											//not st
					if(nd==0){											//nd1個目
						data2[nd] = data[k];
						nd++;
					}
					else{
						if(data2[nd-1] <= data[k]){						//nd2個目以降
							data2[nd] = data[k];
							nd++;
						}
						else{									//どちらにも入らない
							ret = k-1;									//直前に居た所をretに記憶
							k--;
							nd--;
							//printf("81行目！\n");
							//display(data1, data2, SIZE);
							//printf("k == %d, st == %d, nd == %d, ret == %d\n", k, st, nd, ret);
							//printf("data[%d] = %d, data1[%d] = %d, data2[%d] = %d\n", k, data[k], st, data1[st], nd, data2[nd]);
							//Sleep(s2);
							//printf("\n");
							continue;
						}
					}
				}
			}
			//display(data1, data2, SIZE);
			//printf("k == %d, st == %d, nd == %d, ret == %d\n", k, st, nd, ret);
			//printf("data[%d] = %d, data1[%d] = %d, data2[%d] = %d\n", k, data[k], st, data1[st], nd, data2[nd]);
			//Sleep(s2);
			//printf("\n");
			k++;
		}
		if(k){											//while文を正常に抜けていれば、kは真のはず。
			printf("YES\n");
		}
		else{											//ret==0によってbreakしてたらこっち。
			printf("NO\n");
		}
	}
	return 0;
}

void display(int data1[], int data2[], int size)
{
	int i;
	printf("data1 : ");
	for(i=0; i<size; i++){
		printf("%d ", data1[i]);
	}
	printf("\n");
	printf("data2 : ");
	for(i=0; i<size; i++){
		printf("%d ", data2[i]);
	}
	printf("\n");
	return;
}

Measured memory_bytes: 580
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,k;
    scanf("%d %d",&n,&k);
    if((n+1)/2>=k)
    {
        cout<<"YES"<<endl;
    }
    else
    {
        cout<<"NO"<<endl;
    }
    return 0;
}


Measured memory_bytes: 764
H,W,A,B = map(int,input().split())

C = [1]*(W-A) + [0]*A
D = [0]*(W-A) + [1]*A
c = ''
d = ''
for i in C:
    c += str(i)
c = int(c)
for i in D:
    d += str(i)
d = d.zfill(W)

for i in range(H):
    if i < H-B:
        print(c)
    else:
        print(d)

Measured memory_bytes: 3956
#include <bits/stdc++.h>
using namespace std;
//T+N
//#pragma GCC optimize ("O3")
//#pragma GCC target ("sse4")
#define endl "\n"
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
template<class T, class T2> inline bool chkmax(T &x, const T2 &y) { return x < y ? x = y, 1 : 0; }
template<class T, class T2> inline bool chkmin(T &x, const T2 &y) { return x > y ? x = y, 1 : 0; }
const ll mod = 998244353;
template<class T> inline void fix(T &x) {if(x >= mod || x <= -mod) {x %= mod;} if(x < 0) {x += mod;}}
#define out(x) cout << __LINE__ << ": " << (#x) << " = " << (x) << endl

const int MAX_N = 6500;
ll dp[MAX_N][MAX_N];

ll inv = (mod + 1ll) / 2ll;

signed main() {
    //ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
    int n, s;
    cin >> n >> s;
    dp[0][0] = 1;
    for(int i = 0; i < n; i ++) {
        dp[0][0] = (dp[0][0] * 2ll) % mod;
    }
    for(int i = 0; i < n; i ++) {
        int a;
        cin >> a;
        for(int j = 0; j <= s; j ++) {
            dp[i + 1][j + a] += (dp[i][j] * inv);
            fix(dp[i + 1][j + a]);
            dp[i + 1][j] += dp[i][j];
            fix(dp[i + 1][j]);
        }
    }
    cout << dp[n][s] << endl;
    return 0;
}




Measured memory_bytes: 97656
#include <iostream>
using namespace std;
int main()
{
    long long a,b;
    cin>>a>>b;
    if(a>0){cout<<"Positive";return 0;}
    if((a<0&&b>0)||a==0||b==0){cout<<"Zero";return 0;}
    if((b-a+1)%2==0){cout<<"Positive";return 0;}
    cout<<"Negative";return 0;
}

Measured memory_bytes: 256
N = int(input())
L = set([])
for i in range(N):
  temp = str(input())
  if i == 0:
    last = temp[-1]
    L.add(temp)
    continue
  if temp[0] != last or temp in L:
    print("No")
    exit()
  else:
    last = temp[-1]
    L.add(temp)
print("Yes")

Measured memory_bytes: 9180
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <vector>
#include <iostream>
using namespace std;

int main() {
	const int MAX = 24 * 60 * 60;

	for(int n; scanf("%d", &n), n;) {
		vector<int> cnt(MAX, 0);
		for(int i = 0; i < n; ++i) {
			int h, m, s;
			scanf("%d:%d:%d", &h, &m, &s);
			++cnt[h * 60 * 60 + m * 60 + s];
			scanf("%d:%d:%d", &h, &m, &s);
			--cnt[h * 60 * 60 + m * 60 + s];
		}

		for(int i = 1; i < MAX; ++i)
			cnt[i] += cnt[i - 1];

		printf("%d\n", *max_element(cnt.begin(), cnt.end()));
	}

	return EXIT_SUCCESS;
}

Measured memory_bytes: 1524
import java.util.Scanner;

class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int size = scanner.nextInt();
        int arr[] = new int[size];
        for (int i = 0; i < size; i++) {
            arr[i] = scanner.nextInt();
        }
        System.out.println(frog1(arr));

        scanner.close();

    }

  

    public static int frog1(int arr[]) {
        int sol[] = new int[arr.length];
        sol[arr.length - 1] = 0;
        for (int j = arr.length - 2; j >= 0; j--) {
            int cost1 = Integer.MAX_VALUE, cost2 = Integer.MAX_VALUE;
            if (j + 1 < arr.length) {
                cost1 = Math.abs(arr[j + 1] - arr[j]) + sol[j + 1];
            }
            if (j + 2 < arr.length) {
                cost2 = Math.abs(arr[j + 2] - arr[j]) + sol[j + 2];
            }
            sol[j] = Math.min(cost1, cost2);

        }
        return sol[0];
    }

   

}

Measured memory_bytes: 59920
n,m=map(int,input().split())

edges=[[] for i in range(n)]

for i in range(m):
  s,t = map(int,input().split())
  edges[s-1].append(t-1)
  edges[t-1].append(s-1)

cnt =0

V=[0]*n

def dfs(V,s):
  global cnt
  V=V[:]
  V[s]=1
  if sum(V)==n:
    cnt+=1
  else:
    for v in edges[s]:
      if V[v]==0:
        dfs(V,v)
  # print(V)
dfs(V,0)
print(cnt)

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

struct CWW{
    CWW(){
        cin.tie(0);
        ios_base::sync_with_stdio(0);
        cout<<fixed<<setprecision(15);
    }
}STAR;

using D=double;

const D EPS=1e-8;
const D INF=1e9;

using Point=complex<D>;

struct Segment{
    Point p1,p2;
    Segment(const Point &p1=Point(),const Point &p2=Point()):p1(p1),p2(p2){}
};

struct Line{
    Point p1,p2;
    Line(const Point &p1=Point(),const Point &p2=Point()):p1(p1),p2(p2){}
};

struct Circle{
    Point c;
    D r;
    Circle(const Point &c=Point(),const D &r=0.0):c(c),r(r){}
};

using Polygon=vector<Point>;

istream& operator>>(istream &is,Point &a){
    D x,y;
    is>>x>>y;
    a=Point(x,y);
    return is;
}

ostream& operator<<(ostream& os,const Point &a){
    os<<real(a)<<" "<<imag(a);
    return os;
}

istream& operator>>(istream &is,Line &l){
    Point p1,p2;
    is>>p1>>p2;
    l=Line(p1,p2);
    return is;
}



D dot(const Point &a,const Point &b){
    return real(a)*real(b)+imag(a)*imag(b);
}

D cross(const Point &a,const Point &b){
    return real(a)*imag(b)-imag(a)*real(b);
}

Point projection(const Point &a,const Point &b){
    return a*real(b/a);
}

Point projection(const Line &l,const Point &a){
    return l.p1+projection(l.p2-l.p1,a-l.p1);
}


int main(){
    Line L;
    cin>>L;
    int Q;cin>>Q;
    while(Q--){
        Point p;
        cin>>p;
        cout<<projection(L,p)<<endl;
    }

    return 0;
}

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

void solve() 
{
    string s;cin>>s;
    if(s[0]==s[1]&&s[1]==s[2])cout<<"No"<<endl;
    else cout<<"Yes"<<endl;
}

int main()
{
    cin.tie(0);
	ios::sync_with_stdio(false);
    solve();
    return 0;
}

Measured memory_bytes: 256
/*#include<stdio.h>
#include<stdlib.h>
#include<iostream>
#include<string>
#include<vector>
#include<math.h>
#include<queue>
#include <algorithm>
#include<functional>
#include<cstdlib>
#include<cmath>

#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 CI cin >>
#define CO cout <<
#define E << endl;

using namespace std;

typedef pair<int, int> P;
typedef pair<long, long> LP;
typedef pair<int, P> PP;
typedef pair<long, LP> LPP;



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

int A = 0, B = 0, K = 0, T = 0, W = 0, N = 0, H = 0;
int n = 0;
double L = 0;
double S = 0;
double ar = 0, br = 0, cr = 0;
int answer = 0;

string C;
string sA, strB;
vector<vector<char>> map;
vector<double> num;
vector<string> str;

int sum = 0;

vector<int> value;
vector<int> weight;

int dp[110][10010];

void input() {
	CI N >> W;

	int temp;

	for (int i = 0; i < N;i++) {
		CI temp;
		value.push_back(temp);
		CI temp;
		weight.push_back(temp);
	}


	return;
}


int main(void) {
	input();

	for (int i = 0; i < N;i++) {
		for (int j = 0; j <= W;j++) {
			dp[i + 1][j] = max(dp[i + 1][j], value[i] + dp[i][j - weight[i]]);
		}
	}

	CO dp[N][W] E


	return 0;
}
*/

#include<stdio.h>
#include<stdlib.h>
#include<iostream>
#include<string>
#include<vector>
#include<math.h>
#include<queue>
#include <algorithm>
#include<functional>
#include<cstdlib>
#include<cmath>

#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 CI cin >>
#define CO cout <<
#define E << endl;

using namespace std;

typedef pair<int, int> P;
typedef pair<long, long> LP;
typedef pair<int, P> PP;
typedef pair<long, LP> LPP;



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

int A = 0, B = 0, K = 0, T = 0, W = 0, N = 0, H = 0;
int n = 0;
double L = 0;
double S = 0;
double ar = 0, br = 0, cr = 0;
int answer = 0;

string C;
string sA, strB;
vector<vector<char>> map;
vector<double> num;
vector<string> str;

int sum = 0;


double tempd = 0.0;

int first;
int second;
int third;

int mountain;

void input() {
	

	return;
}

int main(void) {
	for (int i = 0; i < 10; i++) {
		CI mountain;
		if (mountain >= first) {
			third = second;
			second = first;
			first = mountain;
		}
		else {
			if (mountain >= second) {
				third = second;
				second = mountain;
			}
			else {
				if (mountain > third) {
					third = mountain;
				}
			}
		}
	}

	CO first E
	CO second E
	CO third E

	return 0;
}

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

int main(){
    int N;
    std::cin >> N;
    
    N = N % 10;
    if(N == 2 || N == 4 || N == 5 || N == 7 || N == 9){
        std::cout << "hon" << std::endl;
    }else if(N == 0 || N == 1 || N == 6 || N == 8){
        std::cout << "pon" << std::endl;
    }else{
        std::cout << "bon" << std::endl;
    }
    
    return 0;
}



Measured memory_bytes: 3624
#include <iostream>

using namespace std;

int main(){
  string S, T;
  cin >> S >> T;
  int s=S.size(), t=T.size(),count=0,largest=0;
  for(int x=0;x<s-t+1;x++){
    count=0;
    for(int y=0;y<t;y++){
      if(T.at(y)==S.at(x+y)){
        count++;
      }
    }
    largest=max(count,largest);
  }
  cout << t-largest << endl;
}

Measured memory_bytes: 3600
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <iomanip>
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <math.h>
#include <stdlib.h>
#include <stdio.h>
using namespace std;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
const int INF = 1001001000;
const int MOD = 1000000007;

typedef pair<int, int> P;
int myAbs(int num) {
    if (num > 0)
        return num;
    else
        return -num;
}

long long gcd(long long a, long long b) {
    if (b == 0) return a;
    else return gcd(b, a % b);
}
long long lcm(long long a, long long b) {
    return a * b / gcd(a, b);
}

using Graph = vector<vector<int>>;
//再帰とかグラフを使うときは予めNの最大値のグローバル配列を取っておく
int N;
bool E[101][101];
vector<bool> seen;
typedef pair<int, int> P;
int D[101];
//頂点状態を表すcolor[]において、0は未訪問、1は訪問中、2は完了を表す。
int color[101];
int find_time = 0;

int main() {
    string S;
    cin >> S;
    int N = S.size();
    string P, Q;
    P = S.substr(0, (S.size()-1) / 2);
    Q = S.substr((N + 3) / 2-1, N - (N + 3) / 2+1);
    //cout << P <<" " << Q << endl;

    for (int i = 0; i < S.size()/2; i++) {
        if (S.at(i) != S.at(S.size() - i - 1)) {
            cout << "No" << endl;
            return 0;
        }
    }
    for (int i = 0; i < P.size() / 2; i++) {
        if (P.at(i) != P.at(P.size() - i - 1)) {
            cout << "No" << endl;
            return 0;
        }
    }
    for (int i = 0; i < Q.size() / 2; i++) {
        if (Q.at(i) != Q.at(Q.size() - i - 1)) {
            cout << "No" << endl;
            return 0;
        }
    }

    cout << "Yes" << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define all(x) x.begin(), x.end()

int main() {
  string s;
  cin >> s;
  string a = "Yes";
  for (ll i = 0; i < s.size(); i++) {
    if (i % 2 == 0 && !(s.at(i) == 'R' || s.at(i) == 'U' || s.at(i) == 'D'))
      a = "No";
    if (i % 2 == 1 && !(s.at(i) == 'L' || s.at(i) == 'U' || s.at(i) == 'D'))
      a = "No";
  }
  cout << a << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,l,r) for(long long i=(l);i<(r);++i)
#define REP(i,n) FOR(i,0,n)
#define REPS(i,n) FOR(i,1,n+1)
#define RFOR(i,l,r) for(long long i=(l);i>=(r);--i)
#define RREP(i,n) RFOR(i,N-1,0)
#define RREPS(i,n) RFOR(i,N,1)
#define int long long
#define mp make_pair
#define pb push_back
#define eb emplace_back
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
const int INF=1e18;
const int MOD=1e9+7;
const int N_MAX=1e5;
struct Edge{
    int to,cost;
    Edge(int to,int cost):to(to),cost(cost){}
};
int N,M;
vector<Edge>Graph[N_MAX];
bool isvisit[N_MAX];
int d[N_MAX];

bool bad(int k,int dist){
    if(isvisit[k]){
        if(d[k]!=dist)return true;
        return false;
    }
    isvisit[k]=true;
    d[k]=dist;
    for(auto v:Graph[k]){
        if(bad(v.to,d[k]+v.cost))return true;
    }
    return false;
}

void solve(){
    cin>>N>>M;
    REP(i,M){
        int L,R,D;cin>>L>>R>>D;L--;R--;
        Graph[L].eb(R,D);
        Graph[R].eb(L,-D);
    }
    REP(i,N){
        if(isvisit[i])continue;
        if(bad(i,0)){
            cout<<"No"<<endl;
            return;
        }
    }
    cout<<"Yes"<<endl;
}

signed main(){
    solve();
}

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

int main() {
  double n;
  cin >> n;
  vector<double> v(n); 
  for(int i=0; i<n; i++){
      cin >> v.at(i);
  }
  sort(v.begin(),v.end());
  double value;
  
    value=v.at(0);
  	for(int i=1; i<=n-1; i++){
    	value = (value+v.at(i))/2;  
  	}
  
  cout << value << setprecision(10);
	return 0;
}


Measured memory_bytes: 256
import java.io.InputStream;
import java.io.PrintStream;
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	InputStream in = System.in;
	PrintStream out = System.out;

	public void _main(String[] args) {
		Scanner sc = new Scanner(in);

		int N = sc.nextInt();
		String S = sc.next();

		sc.close();

		char prev = 'X';

		int ans = 0;
		for (int i = 0; i < N; i++) {
			if (prev != S.charAt(i)) {
				ans++;
				prev = S.charAt(i);
			}
		}

		out.println(ans);

	}

	public static void main(String[] args) {
		new Main()._main(args);
	}
}


Measured memory_bytes: 24632
#include <bits/stdc++.h>
#define X first
#define Y second
#define sz(x) (int)x.size()
#define all(x) x.begin(), x.end()
#define ini(x, y) memset(x, y, sizeof(x))
#define endl '\n'
#define fastio cin.sync_with_stdio(false); cin.tie(nullptr)
using namespace std;

using ll = long long;
using pii = pair<int, int>;
const int dx[] = { -1, 0, 1, 0, -1, 1, 1, -1 };
const int dy[] = { 0, 1, 0, -1, 1, 1, -1, -1 };

int N;
vector<int> adj[200];

int go(int s) {
	int bfsn[200]{};
	queue<int> Q;

	bfsn[s] = 1;
	Q.push(s);

	int ret = 1;
	while (!Q.empty()) {
		int szQ = sz(Q);
		while (szQ--) {
			int now = Q.front(); Q.pop();

			for (int nxt : adj[now]) {
				if (!bfsn[nxt]) {
					bfsn[nxt] = bfsn[now] + 1;
					ret = max(ret, bfsn[nxt]);
					Q.push(nxt);
				}
				else if (bfsn[nxt] == bfsn[now]) return 0x3f3f3f3f;
			}
		}
	}

	return ret;
}
int main() {
	fastio;
	cin >> N;

	char bo[201];
	for (int i = 0; i < N; ++i) {
		cin >> bo;
		for (int j = 0; j < N; ++j)
			if (bo[j] == '1') adj[i].push_back(j);
	}

	int ans = 0;
	for (int i = 0; i < N; ++i)
		ans = max(ans, go(i));

	cout << (ans == 0x3f3f3f3f ? -1 : ans);

	return 0;
}

Measured memory_bytes: 512
#include <iostream>
#include <vector>
using namespace std;
int main()
{
    int n, answer = 0, count2 = 0;
    cin >> n;
    int a;
    vector<int> count(100001, 0);
    for (int i = 0; i < n; i++)
    {
        cin >> a;
        count[a]++;
    }
    for (int i = 1; i <= 100000; i++)
    {
        if (count[i] > 2)
        {
            if (count[i] % 2 == 1)
                answer += count[i] / 2;
            else
            {
                answer += (count[i] - 2) / 2;
                count2++;
            }
        }
        else if (count[i] == 2)
        {
            count2++;
        }
    }
    answer += count2 / 2 + count2 % 2;
    cout << n-answer*2;
}

Measured memory_bytes: 640
#include "bits/stdc++.h"
using namespace std;
#define int long long
int mod=1e9+7;

signed main(){
  int n;
  cin>>n;
  vector<int> a(n);
  for(int i=0;i<n;i++)cin>>a[i];
  sort(a.begin(),a.end());
  if(a[n-1]-a[0]>1){
    cout<<"No"<<endl;
    return 0;
  }
  if(a[0]==a[n-1]){
    if(a[0]==n-1||2*a[0]<=n){
      cout<<"Yes"<<endl;
    }else{
      cout<<"No"<<endl;
    }
    return 0;
  }

  int x=a[0];
  int y=a[n-1];
  int xc=0;
  int yc=0;
  for(int i=0;i<n;i++){
    if(a[i]==x)xc++;
    else yc++;
  }
  if(xc<y&&(y-xc)*2<=yc){
    cout<<"Yes"<<endl;
  }else{
    cout<<"No"<<endl;
  }
}


Measured memory_bytes: 1024
#include <cstdio>
#include <cstring>
#include <vector>
#include <tuple>

using namespace std;
int p = 998244353;
int M = 0x7777777777777777777777777;
int N;
int rok[4096];
int bok[4096];
int dp[4096][4096];

int solve(int r, int b) {
	if(r+b==0) {
		return 1;
	}
	if(!dp[r][b]) {
		int ret = 0;
		if(r<=rok[r+b] && b<=bok[r+b]) {
			if(r) {
				ret += solve(r-1, b);
			}
			if(b) {
				ret += solve(r, b-1);
			}
			if(p<=ret) {
				ret -= p;
			}
		}
		dp[r][b] = ret ^ M;
	}
	return dp[r][b] ^ M;
}

int main() {
	char S[2048];
	scanf("%s", S);
	int halfN = strlen(S);
	N = halfN+halfN;
	int rsum = 0;
	int bsum = 0;
	{
		int lateR = 0;
		int lateB = 0;
		for(int n=0; n<halfN; ++n) {
			rok[n] = rsum;
			bok[n] = bsum;
			rsum += lateR;
			bsum += lateB;
			if(S[n]=='0') {
				++rsum;
				lateR = 1;
				lateB = 0;
			}
			else if(S[n]=='1') {
				++rsum;
				++bsum;
				lateR = 0;
				lateB = 0;
			}
			else {
				++bsum;
				lateR = 0;
				lateB = 1;
			}
		}
		rsum += lateR;
		bsum += lateB;
		for(int n=halfN; n<N+2; ++n) {
			rok[n] = rsum;
			bok[n] = bsum;
		}
	}
	printf("%d\n", solve(rsum, bsum));

	return 0;
}


Measured memory_bytes: 64384
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <queue>
#include <set>
#include <map>
#define N_MAX 200002

using namespace std;
typedef long long ll;

const ll MOD = 1000000007;

class ModInt{
    public:
    ll v;
    ModInt(ll _v = 0){
        v = _v;
    }
    ModInt operator+(ll n){
        return ModInt((v+n)%MOD);
    }
    ModInt operator-(ll n){
        return ModInt((v-n+MOD)%MOD);
    }
    ModInt operator*(ll n){
        return ModInt((v*n)%MOD);
    }
    ModInt operator/(ll n){
        return ModInt((ModInt(n).inv()*v).v%MOD);
    }

    void operator+=(ll n){
        v = (v+n)%MOD;
    }
    void operator-=(ll n){
        v = (v-n+MOD)%MOD;
    }
    void operator*=(ll n){
        v = (v*n)%MOD;
    }
    
    
    ModInt operator+(ModInt n){
        return ModInt((v+n.v)%MOD);
    }
    ModInt operator-(ModInt n){
        return ModInt((v-n.v+MOD)%MOD);
    }
    ModInt operator*(ModInt n){
        return ModInt((v*n.v)%MOD);
    }
    ModInt operator/(ModInt n){
        return ModInt((n.inv()*v).v%MOD);
    }

    void operator+=(ModInt n){
        v = (v+n.v)%MOD;
    }
    void operator-=(ModInt n){
        v = (v-n.v+MOD)%MOD;
    }
    void operator*=(ModInt n){
        v = (v*n.v)%MOD;
    }

    void operator=(ModInt n){
        v = n.v;
    }
    void operator=(ll n){
        v = n;
    }

    ModInt inv(){
        if(v == 1) return ModInt(1);
        else return ModInt(MOD-ModInt(MOD%v).inv().v*(MOD/v)%MOD);
    }
};

ostream& operator<<(ostream& os, const ModInt& m){
    os << m.v;
    return os;
}

istream & operator >> (istream &in,  ModInt &m){
    in >> m.v;
    return in;
}

ModInt inv[N_MAX],fac[N_MAX],finv[N_MAX];

void init(){
    fac[0]=1;fac[1]=1;
    finv[0]=1;finv[1]=1;
    inv[1]=1;
    for(int i=2;i<N_MAX;i++){
        inv[i]=(ModInt)MOD-inv[MOD%i]*(MOD/i);
        fac[i]=fac[i-1]*(ll) i;
        finv[i]=finv[i-1]*inv[i];
    }
}

ModInt comb(ll n, ll r){
  ModInt ans;
  if(n < r){
      ans = 0;
  }else{
      ans = fac[n]*finv[r];
      ans = ans*finv[n-r];
      ans = ans+MOD;
  }
  return ans;
}

ll N, A, B, C;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << setprecision(10) << fixed;
    init();
    ModInt ans = 0;
    cin >> N >> A >> B >> C;
    if(B%2 != 0){
        cout << 0 << endl;
        return 0;
    }
    ll b = B/2;
    
    for(ll x = 0; x <= C; x++){
        if(b == 0 && x > 0){
            break;
        }
        for(ll y = 0; y+x <= C && y <= A; y++){
            if((C-(x+y))%3 != 0) continue;
            ll z = A-y;
            ll w = (C-(x+y))/3;
            ModInt tmp = (b == 0 ? 1 : comb(x+b-1, b-1));
            tmp *= comb(b+y+z+w, b)*comb(y+z+w, y)*comb(z+w, z);
            ans += tmp;
            // cout << b << ' ' << x << ' ' << y << ' ' << z << ' ' << w << endl;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 8380
#include <bits/stdc++.h>
typedef long long int ll;
typedef long double ld;
using namespace std;
const long long int INF = 1e18;
const long long int mod = 1e9+7;

typedef pair<ll, ll> pairs;
typedef vector<pairs> p;

struct Edge{
    ll to, weight;
    Edge(ll t, ll w) : to(t), weight(w){}
};
using graph = vector<vector<ll>>;
using Graph = vector<vector<Edge>>;


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

ll lcm(ll a, ll b){
    return a / gcd(a, b) * b;
}

ll keta(ll N){
    int tmp{};
    while( N > 0 ){
        tmp += ( N % 10 );
        N /= 10;
    }
    N = tmp;
    return N;
}

// 回文
bool kai(string S){
    bool flag = true;
    for(ll i=0;i<S.size()/2;++i){
        if(S[i] != S[S.size()-i-1]){
            flag = false;
            break;
        }
    }
    return flag;
}
// ---------------------------------------------

int main(){
    ll n;
    cin>>n;
    vector<ll> x(n), y(n), h(n);
    ll u;
    for(ll i=0;i<n;++i){
        cin>>x[i]>>y[i]>>h[i];
        if(h[i] != 0){
            u = i;
        }
    }

    for(ll i=0;i<=100;++i){
        for(ll j=0;j<=100;++j){
            bool flag = true;
            ll H = abs(x[u] - i) + abs(y[u] - j) + h[u];
            for(ll k=0;k<n;++k){
                if(h[k] == 0){
                    if(H > abs(x[k] - i) + abs(y[k] - j)){
                        flag = false;
                        break;
                    }
                }else if(H != abs(x[k] - i) + abs(y[k] - j) + h[k]){
                    flag = false;
                    break;
                }
            }

            if(flag){
                cout<<i<<' '<<j<<' '<<H<<endl;
                return 0;
            }
        }
    }

    return 0;
}

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

using namespace std;

#define INF 1e9

int t,ans,size,diff;
vector<int> a,path;
map<int,int> mp;

int calc(int idx,int N){
  int res = 0, p = 1;
  for(int i = N-1 ; i >= idx ; i--){
    res += a[i]*p;
    p *= 10;
  }
  return res;
}

void solve(int idx,int val,vector<int> &v){
  if(idx == size){
    if(val > t) return;
    if(t-val <= diff){
      diff = t-val;
      ans = val; mp[ans]++;
      path = v;
    }
    return;
  }

  for(int i = 1 ; i <= size ; i++){
    if(idx + i > size) continue;
    int c = calc(idx,idx+i);
    v.push_back(c);
    solve(idx+i,val+c,v);
    v.pop_back();
  }
}

int main(){
  int num;
  while(cin >> t >> num, (t | num)){
    mp.clear(); a.clear(); 
    diff = ans = INF;
    for(int i = 0 ; ; i++){
      if(num == 0) break;
      a.push_back(num%10);
      num /= 10;
    }
    reverse(a.begin(),a.end());
    size = a.size();
    vector<int> v;
    solve(0,0,v);
    if(diff == INF){
      cout << "error" << endl;
    }else{
      if(mp[ans] != 1){
        cout << "rejected" << endl;
      }else{
        cout << ans;
        for(int i = 0 ; i < (int)path.size() ; i++){
          cout << " " << path[i];
        }
        cout << endl;
      }
    }
  }
  return 0;
}

Measured memory_bytes: 1216
# -*- coding: utf-8 -*-
"""
Created on Mon Aug  3 13:34:09 2020

@author: ito
"""


# -*- coding: utf-8 -*-

k, s = map(int, input().split())

ans = 0

for x in range(k+1):
    for y in range(k+1):
        
        sat_z = s - x - y
        
        if sat_z >= 0 and sat_z <= k:
            ans += 1
            
print(ans)

Measured memory_bytes: 9080
#include <bits/stdc++.h> 
using namespace std; 
int main() 
{
    long long n;
    cin>>n;
    long long sum=0LL;
    for(long long i=1;i<=n;i++){
        if(i%3==0LL or i%5==0LL) continue;
          sum+=i;
    }
    cout<<sum<<"\n";
	return 0; 
} 


Measured memory_bytes: 3672
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 66;
int L;
int sum[N];
int n, m;
vector <pair<int, int> > g[N];
void add(int u, int v, int w, int op) {
    ++m;
    g[u].push_back(make_pair(v, w));
    if(op) sum[v] = sum[u] + w;
}
int main() {
    ios::sync_with_stdio(false); cin.tie(0);
    cin >> L;
    int r;
    for(int i = 30; i >= 0; i--) if(L >> i & 1) {
        r = i; break;
    }
    for(int i = 2; i <= r + 1; i++) {
        add(i - 1, i, 1 << (i - 2), 1);
        add(i - 1, i, 0, 0);
    }
    int X = (1 << r); --L;
    while(X <= L) {
        int p = upper_bound(sum + 1, sum + r + 1, L - X) - sum - 1;
        add(p, r + 1, X, 0);
        X += sum[p] + 1;
    }
    n = r + 1;
    cout << n << ' ' << m << '\n';
    for(int u = 1; u <= n; u++) {
        for(auto it : g[u]) {
            int v = it.first, w = it.second;
            cout << u << ' ' << v << ' ' << w << '\n';
        }
    }
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<climits>
#include<vector>
#include<list>
#include<functional>
#include<algorithm>
#include<string>
#include<cmath>
#include<complex>
#include<set>
#include<map>
#include<unordered_map>
#include<stack>
#include<queue>
#include<deque>
#include<tuple>
#define FOR(i, a, b) for(int i = (a);i < (b);++i)
#define FORR(i, b, a) for (int i = (b) - 1;i >= 0;--i)
#define REP(i, n) for(int i = 0;i < (n);++i)
#define REPR(i, n) for(int i = (n) - 1;i >= 0;--i)
#define ITER(itr, v) for(auto itr = v.begin();itr != v.end();++itr)
#define SORT(v) sort(v.begin(), v.end())
using namespace std;
typedef long long ll;
typedef pair<int, int> P;




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

	int N;
	cin >> N;
	vector<int> a(N);
	REP(i, N) cin >> a[i];
	int target = 1;
	REP(i, N) {
		if (a[i] == target) ++target;
	}
	int res;
	if (target == 1) res = -1;
	else res = N - target + 1;
	cout << res << endl;

	return 0;
}


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

public class Main {
	double[] grade_500 = {35.5, 37.5, 40.0, 43.0, 50.0, 55.0, 70.0};
	double[] grade_1000 = {71.0, 77.0, 83.0, 89.0, 105.0, 116.0, 148.0};
	String[] grade = {"AAA", "AA", "A", "B", "C", "D", "E"};
	public void solve() throws IOException{
		while( stdIn.hasNext() ){
			double x = stdIn.nextDouble();
			double y = stdIn.nextDouble();
			int g1 = 7; int g2 = 7;
			for(int i = 0; i < 7; i++){
				if( x < grade_500[i] ){
					g1 = i;
					break;
				}
			}
			for(int i = 0; i < 7; i++){
				if( y < grade_1000[i] ){
					g2 = i;
					break;
				}
			}
			int index = Math.max(g1, g2);
			if( index == 7 ){
				writer.println("NA");
			} else {
				writer.println(grade[index]);
			}
			writer.flush();			
		}
	//	writer.flush();
	} 
			
	public static void main (String args[]) throws IOException {
		new Main().run();
	}
	Scanner stdIn;
	PrintWriter writer;
	
	public void run() throws IOException{
		stdIn = null;
		try{
			stdIn = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
			writer = new PrintWriter(System.out);
			solve();
			stdIn.close();
			writer.close();
		} catch (Exception e){
			e.printStackTrace();
			System.exit(1);
		}
	}
}

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

int main(void){
    int N, n1, n2, n3, max = 0;
    cin >> N;
    if(N == 2){
        cin >> n1 >> n2;
        max = n1;
        if(n2 > max) max = n2;

        for(int i = 1; i <= max; i++){
            if(n1 % i == 0 && n2 % i == 0){
                cout << i << endl;
            }
        }
    }

    else{
        cin >> n1 >> n2 >> n3;
        max = n1;
        if(n2 > max) max = n2;
        if(n3 > max) max = n3;

        for(int i = 1; i <= max; i++){
            if(n1 % i == 0 && n2 % i == 0 && n3 % i == 0){
                cout << i << endl;
            }
        }
    }
}



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

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

    int n;
    cin >> n;

    vector<int> a(n), b(n);
    REP(i, n) cin >> a[i] >> b[i];
    sort(a.begin(), a.end());
    sort(b.begin(), b.end());

    int ans = 0;
    if (n % 2) {
        int l = a[n / 2];
        int r = b[n / 2];
        ans = r - l + 1;
    } else {
        int l = a[n / 2 - 1] + a[n / 2];
        int r = b[n / 2 - 1] + b[n / 2];
        ans = r - l + 1;
    }

    cout << ans << '\n';
    return 0;
}


Measured memory_bytes: 4752
#include<stdio.h>
#include<stdlib.h>

int main(void){
	
	int a,b;
	double c;
	scanf("%d",&a);
	scanf("%d",&b);
	
	c = (double)a/b;
	
	printf("%d %d %f",a/b,a%b,c);
	
return 0;}

Measured memory_bytes: 1064
using System;
using System.Linq;//リストの使用
using System.Collections.Generic;
class Program
{
	static void Main()
	{
		string[] input = Console.ReadLine().Split(' ');
		long n = long.Parse(input[0]);
		long x = long.Parse(input[1]);
		long[] nums = Array.ConvertAll(Console.ReadLine().Split(' '),long.Parse);
    long answer = 0;

    if(nums[0] + nums[1] > x)
    {
      if(nums[0] <= x)//nums[1]だけ除けば良いとき
      {
        answer += nums[1] - (x - nums[0]);
        nums[1] = x - nums[0];
      }else
      {
        answer += nums[1];
        answer += nums[0] - x;
        nums[1] = 0;
      }
    }

    for(long i = 1; i < n-1; i++)
    {
      if(nums[i] + nums[i+1] > x)
      {
        answer += nums[i+1] - (x - nums[i]);
        nums[i+1] = x - nums[i];
      }
    }
    
		Console.WriteLine(answer);
	}
}

Measured memory_bytes: 27484
n,d  =map(int,input().split())
lm = []
for _ in range(n):
    lm.append(list(map(int,input().split())))
s = 0
for i in range(n):
    for j in range(n):
        t = 0
        if i == j:
            continue
        else:
            for x in range(d):
                t += (lm[i][x] - lm[j][x])**2
            t = pow(t,0.5)
            if t.is_integer() == True:
                s += 1
print(s//2)

Measured memory_bytes: 3064
const lines: string[] = [];
const reader = require("readline").createInterface({
  input: process.stdin,
  output: process.stdout,
});
reader.on("line", function (line: string) {
  lines.push(line);
});

reader.on("close", function () {
  const input = lines[0];
  let res = 1;

  for (let i = Number(input); i > 1; i--) {
    res = (res * i) % 1000000007;
  }

  console.log(res);
});


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

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

  int n, l, m=101;
  cin >> n >> l;

  for(int i=l; i<l+n; i++)m=min(abs(i), m);
  int ans=0;
  for(int i=l; i<l+n; i++){
    if(abs(i)==m)continue;
    ans+=i;
  }

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 3572
#include<bits/stdc++.h>
constexpr long long INFL = 1LL << 60;
constexpr int INF = 1e9;

using namespace std;

int main()
{
    int a,b;
    cin >> a >> b;
    if((a*b)%2 == 0) cout << "Even" << endl;
    else cout << "Odd" << endl;
    return 0;
}


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

#define fi first
#define se second
#define m_p make_pair
#define p_b push_back
#define e_b emplace_back
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())

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

#ifdef LOCAL//compile with -DLOCAL
#define debug(x) cerr<<"LINE"<<__LINE__<<" : "<<#x<<" = "<<(x)<<endl
#define debug_vec(x) cerr<<"LINE"<<__LINE__<<" : "<<#x<<" = ";\
  rep(i,sz(x)){cerr<<x[i]<<" ";}cerr<<endl
#define debug_mat(x) cerr<<"LINE"<<__LINE__<<" : "<<#x<<" = "<<endl;\
  rep(i,sz(x)){rep(j,sz(x[i])){cerr<<x[i][j]<<" ";}cerr<<endl;}cerr<<endl
#else
#define debug(x) void(0)
#define debug_vec(x) void(0)
#define debug_mat(x) void(0)
#endif

template<class T> bool chmax(T &a,T b){if(a<b){a=b;return true;}return false;}
template<class T> bool chmin(T &a,T b){if(a>b){a=b;return true;}return false;}


int main(){
  ios_base::sync_with_stdio(false);cin.tie(0);
  int x,y;
  cin >> x >> y;

  int ans=0;
  if(x==y)  ans=0;
  else if(x==0){
    if(y<0) ans++;
    ans+=abs(y);
  }
  else if(y==0){
    if(x>0) ans++;
    ans+=abs(x);
  }
  else if(x<y){
    if(x<0 && 0<y) ans=1+abs(y-abs(x));
    else  ans=abs(y-x);
  }
  else if(y<x){
    if(0<y){
      ans++;
      ans+=1+abs(y-abs(x));
    }
    else if(y<0 && 0<x){
      ans++;
      ans+=abs(abs(y)-x);
    }
    else if(x<0){
      ans++;
      x=-x;
      ans++;
      ans+=abs(abs(y)-x);
    }
  }
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 3624
{-# LANGUAGE TypeApplications #-}

import Data.Maybe
import Data.List
import Control.Monad
import Data.Bifunctor
import Control.Applicative
import Data.Monoid
import Data.Coerce

main :: IO ()
main = do
    [n, m, x] <- fmap (read @Int) . words <$> getLine
    list <- replicateM n $ fromJust . uncons . fmap (read @Int) . words <$> getLine
    print $ (
        fromMaybe (-1) .
        foldl1May min .
        map fst .
        filter (all (>= x) . snd) .
        fmap (bimap getSum (fmap getSum . getZipList . getAp)) .
        fmap mconcat .
        traverse (: [mempty]) .
        fmap (bimap Sum (Ap . ZipList . fmap Sum))) list
    pure ()


foldl1May :: (a -> a -> a) -> [a] -> Maybe a
foldl1May f (x:xs) = Just $ foldl f x xs
foldl1May _ _ = Nothing

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

int main() {
  bool mur=true;
  string s;
  cin>>s;
  vector<bool> yj(26,false);
  for(int i=0;i<s.length();i++){
    if(yj[s[i]-'a']==false)yj[s[i]-'a']=true;
    else mur=false;
  }
  if(mur==true)cout<<"yes"<<endl;
  else cout<<"no"<<endl;
  
  return 0;
}

Measured memory_bytes: 256
import heapq

n, l = map(int, input().split())
taste = list(range(l, n + l))
ans = 0

if taste.count(0) == 1:
  ans = sum(taste)
elif max(taste) < 0:
  taste = list(map(lambda x: x * (-1), taste))
  heapq.heapify(taste)
  heapq.heappop(taste)
  ans = sum(taste) * (-1)
else:
  heapq.heapify(taste)
  heapq.heappop(taste)
  ans = sum(taste)
print(ans)

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

int main(){
	int ca[4][13] = {{},{},{},{}};
	int n,num;
	char ma;

  	cin >> n;

  	for (int i=0; i<n; i++){
    	cin >> ma >> num;
    	if (ma == 'S'){
			ca[0][num-1] = 1;
		} else if (ma == 'H'){
			ca[1][num-1] = 1;
		} else if (ma == 'C'){
			ca[2][num-1] = 1;
		} else if (ma == 'D'){
			ca[3][num-1] = 1;
		} 
  	}

  	for (int j=0; j<4; j++){
    	for (int k=0; k<13; k++){
      		if (ca[j][k] == 0){
				if (j == 0){
					cout << "S " << k+1 << endl;
				} else if (j == 1){
					cout << "H " << k+1 << endl;
				} else if (j == 2){
					cout << "C " << k+1 << endl;
				} else if (j == 3){
					cout << "D " << k+1 << endl;
				}
      		}
    	}
  	}

	return 0;
}



Measured memory_bytes: 3040
#include <iostream>
#include <iomanip>
#include <vector>
#include <set>
#include <string>
#include <queue>
#include <algorithm>
#include <map>
#include <cmath>
#include <numeric>
#include <list>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <tuple>
#include <deque>
#include <complex>

using namespace std;

/*
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> pii;
typedef vector<pii> vpii;
*/

typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<long long, long long> pll;
typedef vector<pll> vpll;

typedef long double ld;
typedef vector<ld> vld;

typedef vector<bool> vb;

#define rep(i, n) for (ll i = 0; i < (n); i++)
#define reps(i, n) for (ll i = 1; i <= (n); i++)
#define rrep(i, n) for (ll i = (n) - 1; i >= 0; i--)
#define rreps(i, n) for (ll i = (n); i >= 1; i--)
#define all(v) (v).begin(), (v).end()

template <class T> void chmin(T& a, T b) { a = min(a, b);}
template <class T> void chmax(T& a, T b) { a = max(a, b);}

constexpr int INF = 1 << 30;
constexpr ll INFL = 1LL << 60;
constexpr ll MOD = 1000000007;
constexpr ld EPS = 1e-12;
ld PI = acos(-1.0);

string d7[] {
    "aabbcc.",
    ".ddee.f",
    "d....af",
    "d....ag",
    "e....bg",
    "e....bh",
    ".aabb.h"
};

string d5[] {
    "aabbc",
    "e.ffc",
    "eg..d",
    "dg..d",
    "dccaa"
};

string d4[] {
    "aacd",
    "bbcd",
    "ghee",
    "ghff"
};

string d3[] {
    "aab",
    "d.b",
    "dcc"
};

void replace(vector<string>& s, ll cur, ll d) {
    if(d == 3) {
        rep(i, 3) s[cur + i].replace(cur, 3, d3[i]);
    }
    else if(d == 4) {
        rep(i, 4) s[cur + i].replace(cur, 4, d4[i]);
    }
    else if(d == 5) {
        rep(i, 5) s[cur + i].replace(cur, 5, d5[i]);
    }
    else if(d == 7) {
        rep(i, 7) s[cur + i].replace(cur, 7, d7[i]);
    }
}

void solve() {
    ll n;
    cin >> n;
    if(n == 2) {
        cout << -1 << endl;
        return;
    }
    vector<string> s(n, string(n, '.'));
    if(n % 3 == 0) {
        for(ll i = 0; i < n; i += 3) {
            replace(s, i, 3);
        }
    }
    else if(n == 7 || n == 11) {
        replace(s, 0, 7);
        if(n == 11) replace(s, 7, 4);
    }
    else {
        bool ok = false;
        for(ll i = 0; 4 * i <= n; i++) {
            if((n - 4 * i) % 5 != 0) continue;
            ok = true;
            ll c4 = i, c5 = (n - 4 * i) / 5;
            ll cur = 0;
//            cout << c4 << ' ' << c5 << endl;
            rep(i, c4) {
                replace(s, cur, 4);
                cur += 4;
            }
            rep(i, c5) {
                replace(s, cur, 5);
                cur += 5;
            }
            break;
        }
        if(!ok) {
            cout << -1 << endl;
            return;
        }
    }
    for(ll i = 0; i < n; i++) {
        for(ll j = 0; j < n; j++) cout << s[i][j];
        cout << endl;
    }
    return;
}

int main() {
    std::cin.tie(nullptr);
    std::ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    solve();
}

Measured memory_bytes: 4252
#include <bits/stdc++.h>
using namespace std;
int main(void){
    // Your code here!
    int n,l,r,count=0;
    cin>>n;
    for(int i=0; i<n; i++){
            cin>>l>>r;
            count+=r-l+1;
    }
    cout<<count<<endl;
}


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

namespace AtCoder2020Ned
{
    class Program
    {
        static void Main(string[] args)
        {
            List<Snuke> snukeList = new List<Snuke>();

            var firstInput = Console.ReadLine().Split(" ");

            for(int i = 0; i < int.Parse(firstInput[0]); i++)
            {
                snukeList.Add(new Snuke());
            }

            var numberOfSnackTypes = int.Parse(firstInput[1]);

            for (int i = 0; i < numberOfSnackTypes; i++)
            {
                var snackType = Console.ReadLine();
                var snukeNumberString = Console.ReadLine().Split(" ");
                int[] snukeNumber = new int[snukeNumberString.Length];

                for (int j = 0; j < snukeNumber.Length; j++)
                {
                    snukeNumber[j] = int.Parse(snukeNumberString[j]);
                }

                snukeList = AddSnack(snukeList, snackType, snukeNumber);
            }

            var numberOfTrickedSnuke = TrickCheck(snukeList);

            Console.WriteLine(numberOfTrickedSnuke);
            Console.Read();
        }

        static List<Snuke> AddSnack(List<Snuke> snukeList, string snackType, int[] snukeNumber)
        {
            for (int i = 0; i < snukeNumber.Length; i++)
            {
                snukeList[snukeNumber[i] - 1].SnackList.Add(snackType);
                if (snukeList[snukeNumber[i] - 1].HasSnack == false)
                {
                    snukeList[snukeNumber[i] - 1].HasSnack = true;
                }
            }

            return snukeList;
        }

        static int TrickCheck(List<Snuke> snukeList)
        {
            var tricked = 0;

            foreach (var item in snukeList)
            {
                if (item.HasSnack == false)
                {
                    tricked++;
                }
            }

            return tricked;
        }
    }

    class Snuke
    {
        public bool HasSnack { get; set; } = false;
        public List<string> SnackList { get; set; } = new List<string>();
    }
}


Measured memory_bytes: 28060