akhauriyash/Code-Regression huggingface dataset:
import java.util.Scanner;
import java.util.*;

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

        for(int i=0; i<16; i++){
            for(int j=0; j<26; j++){
                if(7*i + 4*j == n ){
                    ans ="Yes";
                }
            }
        }

        System.out.println(ans);

    }
}


Measured memory_bytes: 22996
#if 1
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <stack>
#include <array>
#include <deque>
#include <algorithm>
#include <utility>
#include <cstdint>
#include <functional>
#include <iomanip>
#include <numeric>
#include <assert.h>
#include <bitset>
#include <list>

auto& in = std::cin;
auto& out = std::cout;
#define all_range(C) std::begin(C), std::end(C)
const double PI = 3.141592653589793238462643383279502884197169399375105820974944;


template<typename T, typename U>
std::enable_if_t<std::rank<T>::value == 0> fill_all(T& arr, const U& v) {
	arr = v;
}
template<typename ARR, typename U>
std::enable_if_t<std::rank<ARR>::value != 0> fill_all(ARR& arr, const U& v) {
	for (auto& i : arr) {
		fill_all(i, v);
	}
}

int32_t N;
constexpr int64_t MOD = 1000000000+7;
constexpr int64_t INF = 30001000000000555;
int64_t A[3100];
int64_t func(int i, int k);

int64_t dp2[100][100010];
//[]
int64_t func2(int i, int k)
{
	if (i == N) { return k==0?1:0; }
	if (k < 0) { return 0; }

	auto& memo = dp2[i][k];
	if (memo != INF) {
		return memo;
	}
	if (k == 0) {
		return memo = (func(i + 1, k));
	}
	return memo = (func(i + 1, k) + func2(i, k - 1)) % MOD;
}


int64_t dp[100][100010];
//[]
int64_t func(int i, int k)
{
	if (i == N) { return k == 0 ? 1 : 0; }

	auto& memo = dp[i][k];
	if (memo != INF) {
		return memo;
	}
	
	return memo = (func2(i, k) + (MOD - func2(i, k - A[i] - 1)))%MOD;
	//for (int kk = k; kk >= k-A[i]; --kk)
	//{

	//}

}


int main()
{
	using std::endl;
	in.sync_with_stdio(false);
	out.sync_with_stdio(false);
	in.tie(nullptr);
	out.tie(nullptr);
	fill_all(dp, INF);
	fill_all(dp2, INF);
	int64_t K;
	in >> N >> K;
	for (size_t i = 0; i < N; i++)
	{
		in >> A[i];
	}

	out << func(0, K) << endl;

	return 0;
}
#endif


Measured memory_bytes: 161280
import java.io.InputStream;
import java.io.PrintStream;
import java.util.Scanner;
import java.util.stream.LongStream;

public class Main {

  public static void main(String[] args) {
    resolve(System.in, System.out);
  }

  static void resolve(InputStream is, PrintStream pw) {
    Scanner sc = new Scanner(is);
    long n = Long.parseLong(sc.next());
    long k = Long.parseLong(sc.next());
    ModInt ans = new ModInt(0, 1000000000 + 7);
    long min = LongStream.range(0, k - 1).sum();
    long max = LongStream.rangeClosed(n - k + 2, n).sum();
    for (long i = k; i <= n + 1; i++) {
      min += i - 1;
      max += (n - i + 1);
      ans = ans.add(max - min + 1);
    }
    pw.println(ans);
  }


  static class ModInt {

    final long mod;
    long x;

    ModInt(long x, long mod) {
      this.x = x;
      this.mod = mod;
    }

    ModInt(ModInt m) {
      this.x = m.x;
      this.mod = m.mod;
    }

    ModInt add(long m) {
      this.x += m;
      this.x %= mod;
      return this;
    }

    ModInt add(ModInt m) {
      return this.add(m.x);
    }

    ModInt minus(long m) {
      ModInt n = new ModInt(this);
      if ((n.x += (mod - m)) >= mod) {
        n.x -= mod;
      }
      return n;
    }

    ModInt minus(ModInt m) {
      return this.minus(m.x);
    }

    ModInt multiplicity(long m) {
      ModInt n = new ModInt(this);
      n.x *= m;
      n.x %= mod;
      return n;
    }

    ModInt pow(long p) {
      if (p == 0) {
        return new ModInt(1, mod);
      }
      ModInt a = pow(p >> 1);
      a = a.multiplicity(a.x);
      if ((p & 1) == 1) {
        a = a.multiplicity(x);
      }
      return a;
    }

    ModInt inv() {
      return pow(mod - 2);
    }

    ModInt divide(ModInt d) {
      ModInt n = new ModInt(this);
      n = n.multiplicity(d.inv().x);
      return n;
    }

    @Override
    public String toString() {
      return String.valueOf(x);
    }
  }
}


Measured memory_bytes: 36048
#include<iostream>
#include<string>
#include<vector>
#include<set>
#include<numeric>
using namespace std;

int main(void)
{
    int N;
    cin >> N;
    int c0 = 0;
    int c1 = 0;
    int c2 = 0;
    int c3 = 0;
    for(int i=0; i<N; ++i){
        string s;
        cin >> s;
        if(s == "AC"){
            ++c0;
        }
        else if(s == "WA"){
            ++c1;
        }
        else if(s == "TLE"){
            ++c2;
        }
        else{
            ++c3;
        }
    }
    cout << "AC x " << c0 << endl;
    cout << "WA x " << c1 << endl;
    cout << "TLE x " << c2 << endl;
    cout << "RE x " << c3 << endl;

    return 0;
}



Measured memory_bytes: 3224
N = int(input())
A=[]
hantei = True
for i in range(N):
  A+=[str(input())]
L=[A[0]]
for i in range(1,N):
  if A[i] in L:
    hantei = False
    break
  if A[i-1][-1]!=A[i][0]:
    hantei= False
    break
  L +=[A[i]]
print('Yes' if hantei else'No')

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

int main() {
	int a, b, c; cin >> a >> b >> c;

	if (a == 5 && b == 5 && c == 7 || a == 5 && b == 7 && c == 5 || a == 7 && b == 5 && c == 5) {
		cout << "YES";
	}
	else { cout << "NO"; }

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define y1 __zzd001
using namespace std;
int read(){
	int x=0;
	char ch=getchar();
	while (!isdigit(ch))
		ch=getchar();
	while (isdigit(ch))
		x=(x<<1)+(x<<3)+(ch^48),ch=getchar();
	return x;
}
const int N=2005;
int n,m,q;
int g[N][N],s1[N][N],s2[N][N],s3[N][N];
int main(){
	n=read(),m=read(),q=read();
	for (int i=1;i<=n;i++)
		for (int j=1;j<=m;j++){
			scanf("%1d",&g[i][j]);
			s1[i][j]=s1[i][j-1]+s1[i-1][j]-s1[i-1][j-1]+g[i][j];
			s2[i][j]=s2[i][j-1]+(g[i][j]&&g[i-1][j])
					+s2[i-1][j]-s2[i-1][j-1];
			s3[i][j]=s3[i][j-1]+(g[i][j]&&g[i][j-1])
					+s3[i-1][j]-s3[i-1][j-1];
		}
	while (q--){
		int x1=read(),y1=read(),x2=read(),y2=read();
		int ans=s1[x2][y2]-s1[x2][y1-1]-s1[x1-1][y2]+s1[x1-1][y1-1];
		ans-=s2[x2][y2]-s2[x2][y1-1]-s2[x1][y2]+s2[x1][y1-1];
		ans-=s3[x2][y2]-s3[x2][y1]-s3[x1-1][y2]+s3[x1-1][y1];
		printf("%d\n",ans);
	}
	return 0;
}

Measured memory_bytes: 64640
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

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

  public void run() {
    
    try(BufferedReader in = new BufferedReader(new InputStreamReader(System.in))) {

      String line = in.readLine();
      int fd = Character.getNumericValue(line.charAt(0));

      int up = 0;
      for (int i = line.length()-1; i > 0; i--) {
        int digit = Character.getNumericValue(line.charAt(i));
        if(digit + up > fd) {
          up = 1;
        }
        else {
          up = 0;
        }
      }

      int cd=Character.getNumericValue(line.charAt(1));
      if(fd < cd + up)
        fd++;

      StringBuffer buf = new StringBuffer();
      for(int i=0; i<line.length(); i++)
        buf.append(fd);


      System.out.println(buf);
    }
    catch(IOException e) {
      System.err.println(e);
    }
  }
}

Measured memory_bytes: 21332
a = input().split(' ')
for i in range(len(a)):
    a[i] = int(a[i])
b=[]
c=0
d=0
for i in range(a[0],a[1]+1):
    b.append(i)
    if a[2]%b[d] == 0:
        c += 1
    d += 1
print(c)

    


Measured memory_bytes: 5908
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using ld = long double;
long double const pi = std::acos(-1.0L);
typedef pair<int,int> P;
const int INF = 1001001001;


int main() {
  int n;
  cin >> n;
  vector<ll> a(n);
  rep(i,n) {
    cin >> a[i];
    if(a[i]==0) {
      cout << 0 << endl;
      return 0;
    } 
  }
  ll sum = 1;
  rep(i,n){
    if(a[i]>1000000000000000000/sum){
      cout << -1 << endl;
      return 0;
    }
    sum*=a[i];
  }
  cout << sum << endl;
  return 0;
}


Measured memory_bytes: 4052
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{

	ios_base::sync_with_stdio(0);
	cout.tie(0);
	cin.tie(0);

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

	string s;
	cin>>s;
	int q,c=0;
	cin>>q;
	stack<char>s1,s2;
	while(q--)
	{
		int a;
		cin>>a;
		if(a==1)
			c++;
		else
		{
			int b;
			char c1;
			cin>>b>>c1;
			if(b==1)
			{
				if(c%2)
					s2.push(c1);
				else
					s1.push(c1);
			}
			else
			{
				if(c%2)
					s1.push(c1);
				else
					s2.push(c1);
			}

		}
	}
	if(c%2)
	{
		stack<char>s3;
		while(!s2.empty())
		{
			cout<<s2.top();
			s2.pop();
		}
		reverse(s.begin(),s.end());
		cout<<s;
		while(!s1.empty())
		{
			s3.push(s1.top());
			s1.pop();
		}
		while(!s3.empty())
		{
			cout<<s3.top();
			s3.pop();
		}
	}
	else
	{
		stack<char>s3;
		while(!s1.empty())
		{
			cout<<s1.top();
			s1.pop();
		}
		cout<<s;
		while(!s2.empty())
		{
			s3.push(s2.top());
			s2.pop();
		}
		while(!s3.empty())
		{
			cout<<s3.top();
			s3.pop();
		}
	}
	
}


Measured memory_bytes: 848
H, W = map(int, input().split())
allwhite = [True]*W
M = []
for _ in range(H):
    s = input()
    if s.count('.')==W: continue
    M.append(s)
    for w,c in enumerate(s):
        allwhite[w] *= c=='.'
    

for s in M:
    for c,f in zip(s, allwhite):
        if not f: print(c, end='')
    print()
        


Measured memory_bytes: 4340
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt(), b =sc.nextInt();
        int ans = Math.max(a+b, Math.max(a*2-1, b*2-1));
        System.out.println(ans);
    }
}


Measured memory_bytes: 22740
#include<bits/stdc++.h>
#define forr(i, a, b) for(int i = (a); i < (b); i++)
#define rep(i,n) for(int i = 0; i < (n); i++)
#define rrep(i,n) for(int i = 1; i <= (n); i++)
#define ALL(a) (a.begin()),(a.end())
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<ll, ll> LP;
const ll LINF = 1LL<<60;
const int INF = 1001001001;

/* --------------------------------------------------- */

int main() {
    int m, d;
    cin >> m >> d;
    int ans = 0;
    rrep(i, m) {
        rrep(j, d) {
            int d1 = j % 10;
            int d10 = j / 10;
            if(!(d1 >= 2 && d10 >= 2)) continue;
            if(i == d1 * d10) ans++;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3612
#include<iostream>
#include<string>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<algorithm>
#include<vector>
#include<functional>
#include<iomanip>
#include<queue>
#include<cassert>
#include<tuple>
#include<set>
#include<map>
#include<list>
#include<bitset>

#define PB push_back
#define ALL(a)  (a).begin(),(a).end()
#define DWN(a)  (a).begin(),(a).end(), greater<int>()
#define rep(i, m) for (int i = 0; i < m; i++)
#define REP(i, n, m) for (int i = n; i < m; i++)

#define mod 1000000007

using namespace std;

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

const int dx[4] = { 1, 0, -1, 0 };
const int dy[4] = { 0, 1, 0, -1 };
const int INF = (int)1e9;

int dp[100010];
bool prime[1000000];

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

	memset(prime, true, sizeof(prime));
	prime[0] = prime[1] = false;
	for (int i = 2; i * i <= 1000000; i++) {
		if (prime[i]) {
			for (int j = 2 * i; j <= 1000000; j += i) {
				prime[j] = false;
			}
		}
	}

	for (int i = 1; i < 100010; i++) {
		if (i % 2 && prime[i] && prime[(i + 1) / 2]) {
			dp[i] = 1;
		}
	}

	for (int i = 1; i < 100010; i++) dp[i] += dp[i - 1];

	for (int i = 0; i < q; i++) {
		int l, r;
		cin >> l >> r;
		cout << dp[r] - dp[l - 1] << endl;
	}

	return 0;
}

Measured memory_bytes: 2048
#include <bits/stdc++.h>
using namespace std;
using LL = long long;
using PII = pair<int, int>;
using VI = vector<int>;

int main() {
#ifdef LOCAL_EXEC
//	freopen("sample.in", "r", stdin);
//	freopen("sample.out", "w", stdout);
#else
  ios_base::sync_with_stdio(false); cin.tie(NULL);
#endif

  char ch; cin >> ch;
  ++ch;
  cout << ch << endl;

  return 0;
}


Measured memory_bytes: 256
N, C = gets.split.map &:to_i
X, V = $<.map{|s|s.split.map &:to_i}.transpose
Vcusum = [sum = 0] + V.map{|v| sum += v }
RVcusum = [sum = 0] + V.reverse.map{|v| sum += v }
RX = X.reverse.map{|x| C - x }

max_idx = 0
max = 0
Vtbl = (0...N).map{|i|
  t = Vcusum[i+1]-X[i]
  if t > max
    max = t
    max_idx = i
  end
  max_idx
}

max_idx = 0
max = 0
RVtbl = (0...N).map{|i|
  t = RVcusum[i+1]-RX[i]
  if t > max
    max = t
    max_idx = i
  end
  max_idx
}

rl = (0...N).map{|i|
  t = Vcusum[i+1]-X[i]
  j = RVtbl[N-i-2]
  i == N-1 ? t : t + [0, -X[i] + RVcusum[j+1]-RX[j]].max
}.max
lr = (0...N).map{|i|
  t = RVcusum[i+1]-RX[i]
  j = Vtbl[N-i-2]
  i == N-1 ? t : t + [0, -RX[i] + Vcusum[j+1]-X[j]].max
}.max
p [rl, lr, 0].max


Measured memory_bytes: 20536
#include<bits/stdc++.h>
#define ll long long int
#define M 1000000007
using namespace std;
ll n,t,x,y,m,q;

int main(){
      ios_base::sync_with_stdio(false); cin.tie(NULL);
      cin>>n;
      ll cnt=0,f=0;
      for(int i=0;i<n;i++){
        cin>>x>>y;
        if(x==y)cnt+=1;
        else cnt=0;
        if(cnt==3)f=1;
      }
      if(f)cout<<"Yes";
      else cout<<"No";
}

Measured memory_bytes: 3648
import sys
class Dice:
    def __init__(self):
        #self.ms = ms
        self.number = [i for i in range(6)]
        self.dev = [i for i in range(6)]
    
    def set_num(self,n0,n1,n2,n3,n4,n5):
        self.number[0] = n0
        self.number[1] = n1
        self.number[2] = n2
        self.number[3] = n3
        self.number[4] = n4
        self.number[5] = n5
   
    def dice_roll(self,event):
        for i in range(6):
            self.dev[i] = self.number[i]
        #0:上,1:南,2:東,3:西,4:北,5:下
        if event == "S":
            self.set_num(self.dev[4],self.dev[0],self.dev[2],self.dev[3],self.dev[5],self.dev[1])
        if event == "N":
            self.set_num(self.dev[1],self.dev[5],self.dev[2],self.dev[3],self.dev[0],self.dev[4])
        if event == "E":
            self.set_num(self.dev[3],self.dev[1],self.dev[0],self.dev[5],self.dev[4],self.dev[2])
        if event == "W":
            self.set_num(self.dev[2],self.dev[1],self.dev[5],self.dev[0],self.dev[4],self.dev[3])
    
    def get_top(self):
        #for i in range(len(self.number)):
            #print(self.number[i])
        #sys.exit()
        return self.number[0]

ms = list(map(int,input().split()))
dice = Dice()
dice.set_num(ms[0],ms[1],ms[2],ms[3],ms[4],ms[5])
events = list(str(input()))
for event in events:
    dice.dice_roll(event)

print(dice.get_top())


Measured memory_bytes: 5612
//template code, C343, 2019
import java.util.LinkedList;
import java.util.Scanner;
import java.util.Iterator;

class Graph {
	private int totalVertex;
	private LinkedList<LinkedList<Integer>> adjList;
	//adjacency list of edges
	public Graph() { totalVertex = 0; }
	public void loadAdjList() {
		Scanner in = new Scanner(System.in);
		totalVertex = in.nextInt();
		adjList = new LinkedList<LinkedList<Integer>>();
		for(int i = 0; i < totalVertex; i ++) {
			LinkedList<Integer> tmp = new LinkedList<Integer>();
			int idx1 = in.nextInt() - 1;
			int degree = in.nextInt();
			//System.out.println("mark idx1 = " + idx1 + " degree = " + degree);
			for(int j = 0; j < degree; j ++) {
				int idx2 = in.nextInt() - 1;
				tmp.add(idx2);
			}	
			adjList.add(tmp);
		}
		in.close();
	}
	
	public void BFS(int vertex) {
        boolean visited[] = new boolean[totalVertex];
        int distance = 0;
        int[] dist = new int[totalVertex];
        
        LinkedList<Integer> queue = new LinkedList<Integer>(); 
        
        visited[vertex]=true; 
        queue.add(vertex); 
        dist[vertex] = distance;
        
        while (queue.size() != 0) { 
            vertex = queue.poll(); 
             
            
            
            Iterator<Integer> i = adjList.get(vertex).listIterator(); 
            while (i.hasNext()) { 
                int n = i.next(); 
                if (!visited[n]) { 
                    visited[n] = true;
                    dist[n] = dist[vertex] + 1;
                    queue.add(n); 
                } 
            }
        }
        
        for (int i = 0; i < dist.length; i++) {	
        	if (visited[i] == false) {
        		System.out.print((i + 1) + " " + -1 + "\n");
        	} else {
        		System.out.print((i + 1) + " " + dist[i] + "\n");
        	}
        }
	}
	
}

//change class name GraphRepresentation to Main() for submission to AIZU
public class Main {
	public static void main(String argv[]) {
		Graph g = new Graph();
		g.loadAdjList();
		
//		g.printAdjMatrix();
		g.BFS(0);
	}
}



Measured memory_bytes: 28192
#include <bits/stdc++.h>
#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 INF 2e9
#define ALL(v) (v).begin(), (v).end()
using namespace std;
typedef long long ll;
int GCD(int a,int b){return b?GCD(b,a%b):a;}
int LCM(int a,int b){return (a*b)/GCD(a,b);}
int abs(int x){return x>0?x:-x;}
 
//const int dx[] = {1, 0, -1, 0, 1, -1, -1, 1};
//const int dy[] = {0, 1, 0, -1, 1, 1, -1, -1};

int main()
{
	int x;
	cin >> x;
	if (x == 7 or x == 5 or x == 3){
		cout << "YES" << endl;
	}
	else {
		cout << "NO" << endl;
	}
}


Measured memory_bytes: 256
import sys
from collections import deque


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


def main():
    INF = 10**7
    h, w = [int(i) for i in input().split()]
    c_h, c_w = [int(i) for i in input().split()]
    d_h, d_w = [int(i) for i in input().split()]
    grid = [["#"] * (w + 2)]
    for _ in range(h):
        line = ["#"] + list(input()) + ["#"]
        grid.append(line)
    grid.append(["#"] * (w + 2))
    warp_count = [[INF] * (w + 2) for _ in range(h + 2)]
    directions = ((1, 0), (-1, 0), (0, 1), (0, -1))
    warps = []
    for x in range(-2, 3):
        for y in range(-2, 3):
            if x == 0 and y == 0:
                continue
            if (x, y) not in directions:
                warps.append((x, y))

    stack = deque()
    warp_count[c_h][c_w] = 0
    stack.append((c_h, c_w, 0))

    while stack:
        _h, _w, warp = stack.pop()
        if warp > warp_count[_h][_w]:
            continue
        warp_count[_h][_w] = warp

        # walk
        for _a, _b in directions:
            if grid[_h + _a][_w + _b] != "#" and warp_count[_h + _a][_w + _b] > warp:
                stack.append((_h + _a, _w + _b, warp))

        # warp
        for x, y in warps:
            if _h + x < 0 or _h + x > h or _w + y < 0 or _w + y > w:
                continue
            elif grid[_h + x][_w + y] == "#":
                continue
            if warp_count[_h + x][_w + y] > warp + 1:
                stack.appendleft((_h + x, _w + y, warp + 1))

    if warp_count[d_h][d_w] == INF:
        print(-1)
    else:
        print(warp_count[d_h][d_w])
    return


if __name__ == "__main__":
    main()


Measured memory_bytes: 235760
import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;
 


public class Main {
	private static Scanner sc = new Scanner(System.in);
	//result = Math.pow(num1, num3)
	//StringBuffer str = new StringBuffer(hoge1);
	//String hoge2 = str.reverse().toString();
	//map.containsKey(A)

	//Map<String, Integer> map = new HashMap<String, Integer>(n);
	/*for ( キーのデータ型 key : マップの名前.keySet() ) {
		データのデータ型 data = マップの名前.get( key );
		
		// keyやdataを使った処理;
	}*/
	//int i = Integer.parseInt(s);
	//Queue<String> qq=new ArrayDeque<>(); //add,poll,peek
	//Deque<String> qq=new ArrayDeque<>();//push,pop,peek
	//ArrayList<String> cc = new ArrayList<>(n);
	//Collections.sort(list);
	//Array.sort(list);   cc.contains(tmp)
	//Arrays.asList(c).contains("a")
	//list.set(1,"walk");//1 1 2 3 5
	//static long mod =1000000007;
	//static 	ArrayList<Integer> cc = new ArrayList<>(100);
	
	
	
	public static void main(String[] args) {
		//int N=sc.nextInt();for(int i=0;i<N;i++) {}
		//M 77 || //A 65 || //R 82 || //C 67 || //H 72 || 
		StringBuffer S = new StringBuffer(sc.next());
		
		StringBuffer Su = new StringBuffer();
		
		int Q=Integer.parseInt(sc.next());
		
		int t,f;
		String C;
		boolean x=true;
		for(int i=0;i<Q;i++) {
			t=Integer.parseInt(sc.next());
			if(t==1) {
				if(x)x=false;
				else x=true;
				
			}else {
				f=Integer.parseInt(sc.next());
				C=sc.next();
				if(f==1) {
					if(x) {
						Su.append(C);
					}else {
						S.append(C);
					}
				}else {
					if(x) {
						S.append(C);
					}else {
						Su.append(C);
					}
				}
				
				
			}

		}
		Su.reverse();
		S.insert(0, Su);
		if(x) {
			p(S.toString());
		}else {
			S.reverse();
			p(S.toString());
		}

		
	
		
		
	}



	
	
	
	

	


	
	static void p(String ans) {System.out.println(ans);};
	static void p(int ans) {System.out.println(ans);};
	static void p() {System.out.println();};
	static void p(long ans) {System.out.println(ans);};
	static void p(double ans) {System.out.println(ans);};
	
}
	


Measured memory_bytes: 90940
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n=sc.nextInt();
		long be=sc.nextLong(),buff;
		long count=0,max=0;

		for(int i=1;i<n;i++) {
			buff=sc.nextInt();
			if(buff<=be) {
				count++;
			}else {
				max=Math.max(max, count);
				count=0;
			}
			be=buff;
		}

		System.out.println(Math.max(max, count));
	}
}



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

#define endl '\n'
#define lfs cout<<fixed<<setprecision(10)
#define ALL(a)  (a).begin(),(a).end()
#define ALLR(a)  (a).rbegin(),(a).rend()
#define spa << " " <<
#define test cout<<"test"<<endl;
#define fi first
#define se second
#define MP make_pair
#define MT make_tuple
#define PB push_back
#define EB emplace_back
#define rep(i,n,m) for(ll i = (n); i < (ll)(m); i++)
#define rrep(i,n,m) for(ll i = (m) - 1; i >= (ll)(n); i--)
using ll = long long;
using ld = long double;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const ll INF = 1e18;
using P = pair<ll, ll>;
template<typename T>
void chmin(T &a,T b){if(a>b)a=b;}
template<typename T>
void chmax(T &a,T b){if(a<b)a=b;}
void pmod(ll &a,ll b){a=(a+b)%MOD;}
void pmod(ll &a,ll b,ll c){a=(b+c)%MOD;}
void qmod(ll &a,ll b){a=(a*b)%MOD;}
void qmod(ll &a,ll b,ll c){a=(b*c)%MOD;}
ll median(ll a,ll b, ll c){return a+b+c-max({a,b,c})-min({a,b,c});}
void ans1(bool x){if(x) cout<<"Yes"<<endl;else cout<<"No"<<endl;}
void ans2(bool x){if(x) cout<<"YES"<<endl;else cout<<"NO"<<endl;}
void ans3(bool x){if(x) cout<<"Yay!"<<endl;else cout<<":("<<endl;}
template<typename T1,typename T2>
void ans(bool x,T1 y,T2 z){if(x)cout<<y<<endl;else cout<<z<<endl;}  
template<typename T>
void debug(vector<vector<T>>&v,ll h,ll w){for(ll i=0;i<h;i++)
{cout<<v[i][0];for(ll j=1;j<w;j++)cout spa v[i][j];cout<<endl;}};
void debug(vector<string>&v,ll h,ll w){for(ll i=0;i<h;i++)
{for(ll j=0;j<w;j++)cout<<v[i][j];cout<<endl;}};
template<typename T>
void debug(vector<T>&v,ll n){if(n!=0)cout<<v[0];
for(ll i=1;i<n;i++)cout spa v[i];cout<<endl;};
template<typename T>
vector<vector<T>>vec(ll x, ll y, T w){
  vector<vector<T>>v(x,vector<T>(y,w));return v;}
ll gcd(ll x,ll y){ll r;while(y!=0&&(r=x%y)!=0){x=y;y=r;}return y==0?x:y;}
vector<ll>dx={1,0,-1,0,1,1,-1,-1};
vector<ll>dy={0,1,0,-1,1,-1,1,-1};
template<typename T>
vector<T> make_v(size_t a,T b){return vector<T>(a,b);}
template<typename... Ts>
auto make_v(size_t a,Ts... ts){
  return vector<decltype(make_v(ts...))>(a,make_v(ts...));
}
ostream &operator<<(ostream &os, pair<ll, ll>&p){
  return os << p.first << " " << p.second;
}  
int main(){
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  ll res=0,buf=0;
  bool judge = true;
  res=INF;
  ll n;cin>>n;
  vector<ll>a(n),b(n);
  rep(i,0,n)cin>>a[i];
  rep(i,0,n)cin>>b[i];
  rep(i,0,1<<n){
    vector<ll>t(n);
    bitset<18>x=i;
    rep(j,0,n){
      if(x[j])t[j]=b[j];
      else t[j]=a[j];
    }
    auto s=t;sort(ALL(s));
    vector<ll>idx(n,-1);
    judge=true;
    rep(j,0,n){
      rep(o,0,n){
        if(t[j]==s[o]&&x[j]==abs(o-j)%2&&idx[o]==-1){
          idx[o]=j;
          break;
        }
        if(o==n-1)judge=false;
      }
    }
    if(judge){
      ll cnt=0;
      rep(i,0,n)rep(j,i+1,n)if(idx[i]>idx[j])cnt++;
      chmin(res,cnt);
    }
  }
  ans(res==INF,-1,res);
  return 0;
}

Measured memory_bytes: 384
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define reps(i, n) for (int i = 1; i <= (n); ++i)
#define repd(i, n) for (int i = (n)-1; i >= 0; --i)
#define repds(i, n) for (int i = (n); i > 0; --i)
#define loop(i, x, n) for (int i = (x); i < (n); ++i)
#define loops(i, x, n) for (int i = (x); i <= (n); ++i)
#define loopd(i, x, n) for (int i = (x); i > (n); --i)
#define loopds(i, x, n) for (int i = (x); i >= (n); --i)
#define itrep(i, a) for (auto i = begin(a); i != end(a); ++i)
#define itrepd(i, a) for (auto i = rbegin(a); i != rend(a); ++i)
#define each(i, x) for (auto &&i : x)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define sz(a) ((int)a.size())
#define pow2(n) (n * n)
#define int ll
using namespace std;
using ll = long long;
using ld = long double;
using ull = unsigned long long;
template <class T>
using p_queue = priority_queue<T, vector<T>, greater<T>>;
constexpr ll inf = static_cast<ll>(1e18);
constexpr int iinf = static_cast<int>(1e9);
constexpr double dinf = 1e10;
constexpr ld ldinf = 1e18;
constexpr double eps = 1e-8;
ll mod = static_cast<ll>(1e9 + 7);
template <class T, class... Args>
constexpr void mins(T &a, Args... args) { a = min<T>({a, args...}); }
template <class T, class... Args>
constexpr void maxs(T &a, Args... args) { a = max<T>({a, args...}); }
template <class F>
class FixPoint : private F {
public:
    explicit constexpr FixPoint(F &&f) : F(std::forward<F>(f)) {}
    template <class... Args>
    constexpr decltype(auto) operator()(Args &&... args) const { return F::operator()(*this, std::forward<Args>(args)...); }
};
template <class F>
constexpr decltype(auto) funcs(F &&f) { return FixPoint<F>{std::forward<F>(f)}; }
template <class T>
std::vector<T> vecs(int n, T &&val) { return std::vector<T>(std::forward<int>(n), std::forward<T>(val)); }
template <class... Args>
decltype(auto) vecs(int n, Args &&... args) { return std::vector<decltype(vecs(std::forward<Args>(args)...))>(std::forward<int>(n), vecs(std::forward<Args>(args)...)); }
template <class V, class T>
void fill(V &x, const T &val) { x = val; }
template <class V, class T>
void fill(vector<V> &vec, const T &val) {
    for (auto &&v : vec)
        fill(v, val);
}

void solve() {
    int k;
    cin >> k;
    string s;
    rep(i, k) s += "ACL";
    cout << s << endl;
}

signed main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    solve();
    cout.flush();
    return 0;
}

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

int main(){
  int l, r, d, c;
  c = 0;
  cin >> l >> r >> d;
  for(int i = l; i <= r; i++){
    if((i % d) == 0){
      c++;
    }
  }
  cout << c << endl;
}

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

public class Main {
    static MyReader in = new MyReader();

    public static void main(String[] args) {
        int N = in.i();
        int x = in.i();
        long ans = 0;
        int a = in.i();
        for (int i = 1; i < N; i++) {
            int b = in.i();
            int d = a + b - x;
            if (d > 0) {
                ans += d;
                b = Math.max(0, b - d);
            }
            a = b;
        }
        System.out.println(ans);
    }
}

class MyReader extends BufferedReader {
    char[] cbuf = new char[1024];
    int head = 0;
    int tail = 0;

    MyReader() {
        super(new InputStreamReader(System.in));
    }

    char next() {
        if (head == tail) {
            try {
                tail = super.read(cbuf, 0, cbuf.length);
            } catch (IOException e) {
                e.printStackTrace();
            }
            head = 0;
        }
        return cbuf[head++];
    }

    int i() {
        int k = next() - '0';
        boolean minus = k == -3;
        int n = minus ? 0 : k;
        while (0 <= (k = next() - '0') && k <= 9) n = 10 * n + k;
        return minus ? -n : n;
    }

    int[] ii(final int N) {
        int[] a = new int[N];
        for (int j = 0; j < a.length; j++) a[j] = i();
        return a;
    }

    long l() {
        int k = next() - '0';
        boolean minus = k == -3;
        long n = minus ? 0 : k;
        while (0 <= (k = next() - '0') && k <= 9) n = 10 * n + k;
        return minus ? -n : n;
    }

    char[] s(final int N) {
        char[] s = new char[N];
        for (int i = 0; i < N; i++) {
            s[i] = next();
        }
        next();
        return s;
    }

    public int read(char[] cbuf) {
        int i;
        char c;
        for (i = 0; (c = next()) != ' ' && c != '\n'; i++) cbuf[i] = c;
        return i;
    }

    public String readLine() {
        try {
            return super.readLine();
        } catch (IOException e) {
            return null;
        }
    }
}


Measured memory_bytes: 35176
module.exports=function(e){var r={};function t(n){if(r[n])return r[n].exports;var o=r[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,t),o.l=!0,o.exports}return t.m=e,t.c=r,t.d=function(e,r,n){t.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:n})},t.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},t.t=function(e,r){if(1&r&&(e=t(e)),8&r)return e;if(4&r&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(t.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var o in e)t.d(n,o,function(r){return e[r]}.bind(null,o));return n},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},t.p="",t(t.s=0)}([function(e,r,t){t(1)(t(2).readFileSync("/dev/stdin","UTF-8").split("\n"))},function(e,r){e.exports=function(e){for(var r=e[0],t=r.length,n=Number(e[1]),o=new Set,u=0;u<t;u++)for(var i=u;i<Math.min(t,u+n);i++)o.add(r.slice(u,i+1));var f=Array.from(o).sort();console.log(f[n-1])}},function(e,r){e.exports=require("fs")}]);

Measured memory_bytes: 11304
#include <iostream>

using namespace std;

int main()
{
    int a[3];
    int b[3];
    int i,j;
    int su=0;
    bool in;

    for(i=0;i<3;i++)
        cin >> a[i];

    for(i=0;i<3;i++)
    {   in=false;
        for(j=i+1;j<3;j++)
        {
            if(a[i]==a[j])
            {
                in=true;
            }
        }
        if(in!=true)
        {
            su++;
        }


    }

    cout << su ;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define all(v) (v).begin(),(v).end()
#define f first
#define s second
using namespace std;


int main(){
    ios_base::sync_with_stdio(false); cin.tie(NULL);
    string str; cin >> str;
    while(str.size() != 1){
        long long int res = 0;
        for(int i=0;i<str.size();++i)
            res += stoi(string(1,str[i]));
        str = to_string(res);
        // cout << str << '\n'; 
    }
    if(stoi(str)%9 == 0) cout << "Yes\n";
    else cout << "No\n";
    return 0;
}

Measured memory_bytes: 3836
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define erep(i, n) for (ll i = 0; i <= (ll)(n); ++i)
#define FOR(i,a,b) for (ll i = (a); i < (ll)(b); ++i)
#define EFOR(i,a,b) for (ll i = (a); i <= (ll)(b); ++i)
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } }

#include <iostream>
#include <vector>
#include <queue>
using namespace std;
using Graph = vector<vector<int>>;
using P = pair<int, int>;

ll modnum = 1000000007;


long long modinv(long long a, long long m) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}



int main() {
    ll n,x,y; cin >> n >> x >> y;
    vector<int> ans(n,0);
    EFOR(i,1, n) EFOR(j,i, n) {
        ans[min(abs(j-i), min(abs(x-i)+1+abs(j-y), abs(y-i)+1+abs(j-x)))]++;
    }


    rep(i,n-1) {
        cout << ans[i+1] <<  endl;
    }

    return 0;
}


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

using namespace std;
using ll = long long;
const ll MOD = 1e9 + 7;

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

    cout << s;
    if(s.at(s.size()-1) == 's') {
        cout << 'e';
    }
    cout << 's' << endl;

    return 0;
}

Measured memory_bytes: 3608
#include <iostream>
#include <cmath>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <algorithm>

typedef long long ll;

using namespace std;

int main() {
    string N;
    cin >> N;
    cout << (N[0] == '7' || N[1] == '7' || N[2] == '7' ? "Yes" : "No") << endl;
    return 0;
}



Measured memory_bytes: 3628
#include <bits/stdc++.h>
typedef long long int ll;
using namespace std;
int main(){
	ios_base::sync_with_stdio(false);  
	cin.tie(NULL);
	ll arr[1001];arr[0] = 0;
	for(ll i=1;i<=1000;i++){
		arr[i] = pow(i,5);
	}
	ll x;cin>>x;
	ll a=0; ll b=0;bool flag = false;
	for(int i=1;i<1001;i++){
		ll k = arr[i] - x;
		if(k==0){
			a = i; b = 0;	
			flag = true;
		}
		else{
			for(int j=1;j<1001;j++){
				if(arr[j]==abs(k)){
					a = i;
					if(k>0){
						b = j;
					}
					else{
						b = -j;
					}
					flag = true; break;
				}
			}
		}
		if(flag==true){
			break;
		}
	}
	cout<<a<<" "<<b<<endl;
}

Measured memory_bytes: 4140
#include <bits/stdc++.h>
using namespace std;
#define int long long int

#define vi vector<int>
 
#define ff first
#define ss second
 
#define pb push_back
#define MOD 1000000007
//const int nax = 1e6+5;
#define inf 4e18
 
#define display(v) for(int i =0;i<v.size();++i)cout << v[i] << " "
#define all(v) v.begin(),v.end()
int sqr(int x){return x*x;}
inline int add(int a, int b){ int c = a + b; if(c >= MOD) c -= MOD; return c; }
inline int mul(int a, int b){ return (a * 1ll * b) % MOD; }
inline int sub(int a, int b){ int c = a - b; if(c < 0) c += MOD; return c; }
const int nax = 300*1000 + 10;

int32_t main()
{
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int n; cin>>n;
    if(n == 1){
        cout << 0 ;
        return 0;
    }
    int total = 1 , remove = 1;
    for(int i = 0;i<n;++i){
        total = mul(total , 10);
        remove = mul(remove , 8);
    }
    int rem = 1;
    for(int i =0;i<n;++i){
        rem = mul(rem , 9);
    }
  
    total = sub(total , remove);
    total  = sub(total , rem);
    total = add(total , remove);
    total  = sub(total , rem);
    total = add(total , remove);
    cout << total ;

    return 0;
}
    

// Химаншу
// check overflow
// special case n == 1



Measured memory_bytes: 3644
# -*- coding: utf-8 -*-
# モジュールのインポート
import math

# 標準入力の取得
A, B, N = list(map(int, input().split()))


def f(x: int) -> int:
    return math.floor(A*x/B) - A*math.floor(x/B)


# 求解処理
result = f(min(B-1, N))

# 結果出力
print(result)


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

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

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

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

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

//debug
#define dump(x)  cerr << #x << '=' << (x) << endl;
#define debug(x) cerr << #x << '=' << (x) << '('<<'L' << __LINE__ << ')' << ' ' << __FILE__ << endl;

string yes="YES",no="NO";
int main(){

    string s;
    cin>>s;
    cout<<"2018"<<s.substr(4)<<endl;





}


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

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

    vector<ll> A(N);
    rep(i, N) cin >> A[i];

    vector<ll> s = A;

    sort(s.begin(), s.end());

    vector<ll> ans(N);

    rep(i,N) {
        if (A[i] == s[N-1]){
            ans[i] = s[N - 2];
        }
        else
        {
            ans[i] = s[N - 1];
        }
    }

    rep(i, N) cout << ans[i] << endl;
    return 0;
}

Measured memory_bytes: 6272
import java.io.*;
import java.util.StringTokenizer;

public class Main {

    static BufferedReader in;
    static PrintWriter out;
    static StringTokenizer tok;

    void solve() throws IOException {
        double r1 = nd();
        double r2 = nd();

        out.println(r1 * r2 / (r1 + r2));
    }

    String ns() throws IOException {
        while (!tok.hasMoreTokens()) {
            tok = new StringTokenizer(in.readLine(), " ");
        }
        return tok.nextToken();
    }

    int ni() throws IOException {
        return Integer.parseInt(ns());
    }

    long nl() throws IOException {
        return Long.parseLong(ns());
    }

    double nd() throws IOException {
        return Double.parseDouble(ns());
    }

    String[] nsa(int n) throws IOException {
        String[] res = new String[n];
        for (int i = 0; i < n; i++) {
            res[i] = ns();
        }
        return res;
    }

    int[] nia(int n) throws IOException {
        int[] res = new int[n];
        for (int i = 0; i < n; i++) {
            res[i] = ni();
        }
        return res;
    }

    long[] nla(int n) throws IOException {
        long[] res = new long[n];
        for (int i = 0; i < n; i++) {
            res[i] = nl();
        }
        return res;
    }

    public static void main(String[] args) throws IOException {
        in = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(System.out);
        tok = new StringTokenizer("");
        Main main = new Main();
        main.solve();
        out.close();
    }
}

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

int main() {
  int a, b,c ;
  cin >> a >> b;
  c = a+ b ;
  if(c/2*2 == c ){
  cout << c/2 <<endl;
  }
  else{
    cout << c/2 +1 <<endl;
  }
}


Measured memory_bytes: 3568
#include <stdio.h>
#include <limits.h>
#include <math.h>

#define N (1 << 20)

int seg[N << 1];
void init(void)
{
	int i;
	for (i = 0; i < (N << 1); i++){
		seg[i] = INT_MAX;
	}
}
int find(int a, int b, int x, int l, int r)
{
	if (a >= r || l >= b) return (INT_MAX);
	if (a <= l && r <= b) return (seg[x]);
	return (fmin(find(a, b, x + x + 1, l, l + r >> 1), find(a, b, x + x + 2, l + r >> 1, r)));
}
void update(int x, int v)
{
	seg[x += N - 1] = v;
	while (x){
		x = x - 1 >> 1;
		seg[x] = fmin(seg[x + x + 1], seg[x + x + 2]);
	}
}

int main(void)
{
	int n, q;

	init();
	scanf("%d %d", &n, &q);
	while (q--){
		int qid, pos, val;
		scanf("%d %d %d", &qid, &pos, &val);
		if (qid) printf("%d\n", find(pos, val + 1, 0, 0, N));
		else update(pos, val);
	}
	return (0);
}

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


int main(){
	int H,W;
	char s[2]={'#','.'};

	while(1){
		scanf("%d %d",&H,&W);
		if(H==0 && W==0){
			break;
		}else{
			for(int i=0;i<H;i++){
				for(int j=0;j<W;j++){
					printf("%c",s[(i+j)%2]);
				}
				printf("\n");
			}
			printf("\n");

		}
	}
	
	return 0;
}


Measured memory_bytes: 2112
#include <bits/stdc++.h>
using ll=long long;
using namespace std;
#define rep_i(i, n) for (int i = 0; i < (n); ++i)
#define rep_ll(i, n) for (long long i = 0; i < (n); ++i)
#define r_rep_i(i, start, end) for (int i = (start); i < (end); ++i)
#define r_rep_ll(i, start, end) for (long long i = (start); i < (end); ++i)
#define debug_vi(v) copy((v).begin(), (v).end(), ostream_iterator<int>(cout, " "));
#define debug_vll(v) copy((v).begin(), (v).end(), ostream_iterator<long long>(cout, " "));
#define debug_vd(v) copy((v).begin(), (v).end(), ostream_iterator<double>(cout, " "));
#define sort_v(v) sort((v).begin(), (v).end()); //昇順
#define d_sort_vi(v) sort((v).begin(), (v).end(), greater<int>()); //降
#define d_sort_vll(v) sort((v).begin(), (v).end(), greater<long long>()); //降
#define d_sort_vd(v) sort((v).begin(), (v).end(), greater<double>()); //昇順
#define say(t) cout << (t) << endl;
#define sum_vi(v) accumulate((v).begin(), (v).end(), 0);
#define sum_vll(v)accumulate((v).begin(), (v).end(), 0LL);

ll gcd(ll a, ll b) { return b?gcd(b, a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a, b)*b;}
const int IINF=(1<<30);
const ll LLINF = 1LL<<60;

int main(){
  cin.tie(0);
  ios::sync_with_stdio(0);
  int a, b, c; cin >> a >> b >> c;
  if(a < b && b < c){
      cout << "Yes" << endl;
  }else{
      cout << "No" << endl;
  }
}


Measured memory_bytes: 3204
#include <iostream>
#include <string>
#include <cstring>
#include <fstream>
#include <random>
#include <cmath>
#include <iomanip>
#include <climits>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <map>
#include <deque>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <list>
#include <unordered_map>
#include <bitset>
#include <sstream>

typedef  long long ll;
#define mop 1000000007
using namespace std;

int main() {
   

    string s;
    cin >> s;
    if(s[2] == s[3] and s[4] == s[5]){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }

}

Measured memory_bytes: 256
package main

import "fmt"

func divisors(n int) []int {
	r := make([]int, 0)
	for i := 1; i*i <= n; i++ {
		if n%i == 0 {
			r = append(r, i)
			if i*i != n {
				r = append(r, n/i)
			}
		}
	}
	return r
}

func cols(n int) int {
	r := 0
	for n > 0 {
		r++
		n /= 10
	}
	return r
}

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

func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func main() {
	var N int
	fmt.Scan(&N)
	divs := divisors(N)
	// fmt.Printf("divs(%d)=%v\n", N, divs)
	ans := int(1e10) + 1
	for i := 0; i < len(divs); i++ {
		p := divs[i]
		q := N / p
		// fmt.Printf("cols(%d)=%d, cols(%d)=%d\n", p, cols(p), q, cols(q))
		ans = min(ans, max(cols(p), cols(q)))
	}
	fmt.Println(ans)
}


Measured memory_bytes: 640
#include<stdio.h>
#include <stdlib.h>
#include <string.h>

int string_compar(const void *a, const void *b)
{
    return(strcmp(*(char**)a, *(char**)b));
}

int main()
{
  int n = 0;
  int r = 0;
  int nr = 0;

  scanf("%d %d", &n,&r);

  if (n >= 10)
  {
    printf("%d", r);
  }
  else
  {
    nr = r + 100 * (10 - n);
    printf("%d", nr);
  }
  //qsort((void*)ary, n, sizeof(char*), string_compar);

    return 0;
}

Measured memory_bytes: 128
n = int(input())
s = input()

ec = [0] * (n + 1)
wc = [0] * (n + 1)
for i in range(n):
    ec[i + 1] = ec[i] + (s[i] == 'E')
    wc[i + 1] = wc[i] + (s[i] == 'W')

ans = n
for i in range(n):
    ans = min(ans, wc[i] + ec[n] - ec[i + 1])

print(ans)

Measured memory_bytes: 27128
#include <bits/stdc++.h>
		using namespace std;
		#define pll pair<ll,ll>
		typedef long long ll;
		#define mod 1000000007
		#define fi first
		#define se second
		#define mp make_pair
		#define pb push_back
		#define INF 1e15
		
		
		int main()
		{
			
			ll n;
			cin>>n;
			map<pair<ll,ll>,ll> cnt;
			for(ll i=1;i<=n;i++)
			{
				ll last=i%10;
				ll j=i;
				while((j/10)!=0)
				{
					j=j/10;
				}
				cnt[{j,last}]++;
				
			}
			ll ans=0;
			for(auto i:cnt)
			{
				ans+=i.se*(cnt[{i.fi.se,i.fi.fi}]);
			}	
			cout<<ans;
		}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(){
	while(1){
	long n; cin >> n ;
	if(!n) break;
	long mod2=0; long mod5=0;
	for(long i=1;i<=n;i++){
	if(i%2!=0 && i%5!=0) continue;
	long temp2=i;
	while(1){
		if(temp2%2==0) mod2++,temp2/=2;
		else break;
	};
	long temp5=i;
	while(1){
		if(temp5%5==0) mod5++,temp5/=5;
		else break;
	};
	};
	long ans=min(mod2,mod5) ;
	cout << ans << '\n' ;
	};
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_poizcy.hpp>
typedef long long  ll;
#define pb                push_back
#define mp                make_pair
#define all(a)            (a).begin(), (a).end()
#define mem(a,h)          memset(a, (h), sizeof(a))
#define fi first
#define se second
#define por(a,b) (((a%MOD) * (b%MOD))%MOD)
#define forg(i, b, e, c)    for (ll i = (ll)b; i < (ll)e; i+=c)
#define forr(i, b, e)    for (int i = b; i < e; i++)
 
 
using namespace std;
//using namespace __gnu_pbds;
typedef double lldb;
typedef pair<ll, ll>  ii;
typedef pair<double, double>  iidb;
#define iii pair<ii, nodo*>
typedef vector<ll>     vi;
typedef vector<vi>     vvi;
typedef vector<ii>      vii;
typedef vector<ll>      vll;
//typedef tree<ii,null_type,less<ii>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
const ll INF = 1e9+7;
const double PI = acos(-1);
#define initseg ll new_nodo=(pnodo*2),mid=(iz+der)/2;
 
//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define tam 300000
#define offset 3000
#define ptr nodo*
const int MOD=1e9+7;

using namespace std;
int v[tam];
int main()
{	
	int n;
	cin>>n;
	forr(i,0,n)
	cin>>v[i];
	int tot,c;
	tot=c=0;
	forr(i,0,n)
	{
		if (v[i]==i+1)
			c++;
		else
		{
				tot+=(c+1)/2;
			c=0;
		}
	}
	tot+=(c+1)/2;
	cout<<tot<<endl;
}

Measured memory_bytes: 4012
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define pp pair<int,int>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ld long double
#define al(a) (a).begin(),(a).end()
#define mk make_pair
#define check cout<<"?"<<endl;

ll MOD=1000000007;
ll mod=998244353;
int inf=1000001000;
ll INF=1e18+5;

int main(){
    int n,ans=1; cin>>n;
    string s; cin>>s;
    rep(i,n-1)if(s[i]!=s[i+1]) ans++;
    cout<<ans<<endl;
}

Measured memory_bytes: 3752