akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <string.h>
#include <limits.h>
#include <math.h>

#include <iostream>
#include <string>
#include <vector>
#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <utility>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstdio>

using namespace std;

#define FOR(i,s,e) for((i)=(s);(i)<(int)(e);(i)++)

#define rev(s) (string((s).rbegin(), (s).rend()))

int main() {
	int i, j, k;
	int n;
	string s;
//	set<string> ss;

	scanf("%d ", &n);
	for (k=0; k<n; k++) {
	set<string> ss;
//		ss.clear();
		cin >> s;
		for (i=0; i<s.size()-1; i++) {
			string h = s.substr(0,i+1);
			string t = s.substr(i+1);

			for (j=0; j<2; j++) {
				ss.insert(h+t);
				ss.insert(rev(h)+t);
				ss.insert(h+rev(t));
				ss.insert(rev(h)+rev(t));
				if (j==0) {swap(h, t);} 
			}
		}
		cout << ss.size() << endl;
	}

	return 0;
}

Measured memory_bytes: 1312
#include<bits/stdc++.h>
#define FRU freopen("out.txt","w",stdout)
#define FRO freopen("in.txt","r",stdin)
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define mem(ara,n) memset(ara,n,sizeof ara)
#define loop(i,j,n) for(i=j;i<n;i++)
#define rloop(i,j,n) for(i=n;i>=j;i--)
#define INF 2147483647
#define ll long long
#define pii pair<int,int>
#define eps 1e-9
#define mii map<int,int>
#define vi vector<int>
#define all(n) n.begin(),n.end()
#define inf INF
#define INFLL 10000000000000000LL
using namespace std;
const int row[]={-1,0,0,1};
const int col[]={0,-1,1,0};

int N,M,a,b,c;
ll cnt;
char s[401][401];
int grid[401][401];
int vis[401][401];

void f(int x,int y)
{
    vis[x][y]=c;
    if(grid[x][y]==0)a++,cnt+=(ll)b;
    else b++,cnt+=(ll)a;
    for(int i=0;i<4;i++)
    {
        int xx=x+row[i];
        int yy=y+col[i];
        if(xx>=0&& xx<N&& yy>=0&& yy<M&& grid[xx][yy]!=grid[x][y]&& vis[xx][yy]==0)
        {
            f(xx,yy);
        }
    }
}

int main()
{
    int n,m,i,j,k,tc,t;
    cin>>n>>m;
    N=n,M=m;
    for(i=0;i<n;i++)
    {
        cin>>s[i];
        for(j=0;j<m;j++)grid[i][j]=s[i][j]=='.'?0:1;
    }
    int ans=0;
    for(i=0;i<n;i++)
    {
        for(j=0;j<M;j++)
        {
            if(vis[i][j]==0)
            {
                a=b=0;
                c++;
                f(i,j);
                //ans+=(a*b);
            }
        }
    }
    /*for(i=0;i<n;i++)
    {
        for(j=0;j<m;j++)printf("%d ",vis[i][j]);printf("\n");
    }*/
    cout<<cnt<<endl;//cout<<c<<endl;
}


Measured memory_bytes: 9216
N = int(input())
S = input()
D = {"R": [], "G": [], "B": []}
for i in range(N):
  D[S[i]].append(i)
p = 1
for i in D:
  p *= len(D[i])
cnt = 0
for i in range(N):
  for j in range(i+1, N):
    if 2 * j - i < N:
      if S[i] != S[j] and S[j] != S[2*j-i] and S[2*j-i] != S[i]:
        cnt += 1
print(p-cnt)


Measured memory_bytes: 9260
#include<iostream>
#include<algorithm>
#include<vector>
#include<stdio.h>
#include<complex>
using namespace std;

int main(){
  int d = 'A' - 'a';
  string s;
  getline(cin, s);
  for(int i = 0; i < s.size(); i++){
    if('A' <= s[i] && s[i] <= 'Z'){
      char c = s[i] - d;
      cout << c;
    }else if('a' <= s[i] && s[i] <= 'z'){
      char c = s[i] + d;
      cout << c;
    }else{
      cout << s[i];
    }
  }
  cout << endl;
  return 0;
}



Measured memory_bytes: 3096
#include <bits/stdc++.h>
using namespace std;
#define int long long 
#define pi pair<int,int>
#define ff first
#define ss second
const int N = 1e5 + 5;


int32_t main() { 
	int a,b,c,k;
	cin>>a>>b>>c>>k;
	int ans = 0;
	ans = min(a,k);
	k -= min(a,k);
	k -= min(b,k);
	ans -= min(c,k);
	cout<<ans<<endl;
}	



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

int main() {
	int A, B, C, D; //A B vs  C D
	cin >> A >> B >> C >> D;
	while (true) {
		C -= B;
		if (C <= 0) {
			cout << "Yes";
			return 0;
		}
		A -= D;
		if (A <= 0) {
			cout << "No";
			return 0;
		}
	}

	return 0;
}

Measured memory_bytes: 3604
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String[] arr = sc.nextLine().split(" ");
		int n = Integer.parseInt(arr[0]);
		int x = Integer.parseInt(arr[1]);
		int[] m = new int[n];
		for(int i=0; i<n; i++) {
			m[i] = Integer.parseInt(sc.nextLine());
		}
		sc.close();

		int left = x;
		int min = 1000;
		for(int val: m) {
			left -= val;
			if (min > val)
				min = val;
		}
		System.out.println(n+(int)(left/min));
	}
}


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

#define int long long

template <typename T>
struct UF {
  int n;
  T d;
  vector<int> r, p;
  vector<T> ws;
  UF() {}
  UF(int sz, T d_) :
    n(sz), d(d_), r(n, 1), p(n), ws(n, d) { iota(p.begin(), p.end(), 0); }
  int find(int x) {
    if ( x == p[x] ) {
      return x;
    } else {
      int t = find(p[x]);
      ws[x] += ws[p[x]];
      return p[x] = t;
    }
  }

  T weight(int x) {
    find(x);
    return ws[x];
  }

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

  void unite(int x, int y, T w) {
    w += weight(x);
    w -= weight(y);
    x = find(x); y = find(y);
    if ( x == y ) return;
    if ( r[x] < r[y] ) swap(x, y), w = -w;
    r[x] += r[y];
    p[y] = x;
    ws[y] = w;
  }

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

signed main() {
  int n;
  while ( cin >> n, n ) {
    bool flag = true;    
    UF<int> uf(2*n+1, 0);
    map<string, int> stoi;
    int cnt = 0;
    for ( int i = 0; i < n; i++ ) {
      int a;
      string b, c, d, e;
      cin >> a >> b >> c >> d >> e;      
      if ( !flag ) continue;
      if ( !stoi.count(b) ) stoi[b] = cnt++;
      if ( !stoi.count(e) ) stoi[e] = cnt++;

      int numd = 0;
      for ( int i = 0; i < (int)d.size(); i++ ) {
	if ( d[i] == '^' ) {
	  i++;	  
	  int mi = 1;	  
	  if ( d[i] == '-' ) mi = -1, i++;
	  for ( ; i < (int)d.size(); i++ ) {
	    numd *= 10;
	    numd += d[i]-'0';	    
	  }
	  numd *= mi;       
	}
      }
      // cout << stoi[b] << " " <<  stoi[e] << endl;
      if ( uf.same(stoi[b], stoi[e]) && uf.diff(stoi[b], stoi[e]) != numd ) {	
	flag = false;
	continue;	
      }
      uf.unite(stoi[b], stoi[e], numd);
      // cout << uf.diff(stoi[e], stoi[b]) << endl;
    }

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



Measured memory_bytes: 3180
#![allow(non_snake_case, unused)]
use std::cmp::*;
use std::collections::*;
use std::f64::consts::*;

macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input!{
        city: [u64; 6],
    }
    let mut dict = HashMap::new();
    for c in city.iter() {
        *(dict.entry(c).or_insert(0)) += 1;
    }
    let mut list = vec![];
    for (k, v) in dict.iter() {
        list.push(v)
    }
    list.sort();

    println!(
        "{}",
        if list == vec![&1, &1, &2, &2] {
            "YES"
        } else {
            "NO"
        }
    )
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
#define f first
#define s second
using namespace std;
typedef pair<int,int> P;
int w,h;
 
int calc(int x,int y){
  if(x==0) return y;
  if(y==h) return h+x;
  if(x==w) return h+w+h-y;
  return h+w+h+w-x;
}
 
int LU(int x,int y){
  int d=min(x,h-y);
  return calc(x-d,y+d);
}
 
int RU(int x,int y){
  int d=min(w-x,h-y);
  return calc(x+d,y+d);
}
 
int RD(int x,int y){
  int d=min(w-x,y);
  return calc(x+d,y-d);
}
 
int LD(int x,int y){
  int d=min(x,y);
  return calc(x-d,y-d);
}
 
bool check(P a,int b){
  if(a.f<a.s&&(a.f<=b&&b<=a.s))return 1;
  if(a.f>a.s&&!(a.s<b&&b<a.f)) return 1;
  return 0;
}
 
int main(){
  int n;
  cin>>n>>w>>h;
   
  vector <P> lr;
  for(int i=0;i<n;i++){
    int x,y;
    char ch;
    cin>>x>>y>>ch;
    if(ch=='N')lr.push_back(P(LU(x,y),RU(x,y)));
    if(ch=='E')lr.push_back(P(RU(x,y),RD(x,y)));
    if(ch=='S')lr.push_back(P(RD(x,y),LD(x,y)));
    if(ch=='W')lr.push_back(P(LD(x,y),LU(x,y)));
  }
 
  for(int i=0;i<n;i++)swap(lr[i].f,lr[i].s);
  sort(lr.begin(),lr.end());
  for(int i=0;i<n;i++)swap(lr[i].f,lr[i].s);
   
   
  int ans=n;
  for(int i=0;i<n;i++){
    int cnt=1,pos=lr[i].s;
    for(int j=0;j<n;j++){
      int idx=(i+j)%n;
      if(check(lr[idx],pos))continue;
      cnt++;
      pos=lr[idx].s;
    }
    ans=min(ans,cnt);
  }
  cout <<ans<<endl;  
   
 
  return 0;
}

Measured memory_bytes: 3120
def main():
    from string import ascii_lowercase
    c = input()
    idx = ascii_lowercase.index(c)
    ans = ascii_lowercase[idx + 1]
    print(ans)


if __name__ == '__main__':
    main()

# import sys
#
# sys.setrecursionlimit(10 ** 7)
#
# input = sys.stdin.readline
# rstrip()
# int(input())
# map(int, input().split())


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

int main () {
  int N;
  cin >> N;
  bool flag = true;
  
  for (int i = 0; i < N; i++) {
    string S;
    cin >> S;
    if (S == "Y") {
      flag = false;
      break;
    }
  }
  
  if (flag) {
    cout << "Three" <<endl;
  }
  else {
    cout << "Four" << endl;
  }
}

Measured memory_bytes: 256
#include<cstdio>
#include<cmath>
#include<algorithm>
#define MAXN 100
#define INF 0x3FFFFFFF
using namespace std;
int A,B;
int col1,col2;
int Map[MAXN+5][MAXN+5];
void Print()
{
	for(int i=1;i<=100;i++)
	{
		for(int j=1;j<=100;j++)
		{
			if(Map[i][j]==0)
				printf(".");
			else
				printf("#");
		}
		printf("\n");
	}
//	printf("\n\n");
}
int main()
{
//	freopen("out.txt","w",stdout);
	scanf("%d %d",&A,&B);
	if(A>B)
		col1=0,col2=1;
	else if(A<=B)
		col1=1,col2=0,swap(A,B);
	B--;
	int sqrtA=ceil(sqrt(A));
	int goal=4;
	int tot=625;
//	int goalr=0,golac=0;
//	int delta=INF;
//	for(int i=1;i<=sqrtA;i++)
//	{
//		if(A%i==0)
//		{
//			if(abs(i-A/i)<delta)
//			{
//				delta=abs(i-A/i);
//				goalr=i;
//				goalv=A/i;
//			}
//		}
//	}
	for(int i=1;i<=100;i++)
		for(int j=1;j<=100;j++)
			Map[i][j]=col1;
//	Print();
	for(int i=1;i<=100;i++)
	{
		if(i%goal==0)
			for(int j=1;j<=100;j++)
				Map[i][j]=col2;
		for(int j=1;j<=100;j++)
			if(j%goal==0)
				Map[i][j]=col2;
	}
//	Print();
	for(int begi=1;begi<=100;begi+=goal)
	{
		for(int begj=1;begj<=100;begj+=goal)
		{
			if(tot>A)
			{
				tot--;
				for(int i=begi;i<=begi+goal-1;i++)
					for(int j=begj;j<=begj+goal-1;j++)
						Map[i][j]=col2;
			}
			else if(B>0)
			{
				B--;
				Map[begi+1][begj+1]=col2;
			}
		}
	}
	printf("100 100\n");
	Print();
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
using namespace std;
int main()
{
	int n, m;
	int num[7] = { -1,-1,-1,-1,-1,-1,-1 };
	int s, c;
	int i;
	bool ans = true;
	cin >> n >> m;
	for (i = 0; i < m; i++) {
		cin >> s >> c;
		if (s == 1 && c == 0 && n >= 2) {
			ans = false;
		}
		if (num[s] == -1 || num[s] == c) {
			num[s] = c;
		}
		else {
			ans = false;
		}
	}

	if (n == 1 && m == 0) {
		cout << 0 << endl;
		return 0;
	}

	if (ans) {
		for (i = 1; i <= n; i++) {
			if (num[i] == -1) {
				if (i == 1) {
					cout << 1;
				}
				else {
					cout << 0;
				}
			}
			else {
				cout << num[i];
			}
		}
	}
	else {
		cout << -1 << endl;
	}

	return 0;
}


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

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

using namespace std;
typedef long long int ll;
const ll INF = 1000000000000000000;
const double PI = acos(-1);

int main()
{
    char a;
    cin >> a;
    if (isupper(a)) {
        cout << "A" << endl;
    }
    else {
        cout << "a" << endl;
    }
    return 0;
}

Measured memory_bytes: 3628
#include <iostream>
#include <complex>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <numeric>
#include <cstring>
#include <ctime>
#include <cstdlib>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <cmath>
#include <bitset>
#include <cassert>
#include <queue>
#include <stack>
#include <deque>
#include <random>
typedef long long int ll;
typedef long double ld;
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
const ll MOD=1000000007;
const ll MAX_N=500010;
const ll INF=999999999;
ll dp[3010][3010];

int main(){
    string s,t;
    cin>>s;
    cin>>t;
    ll n=s.length();
    ll m=t.length();
    for(int i=0;i<=n;i++){
        dp[i][0]=0;
    }
    for(int i=0;i<=m;i++){
        dp[0][i]=0;
    }
    for(int i=1;i<=n;i++){
        for(int j=1;j<=m;j++){
            if(s[i-1]==t[j-1]){
                dp[i][j]=dp[i-1][j-1]+1;
            }else{
                dp[i][j]=max(dp[i-1][j],dp[i][j-1]);
            }
        }
    }
    string ans="";
    while(n>0 && m>0){
        if(dp[n][m]==dp[n][m-1]){
            m--;
        }else if(dp[n][m]==dp[n-1][m]){
            n--;
        }else if(dp[n][m]!=dp[n-1][m-1]){
            ans=s[n-1]+ans;
            n--; m--;
        }
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 70784
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
using namespace std;
 
int main(void){
    int n;
    cin >> n;
    long long int num[n];
    long long int sum[n];
    long long int ans = 10000000000000;
    for(int i = 0; i < n; i++){
        cin >> num[i];
        if(i==0) sum[i]=num[i];
        else sum[i]=sum[i-1]+num[i];
    }
    for(int i = 0; i < n-1; i++)
        ans = min(ans, abs(sum[i]-(sum[n-1]-sum[i])));

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

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

public class Main {
    public static void main(String[] args) {
        FastScanner sc = new FastScanner();
        int a = sc.nextInt();
        int b = sc.nextInt();
        int ans = 0;
        if (a <= 5) {
            ans = 0;
        } else if (a >= 6 && a <= 12) {
            ans = b / 2;
        } else {
            ans = b;
        }
        System.out.println(ans);
    }
}

class FastScanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;

    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        } else {
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }

    private int readByte() {
        if (hasNextByte())
            return buffer[ptr++];
        else
            return -1;
    }

    private static boolean isPrintableChar(int c) {
        return 33 <= c && c <= 126;
    }

    public boolean hasNext() {
        while (hasNextByte() && !isPrintableChar(buffer[ptr]))
            ptr++;
        return hasNextByte();
    }

    public String next() {
        if (!hasNext())
            throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while (isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }

    public long nextLong() {
        if (!hasNext())
            throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while (true) {
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            } else if (b == -1 || !isPrintableChar(b)) {
                return minus ? -n : n;
            } else {
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }

    public int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)
            throw new NumberFormatException();
        return (int) nl;
    }

    public double nextDouble() {
        return Double.parseDouble(next());
    }
}


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

namespace ConsoleApplication6
{
    class Program
    {
        static void Main(string[] args)
        {
            int finish = 0;
            var read = Console.ReadLine();
            int N = int.Parse(read);
            for (long a = (N / 4) + 1; a <= 3500; a++)
            {
                for (long b = N * a / (4 * a - N)+1; b <= 3500; b++)
                {
                    long c = (N * a * b) / (4 * a * b - N * b - N * a);
                    if ((N * a * b) % (4 * a * b - N * b - N * a) == 0 && c<=3500)
                    {
                        
                        Console.WriteLine("{0} {1} {2}", a, b, (N * a * b) / (4 * a * b - N * b - N * a));
                        finish = 1;
                        break;
                    }
                    else if ((N * a * b) / (4 * a * b - N * b - N * a) > 3500) continue;
                    
                }
                if (finish == 1) break;

            }

        }
    }
}


Measured memory_bytes: 13268
#include <bits/stdc++.h>
#define IOS ios::sync_with_stdio(0),cin.tie(0),cout.tie(0) 
#define X first
#define Y second 
#define nl '\n'
#define AC return 0
#define pb(a) push_back(a) 
#define mst(a,b) memset(a, b, sizeof a)
#define rep(i,n) for(int i = 0; (i)<(n); i++)
#define rep1(i,n) for(int i = 1; (i)<=(n); i++)
#define scd(a) scanf("%lld", &a)
#define scdd(a,b) scanf("%lld%lld", &a, &b)
#define scs(s) scanf("%s", s)
//#pragma GCC optimize(2)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
const ll INF = (ll)0x3f3f3f3f3f3f3f, MAX = 9e18, MIN = -9e18;
const int N = 1e6+10, M = 2e6+10, mod = 1e9+7, inf = 0x3f3f3f;
ll f[N], up[N], down[N]; 

ll q_pow(ll a, ll k)
{
	ll s = 1;
	while(k)
	{
		if(k&1)	s = s*a%mod;
		a = a*a%mod;
		k >>= 1;
	}
	return s;
}


int main()
{
	IOS;
	ll n;
	cin>>n;
	f[0] = 1;
	rep1(i, n)
		f[i] = f[i-1]*8%mod;
		
	up[0] = down[0] = 1;
	rep1(i, n)
		up[i] = up[i-1]*i%mod;
	rep1(i, n)
		down[i] = down[i-1]*q_pow(i, mod-2)%mod;
	
	ll ans = q_pow(10, n), t = 0;
	rep(i, n+1)
	{
		ll tmp = up[n]*down[i]%mod*down[n-i]%mod*f[n-i]%mod;
		if(i)
			tmp = tmp*2%mod;
		t += tmp;
		t %= mod;
			
	}
	
	cout<<(ans-t+mod)%mod<<nl;
	
	AC;
} 

Measured memory_bytes: 26968
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using p = pair<int, int>;
#define INF 1001001001
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define repX(i, n ,x) for (int i = x; i < (int)(n); ++i)
#define repBack(i, n) for (int i = n; i >= 0; --i)
#define dup(x,y) (((x)+(y)-1)/(y))

int main() {
    string S,T;
    cin >> S >> T;
    bool flag = true;
    rep(i,S.size()){
        if(S[i]!=T[i])flag = false;
    }
    if(flag)cout << "Yes" << endl;
    else cout << "No" << endl;
    
    return 0;
}

Measured memory_bytes: 3628
//1.read question_2.read I/O_3.read test cases_4.read constraints(to decide TC of solution)_5.decide method_6.dry run_
//7.code_8.test_9.submit
#include<bits/stdc++.h>
using namespace std;
typedef long long int lli;
const lli mod=1e9+7;
#define F first
#define S second
#define _READ freopen("input.txt","r", stdin);
#define pb push_back
#define _FAST ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
int main()
{

    lli n,k;cin>>n>>k;
    double temp;
    vector<double> ar;
    for(lli i=0;i<n;i++)
    {
        cin>>temp;
        temp=(temp+1)/2.0;
        ar.push_back(temp);
    }
    temp=0;
   // for(auto i:ar)
    //    cout<<i<<" ";cout<<"\n";
    for(lli i=0;i<k;i++)
        temp+=ar[i];
    double ans=temp;
    //cout<<ans;
    for(lli i=k;i<n;i++)
    {
        temp=temp-ar[i-k]+ar[i];
        ans=max(ans,temp);
    }
    cout<<setprecision(20)<<ans;
    return 0;
}


Measured memory_bytes: 2420
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)   FOR(i,0,n)
#define pb emplace_back
typedef long long ll;
typedef pair<int,int> pint;

struct BIT{
    int size;
    vector<ll> dat;
    void init(int n){
        size=n;
        dat.clear();
        dat.resize(n+1);
    }
    void add(int i,ll x){
        while(i<=size){
        dat[i]+=x;
        i +=i&-i;
        }
    }
    ll sum(int i){
        ll s=0;
        while(0<i){
            s +=dat[i];
            i -=i&-i;
        }
    return s;
    }
};

int cnt[26];
deque<int> v[26];
int a[200002];
int main(){
    string s;
    cin>>s;
    int n=s.size();
    rep(i,n){
        int p=s[i]-'a';
        ++cnt[p];v[p].pb(i+1);
    }
    int od=0,oc=-1;
    rep(i,26){
        if(cnt[i]%2==1) ++od,oc=i;
    }
    if(od>1){
        cout<<-1<<endl;
        return 0;
    }
    rep(i,n/2){
        int mn=10001000,c=-1;
        rep(j,26){
            if(v[j].empty()) continue;
            if(v[j].front()<mn){
                if(j==oc&&v[j].size()==1) continue;
                mn=v[j].front(),c=j;
            }
        }
        a[i]=v[c].front();a[n-i-1]=v[c].back();
        v[c].pop_front();v[c].pop_back();
    }
    if(oc!=-1) a[n/2]=v[oc].front();
    //rep(i,n) cout<<a[i];
    BIT b;
    b.init(n+1);
    ll ans=0;
    rep(i,n){
        ans+=i-b.sum(a[i]);
        b.add(a[i],1);
    }
    cout<<ans<<endl;
    return 0;
}

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

using ld = double;
using P = complex<ld>;
using G = vector<P>;
const ld pi = acos(-1);
const ld eps = 1e-10;
const ld inf = 1e12;

ld cross(const P &a, const P &b) {
    return a.real() * b.imag() - a.imag() * b.real();
}
ld dot(const P &a, const P &b) {
    return a.real() * b.real() + a.imag() * b.imag();
}

using C = pair<ld, P>;
#define rad first
#define pnt second

template <class iter>
std::pair<P, ld> min_ball(iter left, iter right, int seed = 1333) {
    const int n = right - left;

    assert(n >= 1);
    if(n == 1) {
        return {*left, ld(0)};
    }

    std::mt19937 mt(seed);
    std::shuffle(left, right, mt);
    // std::random_shuffle(left, right); // simple but deprecated

    iter ps = left;
    using circle = std::pair<P, ld>;

    auto make_circle_3 = [](const P &a, const P &b, const P &c) -> circle {
        ld A = std::norm(b - c), B = std::norm(c - a), C = std::norm(a - b), S = cross(b - a, c - a);
        P p = (A * (B + C - A) * a + B * (C + A - B) * b + C * (A + B - C) * c) / (4 * S * S);
        ld r2 = std::norm(p - a);
        return {p, r2};
    };

    auto make_circle_2 = [](const P &a, const P &b) -> circle {
        P c = (a + b) / (ld)2;
        ld r2 = std::norm(a - c);
        return {c, r2};
    };

    auto in_circle = [](const P &a, const circle &c) -> bool {
        return std::norm(a - c.first) <= c.second + eps;
    };

    circle c = make_circle_2(ps[0], ps[1]);

    // MiniDisc
    for(int i = 2; i < n; ++i) {
        if(!in_circle(ps[i], c)) {
            // MiniDiscWithPoint
            c = make_circle_2(ps[0], ps[i]);
            for(int j = 1; j < i; ++j) {
                if(!in_circle(ps[j], c)) {
                    // MiniDiscWith2Points
                    c = make_circle_2(ps[i], ps[j]);
                    for(int k = 0; k < j; ++k) {
                        if(!in_circle(ps[k], c)) {
                            c = make_circle_3(ps[i], ps[j], ps[k]);
                        }
                    }
                }
            }
        }
    }
    return c;
}

signed main() {
    long long n;
    cin >> n;
    G ps(n);
    for(long long i = 0; i < n; i++) {
        int x, y;
        cin >> x >> y;
        ps[i] = P(x, y);
    }
    cout << fixed << setprecision(12);
    cout << sqrt(min_ball(ps.begin(), ps.end()).second) << endl;
    return 0;
}


Measured memory_bytes: 764
#include<stdio.h>

int main()
{
	int k, a, b;
	scanf("%d", &k);
	scanf("%d %d", &a, &b);
	int i = 1;
	while(k * i <= b)
	{
		if (k * i >= a && k * i <= b) 
		{
			printf("OK\n");
			break;
		}
		i++;
	}
	if (i * k > b) printf("NG");
	return 0;
}

Measured memory_bytes: 1720
#include <bits/stdc++.h>
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
#define ALL(x) (x).begin(),(x).end() 
#define SIZE(x) ((ll)(x).size())
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
#define INF 1000000000
using namespace std;
using P = pair<int, int>;
typedef long long ll;

vector<int> to[1000005];

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

    vector<int> A(N);
    REP(i, N){
        cin >> A[i];
    }

    REP(x, K){
        vector<int> B(N+1);
        REP(i, N){
            int l = max(0, int(i)-A[i]);
            int r = min(int(i)+A[i]+1, N);
            B[l]++;
            B[r]--;
        }
        
        REP(i, N){
            B[i+1] += B[i];
        }
        B.pop_back();
        
        if(A == B){
            break;
        }
        A = B;
    }

    REP(i, N){
        cout << A[i] << " ";
    }
    cout << endl;
}


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

int main()
{
	int N;
	cin >> N;
	for (int i = 0, s, d; i < N; i++) {
		cin >> s >> d;
		int res = 0;
		while (s && s * 2 - (s & (s - 1)) <= d) {
			s = s * 2 - (s & (s - 1));
			res++;
		}
		while (d && (d & (d - 1)) >= s) {
			d = d & (d - 1);
			res++;
		}
		cout << res << endl;
	}
	return 0;
}

Measured memory_bytes: 3100
// #define _CRT_SECURE_NO_WARNINGS
// #define _USE_MATH_DEFINES	// M_PI=3.1415...
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <cmath>
#include <cstdlib>
#include <functional>
#include <locale>
#include <cctype>
#include <sstream>
#include <iomanip>	// 20桁出力 cout << setprecision(20) << double;
#include <queue>
#include <bitset>	// bitset<8> bs1(131uL); // 10000011 bs1[0]は1 01stringからビット集合生成可
using namespace std;

typedef long long LL;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<LL> VL;
typedef map<int, int> MAPII;
typedef multimap<int, char, greater<int> > MuMAPIC;
typedef vector<pair<int, int> > VPII;
typedef multimap<int, string, greater<int> > MuMIS;
typedef pair<int, int> P;
typedef pair<int, pair<P, P> > PP;

#define INF 999999999999999997;
#define MP make_pair
#define FAST_IO  cin.tie(0); ios::sync_with_stdio(false);
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define FORL(i,a,b) for(LL i=(a);i<(b);i++)
#define FOR_REV(i,a,b) for(int i=(a);i>=(b);i--)
//for gcc (未test)
// #define FOREACH_IT(it,c) for(typeof(c)::iterator it=(c).begin(); it!=(c).end(); ++it)
//for Visual Studio
#define foreach_it(type,it,c) for(type::iterator it=c.begin(),c_end=c.end();it!=c_end;++it)
#define FOR_ITR(d) for(auto itr=d.begin(),d_end=d.end();itr!=d_end;++itr)	// C++11
// for Debug.
#define DUMP_VVI(b) FOR(i,0,b.size()){FOR(j,0,b[i].size())printf("%d ",b[i][j]);puts("");}
#define D_OUT(str,value) if(dbgF){cout<<str<<" : "<<value<<endl;}
// 入力をpush_back(d)やarray[d]に使う時に1行で書ける
// int INPUT_INT() {int d;cin>>d;return d;}
template<class T>T IN() { T d; cin >> d; return d; }
// 最大公約数（Greatest Common Divisor）
LL gcd(LL a, LL b) { return (b > 0) ? gcd(b, a%b) : a; }
// 最小公倍数（Least Common Multiple）
LL lcm(LL a, LL b) { return a / gcd(a, b) * b; }
// Y年はうるう年か否か
bool uruu(LL Y) { return (((Y % 4 == 0 && Y % 100 != 0) || Y % 400 == 0) ? true : false); }

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

// vector注意
// vec[i][j]の形に入力を入れるとき、vecは初期化してある必要がある.

// ------------------- include, typedef, define END. -------------------

int main() {
	FAST_IO;
	// for D_OUT(str, value)  ... cout<< str <<" : "<< value <<endl;
	bool dbgF = true;

	//コードはここから書く.

	int H, W;
	string s;
	bool flg = false;
	int mostRightSharpPos = 0;
	cin >> H >> W;
	FOR(i, 0, H) {
		cin >> s;
		FOR(j, 0, W) {
			if (s[j] == '#'&&j < mostRightSharpPos) {
				flg = true;
				break;
			}
			if (s[j] == '#') {
				mostRightSharpPos = j;
			}
		}
		if (flg)break;
	}
	cout << (flg ? "Impossible" : "Possible") << endl;

	return 0;
}

Measured memory_bytes: 256
#include"bits/stdc++.h"
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define PI 3.141592653589793238

int main() {
	int N;
	cin >> N;
	vector<int> t(N + 1, 0);
	vector<int> x(N + 1, 0);
	vector<int> y(N + 1, 0);
	for (int i = 1;i <= N;++i) {
		cin >> t[i] >> x[i] >> y[i];
	}
	rep(i, N) {
		int path = abs(x[i + 1] - x[i]) + abs(y[i + 1] - y[i]), time = t[i + 1] - t[i];
		if (path <= time && path % 2 == time % 2) {
			continue;
		}
		else {
			puts("No");
			return 0;
		}
	}
	puts("Yes");
	return 0;
}

Measured memory_bytes: 1408
# -*- coding: utf-8 -*-
"""
How Many Islands?
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=1160&lang=jp

"""
import sys
from sys import stdin
from collections import deque
input = stdin.readline


def bfs(data, sx, sy, w, h):
    dy = [-1, 1, 0, 0, -1, -1, 1, 1]
    dx = [0, 0, -1, 1, -1, 1, -1, 1]
    Q = deque()
    Q.append((sx, sy))
    data[sy][sx] = '-'
    while Q:
        cx, cy = Q.popleft()        #  現在地の座標
        for i in range(8):
            nx = cx + dx[i]
            ny = cy + dy[i]
            if (not 0 <= nx < w) or (not 0 <= ny < h):
                continue
            elif data[ny][nx] == '1':
                Q.append((nx, ny))
                data[ny][nx] = '-'


def solve(field, w, h):
    ans = 0
    for y in range(h):
        for x in range(w):
            if field[y][x] == '1':
                bfs(field, x, y, w , h)
                ans += 1
    return ans


def main(args):
    while True:
        w, h = map(int, input().split())
        if w == 0 and h == 0:
            break
        field = []
        for _ in range(h):
            field.append([x for x in input().split()])
        ans = solve(field, w, h)
        print(ans)


if __name__ == '__main__':
    main(sys.argv[1:])



Measured memory_bytes: 6032
fn main() {
    let v = read_vec::<i32>();
    let a = v[0];
    let b = v[1];
    let c = v[2];
    if a == b {
        println!("{}", c);
    } else if b == c {
        println!("{}", a);
    } else {
        println!("{}", b);
    }
}

#[allow(dead_code)]
fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}
#[allow(dead_code)]
fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}
#[allow(dead_code)]
fn read_vec2<T: std::str::FromStr>(n: u32) -> Vec<Vec<T>> {
    (0..n).map(|_| read_vec()).collect()
}
#[allow(dead_code)]
fn yn(result: bool) {
    if result {
        println!("Yes");
    } else {
        println!("No");
    }
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using pull = pair<ull, ll>;
using pis = pair<int, string>;
#define all(x) (x).begin(), (x).end()
#define INF 1000000000
#define LLINF 10000000000000000ll
#define MOD 1000000007LL


int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  //cout << fixed << setprecision(15)

  ll n, m;
  cin >> n >> m;
  vector<vector<ll>> graph(n*3);
  ll a, b;
  for (int i = 0; i < m; i++) {
    cin >> a >> b;
    a--, b--;
    graph[a*3+0].emplace_back(b*3+1);
    graph[a*3+1].emplace_back(b*3+2);
    graph[a*3+2].emplace_back(b*3+0);
  }
  
  vector<ll> d(3*n, -3);
  queue<ll> que;
  ll s, t;
  cin >> s >> t;
  s--, t--;
  d[3*s] = 0;
  que.push(3*s);
  while(!que.empty()) {
    ll p = que.front(); que.pop();
    if (p == 3 * t) break;
    for (ll nx: graph[p]) {
      if (d[nx] == -3) {
        d[nx] = d[p] + 1;
        que.push(nx);
      }
    }
  }
  cout << d[3*t] / 3 << endl;
}


Measured memory_bytes: 21884
#include <math.h>
#include <stdio.h>
int main(int argc, const char * argv[])

{
    int a,b,c;
    scanf("%d %d %d",&a,&b,&c);
    if(a<b&&b<c&&a<c){
       printf("Yes\n");
    }else{
       printf("No\n");
    }
    return 0;
}

Measured memory_bytes: 580
#include<iostream>


using namespace std;


int main(){
    long A,B,C;
    cin>>A>>B>>C;

    int ans=0;

    if(A%2==1||B%2==1||C%2==1){
        cout<<0<<endl;
        return 0;
    }else if(A==B&&B==C){
        cout<<-1<<endl;
        return 0;
    }else{
        bool ccc=true;
        while(ccc){
                ans++;

            if(A%2==1&&B%2==1&&C%2==1){
                break;
            }
            else{
                A/=2;
                B/=2;
                C/=2;
            if(A%2==1&&((A%2)!=(B%2)||(A%2)!=(C%2))||B%2==1&&((B%2)!=(A%2)||(B%2)!=(C%2))||C%2==1&&((C%2)!=(A%2)||(C%2)!=(B%2))){
                ccc=0;
                break;
            }
                
            }
        }
    }

    cout<<ans<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>

#define INF 1000000021
#define MOD 1000000007
#define pb push_back
#define sqr(a) (a)*(a)
#define M(a, b) make_pair(a,b)
#define T(a, b, c) make_pair(a, make_pair(b, c))
#define F first
#define S second
#define all(x) (x.begin(), x.end())
#define deb(x) cerr << #x << " = " << x << '\n'
#define N 222222

using namespace std;
//using namespace __gnu_pbds;

typedef long double ld;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
//typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;

const ld pi = 2 * acos(0.0);
template<class T> bool umin(T& a, T b){if(a>b){a=b;return 1;}return 0;}
template<class T> bool umax(T& a, T b){if(a<b){a=b;return 1;}return 0;}
template<class T, class TT> bool pal(T a, TT n){int k=0;for(int i=0;i<=n/2;i++){if(a[i]!=a[n-i-1]){k=1;break;}}return k?0:1;}

//int month[] = {0,31,28,31,30,31,30,31,31,30,31,30,31};

int main()
{
	string a, b;
	cin >> a >> b;
	cout << b + a;





	





	getchar();
	getchar();
	return 0;
	//ios::sync_with_stdio(false);
	//cin.tie(0);
}

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

long w, a, b, jarak;
int main(){
    cin >> w >> a >> b;
    if (b > a){
        jarak = b - (a+w);
    } else {
        jarak = a - (b+w);
    }
    if (jarak < 0){
        cout << "0\n";
    } else {
        cout << jarak << endl;
    }
}


Measured memory_bytes: 256
/* C++14 (Clang 3.8.0) for AtCoder */

#include <iostream>
#include <vector>
#include <string>
// #include <cmath>
// #include <math.h>
// #include <map>
// #include <algorithm>

namespace AtCoder {
	using Str = std::vector<std::string>;
	using Num = std::vector<int>;
	using BigNum = std::vector<double>;

	class InputData {
	public:
		void getInput(void);
		void skipInput(void);
		Str getStr(void);
		Num getNum(void);
		BigNum getBigNum(void);
	private:
		Str str;
		Num num;
		BigNum bNum;
	};
	Str AtCoder::InputData::getStr(void) {
		return this->str;
	}
	Num AtCoder::InputData::getNum(void) {
		return this->num;
	}
	BigNum AtCoder::InputData::getBigNum(void) {
		return this->bNum;
	}
	void AtCoder::InputData::skipInput(void) {
		std::string buf = "";
		std::getline(std::cin, buf);
	}
	void AtCoder::InputData::getInput(void) {
		this->str.clear();
		this->num.clear();
		this->bNum.clear();

		std::string buf = "", row = "";
		std::getline(std::cin, buf);
		for (unsigned int i = 0; i < buf.size(); i++) {
			if (' ' == buf[i]) {
				this->str.push_back(row);
				this->num.push_back(std::atoi(row.c_str()));
				this->bNum.push_back(std::atof(row.c_str()));
				row = "";
			} else {
				row += buf[i];
			}
		}
		this->str.push_back(row);
		this->num.push_back(std::atoi(row.c_str()));
		this->bNum.push_back(std::atof(row.c_str()));
	}

	class Ans {
	public:
		void showResult(void);
		void increment(void);
		void increment(double);
		void decrement(void);
		void decrement(double);
		double getResult(void);
	private:
		double result;
	};
	void Ans::showResult(void) {
		printf("%.0lf\n", this->result);
	}
	void AtCoder::Ans::increment(void) {
		this->result++;
	}
	void AtCoder::Ans::increment(double value) {
		this->result += value;
	}
	void AtCoder::Ans::decrement(void) {
		this->result--;
	}
	void AtCoder::Ans::decrement(double value) {
		this->result -= value;
	}
	double AtCoder::Ans::getResult(void) {
		return this->result;
	}

	void exp(std::string* str,  Str* newStr) {
		std::string pre = *str;
		newStr->clear();
		for (unsigned int i = 0; i < pre.length(); i++) {
			newStr->push_back(pre.substr(i, 1));
		}
	}
}

int main(void) {
	AtCoder::InputData* data = new AtCoder::InputData();
	data->getInput();
	AtCoder::BigNum bnum = data->getBigNum();

	double h = bnum[0];

	AtCoder::Ans* ans = new AtCoder::Ans();

	ans->increment();
	h = h / 2;

	double c = 1;

	while (1 <= h) {
		double buf = 1;
		for (int i = 0; i < c; i++) {
			buf *= 2;
		}
		ans->increment(buf);
		h = h / 2;
		c++;
	}

	ans->showResult();

	delete(ans);
	delete(data);

	return 0;
}


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

#define ran 202202

int n;
int x[ran], y[ran];
map<int, int> mpx, mpy;
int p[ran];
int cnt[ran][2];

int get_p(int x) { return p[x]==-1 ? x : p[x] = get_p(p[x]); }

int main() {
	scanf("%d", &n);
	for(int i=1;i<=n;i++) {
		scanf("%d%d", &x[i], &y[i]);
		if (!mpx[x[i]]) mpx[x[i]] = mpx.size();
		x[i] = mpx[x[i]];
		if (!mpy[y[i]]) mpy[y[i]] = mpy.size();
		y[i] = mpy[y[i]];
	}
	for(int i=1;i<=n;i++) y[i] += mpx.size();
	//for(int i=1;i<=n;i++) printf("%d %d\n", x[i], y[i]);
	
	memset(p, -1, sizeof p);
	for(int i=1;i<=n;i++) {
		int a = get_p(x[i]), b = get_p(y[i]);
		if (a!=b) p[a] = b;
	}
	
	for(int i=1;i<=mpx.size() + mpy.size();i++) {
		int a = get_p(i);
		if (i<=mpx.size()) cnt[a][0]++;
		else cnt[a][1]++;
	}
	long long ans = 0;
	for(int i=1;i<=mpx.size() + mpy.size();i++)
		ans += 1LL*cnt[i][0] * cnt[i][1];
	cout<<ans-n<<endl;
	
	return 0;
}

Measured memory_bytes: 6656
#include "bits/stdc++.h"
#pragma GCC optimize("Ofast")

// Begin {{{
using namespace std;

#ifndef DEBUG
#define dump(...)
#endif

template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }
template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }

template <class T>
inline vector<T> make_v(const T &initvalue, size_t sz) {
    return vector<T>(sz, initvalue);
}

template <class T, class... Args>
inline auto make_v(const T &initvalue, size_t sz, Args... args) {
    return vector<decltype(make_v<T>(initvalue, args...))>(sz, make_v<T>(initvalue, args...));
}

constexpr int INF = 0x3f3f3f3f;
constexpr int64_t LINF = 0x3f3f3f3f3f3f3f3fLL;
// }}} End

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

    int N, L;
    cin >> N >> L;

    int R = L + N - 1;

    if (R <= 0) {
        R--;
    } else if (L >= 0) {
        L++;
    }

    cout << (L + R) * (R - L + 1) / 2 << "\n";

    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;
#define pai 3.141592653589793238462643383279


int main(){
  ll A; string B; cin >> A >> B;
  ll bb = (B[0]-'0')*100+(B[2]-'0')*10+(B[3]-'0');
  cout << A*bb/100 << endl;
}


Measured memory_bytes: 3600
/// d.cpp
# include <stdio.h>
# include <bits/stdc++.h>
using namespace std;
const pair < int , int > DD[] = {{1,0},{1,1},{0,1},{-1,1},{-1,0},{-1,-1},{0,-1},{1,-1}};
# define fi cin
# define fo cout
# define x first
# define y second
# define ll long long
# define IOS ios_base :: sync_with_stdio(0);cin.tie(0)
# define p(v) cerr << #v << " = " << v << '\n'
# define p2(v) cerr << #v << " = " << (complex < decltype(v.x) > (v.x,v.y)) << '\n'
# define vi vector < int >
# define vl vector < ll >
# define pll pair < ll , ll >
# define pii pair < int , int >
# define mp make_pair
# define db long double
# define fail puts("-1")
# define yes puts("YES")
# define no puts("NO")
# define PP puts("Possible")
# define II puts("Impossible")
# define vii vector < pii >
# define vll vector < pll >
# define pb push_back
# define pdd pair < db , db >
# define all(s) s.begin(),s.end()
template < class T > T smin(T &a,T b) {if (a > b) a = b;return a;}
template < class T > T smax(T &a,T b) {if (a < b) a = b;return a;}
int main(void)
{
    #ifdef CF
    freopen("input","r",stdin);
    #endif // CF
    srand(time(0));
    fo << fixed << setprecision(7);
    cerr << fixed << setprecision(7);
    static vi g[1 << 20];
    int n;
    fi>>n;
    for (int i = 1;i < n;++i)
    {
        int a,b;
        fi>>a>>b;
        g[a].pb(b);
        g[b].pb(a);
    }
    static int S[1 << 20];
    function < void(int,int) > dfs = [&](int node,int prev)
    {
        for (auto it : g[node])
            if (it != prev)
                dfs(it,node),S[node] ^= 1 + S[it];
    };
    dfs(1,0);
    puts(S[1] ? "Alice":"Bob");
    cerr << "Time elapsed :" << clock() * 1000.0 / CLOCKS_PER_SEC << " ms" << '\n';
    return 0;
}


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

int main(){
	// sengen
	int n,m,x;
	// nyuryoku
	cin >> n >> m >> x;
	int c[n],a[n][m];
	for(int i=0;i<n;i++){
		cin >> c[i];
		for(int j=0;j<m;j++){
			cin >> a[i][j];
		}
	}
	// keisan
	long long sum,mins,skill[m];
	sum = 0;
	mins = -1;
	for(int bit = 0;bit < (1<<n);bit++){
		sum = 0;
		for(int i=0;i<m;i++){
			skill[i] = 0;
		}
		for(int i=0;i<n;i++){
			if(bit & (1 << i)){
				sum += c[i];
				for(int j=0;j<m;j++){
					skill[j] += a[i][j];
				}
			}
		}
		for(int i=0;i<m;i++){
			if(skill[i] < x){
				break;
			}
			if(i == m-1){
				if(mins == -1){
					mins = sum;
				}else{
					mins = min(mins,sum);
				}
			}
		}
	}
	// syutsuryoku
	cout << mins;
}

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

void Main()
{
  string S; cin >> S;
  int cnt = 0;
  rep(i,S.size()-1){
    if (S[i] != S[i+1]) cnt++;
  }
  cout << cnt << endl;
}

int main()
{
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(20);
  Main();
  return 0;
}


Measured memory_bytes: 512
#include <iostream>
#include <stdlib.h>
#include <stdio.h>
using namespace std;

struct Process
{
	int time;
	char name[100];
};

#define SIZE 100005
Process Q[SIZE];

class Queue
{
	int putloc;
	int getloc;
public:	
	Queue() { putloc = getloc = 0; }
	bool isEnpty();
	void push(Process p);
	Process pop();
};

void Queue::push(Process p)
{
	if (putloc + 1 == getloc || (putloc == (SIZE - 1) && getloc == 0)) exit(1);
	putloc++;
	if (putloc == SIZE) putloc = 0;
	Q[putloc] = p;
}

Process Queue::pop()
{
	getloc++;
	if (getloc == SIZE) getloc = 0;
	return Q[getloc];
}

bool Queue::isEnpty()
{
	return getloc == putloc;
}

int main()
{
	Queue que;
	Process p;
	int n, q;
	int total = 0;
	cin >> n >> q;

	for (int i = 0; i < n; i++) {
		scanf("%s", p.name);
		scanf("%d" ,&p.time);
		que.push(p);
	}
	while (!que.isEnpty()) {
		p = que.pop();
		if (p.time > q) {
			p.time -= q;
			que.push(p);
			total += q;
		}
		else {
			total += p.time;
			cout << p.name << " " << total << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 11408
s = input()
q = int(input())
for _ in range(q):
    input_list = input().split()
    o = input_list[0]
    a = int(input_list[1])
    b = int(input_list[2])
    if len(input_list) == 4:
        p = input_list[3]
        s = s[:a] + p + s[b+1:]
    elif o == "reverse":
        s = s[:a] + s[a:b+1][::-1] + s[b+1:]
    else:
        print(s[a:b+1])


Measured memory_bytes: 5612
// #include <bits/stdc++.h>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <cmath>
#include <numeric>
#include <set>
#include <queue>
#include <cstdio>
#include <stack>
using namespace std;
#define rep(i, n) for(int i=0;i<n;i++)
#define irep(i, n) for(int i=n-1;i>=0;i--)
#define lrep(i, n) for(long long i=0;i<n;i++)
typedef long long ll;
typedef vector<long long> llv;
typedef vector<vector<long long> > llvv;
template <class T> T gcd(T n, T m){return m ? gcd(m, n%m):n;}

int const N = 200000;

int main(){
    int n;
    cin>>n;
    int a[N+1];
    rep(i,n) cin>>a[i+1];
    int ct = 0;
    vector<int> ans(n+1);
    int count=0;
    for(int i=n;i>n/2;--i){
        ans[i] = a[i];
        if(a[i]==1)count++;
    }
    for(int i=n/2;i>=1;i--){
        int sum=0;
        for (int j=2*i;j<=n;j+=i){
            sum+=ans[j];
        }
        if(sum%2!=a[i]) {
            ans[i] = 1;
            count++;
        }
        else ans[i] = 0;
    }
    cout << count<<endl;
    if(count!=0){
        rep(i,n){
            if(ans[i+1]==1)cout << i+1 << " ";
        } 
    }
    cout << endl;
}

Measured memory_bytes: 2432
#include <bits/stdc++.h>
using namespace std;
int fact(int n)
{
  int f=1;
  for(int i=1;i<=n;i++)
  {
    f*=i;
  }
  return f;
}
    
vector<int>a;
vector<int>b;
vector<int>c;
int main()
{
  int n;
  cin>>n;
  a.resize(n);
  b.resize(n);
  c.resize(n);
  for(int i=0;i<n;i++)cin>>a[i];
  for(int i=0;i<n;i++)cin>>b[i];
  vector<int>a_(n);
  vector<int>b_(n);
  for(int i=0;i<n;i++)
  {
    int p=0;
    while(p!=a[i]-1)
    {
      if(!c[p++])a_[i]++;
    }
    c[a[i]-1]=1;
  }
  for(int i=0;i<n;i++)c[i]=0;
  for(int i=0;i<n;i++)
  {
    int p=0;
    while(p!=b[i]-1)
    {
      if(!c[p++])b_[i]++;
    }
    c[b[i]-1]=1;
  }
  int sum=0;
  for(int i=0;i<n;i++)
  {
    sum+=(a_[i]-b_[i])*fact(n-1-i);
  }
  cout<<abs(sum)<<endl;
  return 0;
}	



Measured memory_bytes: 256