akhauriyash/Code-Regression huggingface dataset:
#define _USE_MATH_DEFINES 1
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define MOD 1000000007ll
#define INF 1000000000000000000ll
#define EPS 1e-9
#define getchar_unlocked _getchar_nolock
#define putchar_unlocked _putchar_nolock

typedef long long         ll;
typedef long double       ld;
typedef pair <ll,ll>      pl;
typedef tuple <ll,ll,ll>  tl;

ll TC, X, Y;

int main() {

	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	
	TC = 1;
	
	for (ll q = 1; q <= TC; q++) {
		
		cin >> X >> Y;
		
		bool pos = false;
		for (ll i = 0; i <= X; i++) {
			if (2 * i + 4 * (X - i) == Y) pos = true;
		}
		
		if (pos) cout << "Yes\n";
		else cout << "No\n";
	
	}
	
    return 0;
}

Measured memory_bytes: 3636
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int sx = sc.nextInt();
		int sy =sc.nextInt();
		int tx = sc.nextInt();
		int ty = sc.nextInt();
		for (int i=sy;i<ty;i++) {
			System.out.print('U');
		}
		for (int i=sx;i<tx;i++) {
			System.out.print('R');
		}
		for (int i=sy;i<ty;i++) {
			System.out.print('D');
		}
		for (int i=sx;i<=tx;i++) {
			System.out.print('L');
		}
		for (int i=sy;i<=ty;i++) {
			System.out.print('U');
		}
		for (int i=sx;i<=tx;i++) {
			System.out.print('R');
		}
		System.out.print('D');
		System.out.print('R');
		for (int i=sy;i<=ty;i++) {
			System.out.print('D');
		}
		for (int i=sx;i<=tx;i++) {
			System.out.print('L');
		}
		System.out.print('U');
	}

}

Measured memory_bytes: 24960
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0;i<n;i++)
#define REPP(i,n,m) for (int i=n; i<m; i++)
#define all(v) (v).begin(), (v).end()
#define pb(q) push_back(q)
#define Abs(a,b) max(a,b)-min(a,b)
#define YES(condition) if(condition){cout << "YES" << endl;}else{cout << "NO" << endl;}
#define Yes(condition) if(condition){cout << "Yes" << endl;}else{cout << "No" << endl;}
#define Cout(x) cout<<(x)<<endl
#define POSSIBLE(n) cout << ((n) ? "POSSIBLE" : "IMPOSSIBLE"  ) << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible"  ) << endl
#define possible(n) cout << ((n) ? "possible" : "impossible"  ) << endl
#define Size(n) (n).size()

bool dfs(int i, int d, long long sum, string s, int l);

long long  ssum=0;

int main(){

    cin.tie(0);
    ios::sync_with_stdio(false);
    
    string  s;
    int pred_j;
    cin >> s;
    int l = s.length();
    
    for(int i=0;i < 1 << l-1;i++){
        pred_j = 0;
        REP(j,l){
            if((i>>j & 1) == 1 || j==l-1){
                ssum += stoll(s.substr(pred_j, j - pred_j + 1));
                pred_j = j+1;
            }
        }
    }
    cout<<ssum<<endl;
    return 0;
}
    

Measured memory_bytes: 256
import java.util.*;

class Main{
  public static void main(String[] args){
    Scanner sc=new Scanner(System.in);
    long k=sc.nextLong();
    if(7%k==0){
      System.out.println(1);
      return;
    }
    if(k%7==0){
      k=k/7;
    }
    k=k*9;
    long ai=10;
    for(int i=1;i<80000000;i++){
      if(ai==1){
        System.out.println(i);
        return;
      }
      //System.err.print(ai+" ");
      ai=(ai*10)%k;
    }
    System.out.println(-1);
  }
}

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

typedef complex<double> P;
typedef pair<P,P> L;
typedef pair<L,bool> P2;

const double EPS=1e-8;

double dot(P a,P b){ return real(conj(a)*b); }

double cross(P a,P b){ return imag(conj(a)*b); }

P proj(P p,L l){
  return l.first+dot(p-l.first,l.second-l.first)/norm(l.second-l.first)*(l.second-l.first);
}

P reflect(P p,L l){
  return p+(proj(p,l)-p)*2.0;
}

P crossPoint(L l,L m){
  double A=cross(l.second-l.first,m.second-m.first);
  double B=cross(l.second-l.first,l.second-m.first);
  if(fabs(A)<EPS&&fabs(B)<EPS) return m.first;
  else if(fabs(A)>=EPS) return m.first+B/A*(m.second-m.first);
}

string s;
int p;

P2 bnf();

P get_num(){

  P res;
  int f=0;

  if(s[p]=='-') f=1, p++;

  double num1=0;
  
  while('0'<=s[p]&&s[p]<='9') num1=num1*10+s[p]-'0', p++;

  if(f) num1*=-1;

  f=0;
  
  p++;

  double num2=0;

  if(s[p]=='-') f=1, p++;
  
  while('0'<=s[p]&&s[p]<='9') num2=num2*10+s[p]-'0', p++;
  
  if(f) num2*=-1;
  
  f=0;
  
  return P(num1,num2);
}

P2 get_P2(){

  if(s[p]=='('){

    p++;
    
    P2 res=bnf();

    p++;

    return res;
  }
  
  return P2(L(get_num(),0),0); // 0: Point,  1: Line
}

P2 bnf(){

  P2 res=get_P2();
  
  while(p<s.size()&&s[p]=='@'){

    p++;
    
    P2 r=get_P2();
    
    bool A=res.second,B=r.second;
    
    if(!A&&!B){
      res.first=L(res.first.first,r.first.first);
      res.second=1;
    }
    
    if(A&&B){
      res.first.first=crossPoint(res.first,r.first);
      res.second=0;
    }
    
    if(!A&&B){
      res.first.first=reflect(res.first.first,r.first);
      res.second=0;
    }
    
    if(A&&!B){
      res.first.first=reflect(r.first.first,res.first);
      res.second=0;
    }
    
  }
  
  return res;
}

string Cut(string s){

  string res;

  for(int i=0;i<s.size();i++){
    if(s[i]=='('&&(s[i+1]=='-'||('0'<=s[i+1]&&s[i+1]<='9'))) continue;
    if(s[i]==')'&&('0'<=s[i-1]&&s[i-1]<='9')) continue;
    res+=s[i];
  }
  
  return res;
}

int main(){

  while(1){

    cin>>s;
    if(s=="#") break;

    s=Cut(s);
    
    p=0;
    
    P2 ans=bnf();

    printf("%.8f %.8f\n",ans.first.first.real(),ans.first.first.imag());
    
  }
  
  return 0;
}

Measured memory_bytes: 3304
#include "bits/stdc++.h"
#include  <iostream>
 using namespace std;
 
#define IOS         ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); 
#define mem(a,v)    memset((a), (v), sizeof (a))
#define FOR(i,a,n)  for(int i = (a); i<(n); ++i) 
#define mp(a , b)   make_pair(a , b)
#define pb(a)       push_back(a)

#define anal         '\n'

#define M 1000000007 
typedef long long ll;

 
 




int main(){
     
    IOS;
    
   // freopen("input.in", "r", stdin);
   // freopen("output.in", "w", stdout);
     
     ll k;
      cin>>k;

      ll ans =0 ;
     FOR(i,1,k+1)
        FOR(j,1,k+1)
           FOR(p ,1,k+1){
              
              ans += __gcd(i,__gcd(j,p));
           }
    
    cout<<ans;
    
 
  return  0 ;
   	    
 }

Measured memory_bytes: 3640
#include <bits/stdc++.h>
#define be(v) (v).begin(),(v).end()
#define pb(q) push_back(q)
typedef long long ll;
using namespace std;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin>>n;
    int a[n];
    for(int i=0;i<n;i++){
    	cin>>a[i];
    }
    sort(a,a+n);
    if(n%2==0){
    	for(int i=0;i<n;i++){
    		if(i%2==0){
    			if(a[i]-1!=i){
    				cout<<0<<endl;
    				return 0;
    			}
    		}
    		else{
    			if(a[i]!=i){
    				cout << 0<<endl;
    				return 0;
    			}
    		}
    	}
    	ll ans=1;
    	for(int i=0;i<n/2;i++){
    		ans*=2;
    		ans%=1000000007;
    	}
    	cout <<ans<<endl;;
    }
    else{
    	for(int i=0;i<n;i++){
    		if(i%2==0){
    			if(a[i]!=i){
    				cout << 0<<endl;
    				return 0;
    			}
    		}
    		else{
    			if(a[i]-1!=i){
    				cout << 0<<endl;
    				return 0;
    			}
    		}
    	}
    	ll ans=1;
    	for(int i=0;i<n/2;i++){
    		ans*=2;
    	    ans%=1000000007;
    	}
    	cout << ans<<endl;;
    }

    return 0;

}


Measured memory_bytes: 640
def selectionsort(n,a):
    count = 0
    for i in range(n):
        minj = i
        for j in range(i, n):
            if a[j] < a[minj]:
                minj = j
        if i != minj:
            a[i], a[minj] = a[minj], a[i]
            count += 1
    return a, count

if __name__ == '__main__':
    n = int(input())
    a = [int(x) for x in input().split()]
    a, count = selectionsort(n,a)
    print(' '.join(map(str, a)))
    print(count)


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

int main() {
    string s;
    cin>>s;
    int ans=0;
    for(int i=0; i<s.length(); i++){
        if(s[i+1]=='0'  && s[i]=='0'){
            s[i+1] = '1';
            ans ++;
        }
        if(s[i+1]=='1'  && s[i]=='1'){
            s[i+1] = '0';
            ans ++;
        }
    }
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 512
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using static System.Console;

class Program
{
    static void Main(string[] args)
    {
        var (x1, y1, x2, y2) = ReadLine().Split(' ').Select(int.Parse).ToArray();

        static (int x, int y) Rotate((int x, int y) p) => (-p.y, p.x);

        var (dx1, dy1) = (x2 - x1, y2 - y1);
        var (dx2, dy2) = Rotate((dx1, dy1));
        var (x3, y3) = (x2 + dx2, y2 + dy2);
        var (dx3, dy3) = Rotate((dx2, dy2));
        var (x4, y4) = (x3 + dx3, y3 + dy3);

        WriteLine($"{x3} {y3} {x4} {y4}");
    }
}

static class ArrayDeconstructExtensions
{
    public static void Deconstruct<T>(this T[] a, out T i1, out T i2) => (i1, i2) = (a[0], a[1]);
    public static void Deconstruct<T>(this T[] a, out T i1, out T i2, out T i3) => (i1, i2, i3) = (a[0], a[1], a[2]);
    public static void Deconstruct<T>(this T[] a, out T i1, out T i2, out T i3, out T i4) => (i1, i2, i3, i4) = (a[0], a[1], a[2], a[3]);
    public static void Deconstruct<T>(this T[] a, out T i1, out T i2, out T i3, out T i4, out T i5) => (i1, i2, i3, i4, i5) = (a[0], a[1], a[2], a[3], a[4]);
}


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

using namespace std;

using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int ddx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll MOD = 1000000007;
const ll INF = 1000000000000000000L;
#ifdef __DEBUG

/**
 * For DEBUG
 * https://github.com/ta7uw/cpp-pyprint
 */
#include "cpp-pyprint/pyprint.h"

#endif


void Main() {
    string S; cin >> S;
    map<string, string> x;
    x["Sunny"] = "Cloudy";
    x["Cloudy"] = "Rainy";
    x["Rainy"] = "Sunny";
    cout << x[S] << endl;
}

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


Measured memory_bytes: 256
#include <stdio.h>
using namespace std;

int main(){
	int n,x;
	scanf("%d",&n);

	for(int i = 1; i<= n; i++)
	{
		if(i%3 == 0){
			printf(" %d",i);
		}else{
			x = i;
			do{
				if(x%10 == 3){
					printf(" %d",i);
					break;
				}
				x /=10;
			}while(x);
		}
	}
	printf("\n");
}



Measured memory_bytes: 2768
import java.util.Scanner;

public class Main {
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int MAX_CAPA = 10000;
    int[] test;
    int i = 0;
    test = new int[MAX_CAPA];

    for(i = 0; i < MAX_CAPA; i++){
      test[i] = sc.nextInt();
      if(test[i] == 0) break; 

    }
    for(int j = 0; j < i; j++){
      System.out.printf("Case %d: %d\n", j+1, test[j]);
    }
  }
}


Measured memory_bytes: 73536
#include<iostream>
#include<algorithm>

using namespace std;

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

int main(){
    string A,B,C;

    cin>>A>>B>>C;

    if(A[A.size()-1]==B[0]&&B[B.size()-1]==C[0]) cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fi first
#define se second
#define pii pair<int,int>
#define mp make_pair
#define pb push_back
#define space putchar(' ')
#define enter putchar('\n')
#define eps 1e-10
#define MAXN 100005
//#define ivorysi
using namespace std;
typedef long long int64;
typedef unsigned int u32;
typedef double db;
template<class T>
void read(T &res) {
    res = 0;T f = 1;char c = getchar();
    while(c < '0' || c > '9') {
	if(c == '-') f = -1;
	c = getchar();
    }
    while(c >= '0' && c <= '9') {
	res = res * 10 +c - '0';
	c = getchar();
    }
    res *= f;
}
template<class T>
void out(T x) {
    if(x < 0) {x = -x;putchar('-');}
    if(x >= 10) {
	out(x / 10);
    }
    putchar('0' + x % 10);
}
int N,M;
int X[MAXN],cnt[MAXN],a[MAXN],p[MAXN];
void Solve() {
    read(N);read(M);
    for(int i = 1 ; i <= N ; ++i) {
	read(X[i]);cnt[X[i]]++;
    }
    int ans = 0;
    for(int i = 1 ; i <= 100000 ; ++i) {
	ans += cnt[i] / 2;
	p[i % M] += cnt[i] / 2;
	a[i % M] += cnt[i] % 2;
    }
    for(int i = 0 ; i < M ; ++i) {
	if(i > M - i) break;
	if(i == M - i || i == 0) ans += a[i] / 2;
	else {
	    int t = min(a[i],a[M - i]);
	    a[i] -= t;a[M - i] -= t;
	    if(a[i]) {
		t += min(p[M - i],a[i] / 2);
	    }
	    else if(a[M - i]) {
		t += min(p[i],a[M - i] / 2);
	    }
	    ans += t;
	}
    }
    out(ans);enter;
}
int main() {
#ifdef ivorysi
    freopen("f1.in","r",stdin);
#endif
    Solve();
    return 0;
}


Measured memory_bytes: 1792
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")

#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>

#define ll long long
#define ull unsigned long long
#define pii pair<int,int>
#define pll pair<ll,ll>
#define xx first
#define yy second
#define sci(n) scanf("%d",&n)
#define scii(n,m) scanf("%d%d",&n,&m)
#define sciii(n,m,w) scanf("%d%d%d",&n,&m,&w)
#define scl(n) scanf("%lld",&n)
#define scll(n,m) scanf("%lld%lld",&n,&m)
#define sclll(n,m,w) scanf("%lld%lld%lld",&n,&m,&w)
#define pf(a)   printf("%d\n",a)
#define CASE(a) printf("Case %d:\n",a)
#define dbg(i) printf("yo %lld\n", i)
#define endl '\n'
#define READ  freopen("input.txt","r",stdin)
#define WRITE freopen("output.txt","w",stdout);
#define pi acos(-1)
#define mem(a,b) memset(a,b,sizeof(a))
#define SQR(a) (a)*(a)
#define all(v) v.begin(),v.end()
#define pb push_back
#define pri priority_queue<int>
#define rev_pri priority_queue<int,vector<int>,greater<int> >
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
//#define mod 1000000007
#define inf INT_MAX
#define eps 1e-9

#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)

using namespace __gnu_pbds;
using namespace std;


#define mxn 100005


//bool vis[1LL << 19];
const ll nax=100005;
ll ar[nax];
ll W[102],C[102];
void solve()
{
    ll a,b,n,w,k=0,c,i,q=0,j,l,m,mx=-1,mod=1e17;
    cin>>n>>w;
    FOR(i,1,n+1)scll(W[i],C[i]);
    FOR(i,1,(1e5)+2)ar[i]=mod;
    for(i=1;i<=n;i++){
        for(j=1e5;j-C[i]>=0;j--){
            if(ar[j-C[i]]!=mod){
                ar[j]=min(ar[j],ar[j-C[i]]+W[i]);
                if(ar[j]<=w)mx=max(mx,j);
            }
        }
    }cout<<mx<<'\n';
}
int main()
{
    //IOS;
    double start_time = clock();
    ll t=1,mex=1;
   //cin>>t;
    while(t--){
        solve();
    }
    double end_time = clock();
    //fprintf(stderr, "Time = %lf\n", (end_time - start_time) / CLOCKS_PER_SEC);
    return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <algorithm>
#define MAX 30
using namespace std;

int main()
{
	int w,n;
	int a,b;
	int number[MAX];
	char c;
	
	cin >> w;
	cin >> n;
	
	for(int i = 1; i <= w; i++){
		number[i] = i;
//		cout << number[i] << endl;
	}
	
	for(int i = 0; i < n; i++){
		cin >> a>> c >> b;
		swap(number[a], number[b]);
	}
	
	for(int i = 1; i <= w; i++){
		cout << number[i] << endl;
	}

	return 0;
}

Measured memory_bytes: 1160
import java.io.*;
import java.util.*;
import java.util.function.*;

final class Solver {
	static final Solver INSTANCE = new Solver();

	void solve(Supplier<String> sc) {
		long N = Long.parseLong(sc.get());
		int result = 0;
		for (long z = 2; z * z <= N; z++){
			long n = N;
			int count = 0;
			while (n % z == 0){
				n /= z;
				count++;
			}

			for (int i = 1; count - i >= 0; i++) {
				count -= i;
				result++;
			}

			N = n;
		}
		if (N > 1) result += 1;
		System.out.println(result);
	}
}

class Main {
	public static void main(String... args) {
		System.setOut(new PrintStream(new BufferedOutputStream(System.out)));
		var reader = new BufferedReader(new InputStreamReader(System.in));
		Solver.INSTANCE.solve(new Supplier<>() {
			StringTokenizer line;

			public String get() {
				while (line == null || !line.hasMoreTokens()) try {
					line = new StringTokenizer(reader.readLine());
				} catch (IOException e) {
					throw new UncheckedIOException(e);
				}
				return line.nextToken();
			}
		});
		System.out.flush();
	}
}

Measured memory_bytes: 32768
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

// I/O
type Scanner struct {
	sc *bufio.Scanner
}

func NewScanner() *Scanner {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 1024), int(1e+9))
	return &Scanner{sc}
}

func (s *Scanner) nextStr() string {
	s.sc.Scan()
	return s.sc.Text()
}

func (s *Scanner) nextInt() int {
	i, e := strconv.Atoi(s.nextStr())
	if e != nil {
		panic(e)
	}
	return i
}

func (s *Scanner) nextFloat() float64 {
	f, e := strconv.ParseFloat(s.nextStr(), 64)
	if e != nil {
		panic(e)
	}
	return f
}

func (s *Scanner) nextRuneSlice() []rune {
	return []rune(s.nextStr())
}

func (s *Scanner) nextIntSlice(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextInt()
	}
	return res
}

func (s *Scanner) nextFloatSlice(n int) []float64 {
	res := make([]float64, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextFloat()
	}
	return res
}

// Arithmetic
func max(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m < i {
			m = i
		}
	}
	return m
}

func min(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m > i {
			m = i
		}
	}
	return m
}

func abs(x int) int {
	if x > 0 {
		return x
	}
	return -x
}

func pow(x, y int) int {
	res := 1
	for i := 0; i < y; i++ {
		res *= x
	}
	return res
}

// Sort
type Val struct {
	id, num int
}
type ByNum []Val

func (a ByNum) Len() int           { return len(a) }
func (a ByNum) Less(i, j int) bool { return a[i].num < a[j].num }
func (a ByNum) Swap(i, j int)      { a[i], a[j] = a[j], a[i] }

func main() {
	sc := NewScanner()
	wtr := bufio.NewWriter(os.Stdout)
	N := sc.nextInt()
	S, T := sc.nextStr(), sc.nextStr()
	ans := ""
	for i := 0; i < N; i++ {
		ans += string(S[i]) + string(T[i])
	}

	fmt.Fprintln(wtr, ans)
	wtr.Flush()
}


Measured memory_bytes: 640
N,M=map(int,input().split())
a=[]
c=[]
for i in range(M):
  aa,bb=map(int,input().split())
  a.append(aa)
  cc=["0"]*(N+1)
  d=list(map(int,input().split()))
  for dd in d:
    cc[dd]="1"
  c.append(int("".join(cc[1:]),2))
#print(a)
#print(c)

X=[10**10]*2**N
X[0]=0
for i in range(2**N):
  if X[i]<10**10:
    for j in range(M):
      if i|c[j]<2**N:
        X[i|c[j]]=min(X[i|c[j]],X[i]+a[j])
print(X[2**N-1] if X[2**N-1]!=10**10 else -1)

Measured memory_bytes: 46808
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef unsigned long long ull;
 
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define REP(i,n) for(int i=0;i<(n);i++)
#define RREP(i,n) for(int i=(n)-1;i>=0;i--)
#define VSORT(v) sort(v.begin(), v.end())
#define DVSORT(v) sort(v.begin(), v.end(),greater<int>())
#define SORT(v, n) sort(v, v+n)
#define DSORT(v,n) sort(v, v+n,greater<int>())
#define vi vector<int>
#define pb push_back
#define P pair<int,int>
 
template <class T> void chmin(T&a,const T&b) { a = min(a,b); }
template <class T> void chmax(T&a,const T&b) { a = max(a,b); }
 
void print(){cout<<endl;}
template <class Head, class... Tail>
void print(Head&& h,Tail&&... t){ 
	if(sizeof...(t)==0)
		cout<<h;
	else
		cout<<h<<' ';
	print(move(t)...);
}
 
const double EPS =1e-9;
const long INF =2147483647;//32bit 2*1e+9
const long MOD =1e+9+7;
#define PI 3.14159265258979
 
int dy[]={0, 0, 1, -1, 1, 1, -1, -1};
int dx[]={1, -1, 0, 0, 1, -1, -1, 1};

int main(void){
	int A,B;
	string S;
	cin>>A>>B>>S;
	REP(i,(int)S.length()){
		if(i==A){
			if(S[i]!='-'){
				print("No");
				return 0;
			}
		}else if(S[i]<'0' || S[i]>'9'){
			print("No");
			return 0;
		}	
	}
	print("Yes");
	
	
	return 0;
}


Measured memory_bytes: 256
-- ABC 137 C
import Data.Maybe
import Data.Char
import Data.List
import Control.Monad
import qualified Data.ByteString.Char8 as BS
import qualified Data.Vector.Unboxed as VU

main :: IO ()
main = do
  n <- getInt
  ss <- replicateM n BS.getLine
  let ts = sort . map BS.sort $ ss
  print . sum . map ((\n -> (n*(n-1))`div`2) . length) . group $ ts


readInt :: BS.ByteString -> Int
readInt = fst . fromJust . BS.readInt

getInt :: IO Int
getInt = readInt <$> BS.getLine

getIntList :: IO [Int]
getIntList = unfoldr (BS.readInt . BS.dropWhile isSpace) <$> BS.getLine

Measured memory_bytes: 487548
#include<stdlib.h>
#include<string.h>

int main(void){
  int n, k,q;
  scanf("%d %d %d",&n,&k,&q);
  int * score=(int *)malloc(n*sizeof(int));
  for(int i=0;i<n;i++)
    score[i]=k-q;
  int i=0;
  for(int j=0;j<q;j++){
    scanf("%d",&i);
    score[i-1]++;
  }
  for(int i=0;i<n;i++){
    if(score[i]>0)
      puts("Yes");
    else
      puts("No");
  }
  return 0;
}

Measured memory_bytes: 896
#include <stdio.h>
#include <string.h>
#define MAX1 100
#define MAX2 200
int main(void)
{
	char s[MAX1], p[MAX1], ss[MAX2];
	scanf("%s%s", s, p);
	strcat(ss, s);
	strcat(ss, s);
	if(strstr(ss, p) != NULL){
		printf("Yes\n");
	}else{
		printf("No\n");
	}
    return 0;
}

Measured memory_bytes: 532
N, M = map(int, input().split())
A = [int(s) for s in input().split()]

BC = []
for i in range(M):
    b, c = map(int, input().split())
    BC.append([c, b])

A.sort()
BC.sort()

bc_index = len(BC)-1
for i in range(len(A)):
    if BC[bc_index][1] == 0:
        bc_index -= 1

    if bc_index < 0:
        break

    if A[i] < BC[bc_index][0]:
        A[i] = BC[bc_index][0]
        BC[bc_index][1] -= 1
    else:
        break

print(sum(A))


Measured memory_bytes: 24004
#include <bits/stdc++.h>
using namespace std;
int dp[2001][2001];
int query(int x1, int y1, int x2, int y2) {
  return dp[y2][x2] - dp[y1][x2] - dp[y2][x1] + dp[y1][x1];
}
int main() {
  int N,K,answer=0,x,y;
  char c;
  cin >> N >> K;
  for (int i = 0; i < N; dp[y+1][x+1]++, i++) {
    cin >> x >> y >> c;
    if (c == 'B') {
      y += K;
    }
    x %= 2*K;
    y %= 2*K;
  }
  for (int i = 0; i <= 2*K; i++) {
    for (int j = 0; j < 2*K; j++) {
      dp[i][j+1] += dp[i][j];
    }
  }
  for (int j = 0; j <= 2*K; j++) {
    for (int i = 0; i < 2*K; i++) {
      dp[i+1][j] += dp[i][j];
    }
  }
  for (int i = 0; i <= K; i++) {
    for (int j = 0, k = 0; j <= K; j++, k = 0) {
      k += query(0, 0, i, j);
	  k += query(i + K, 0, 2 * K, j);
	  k += query(0, j + K, i, 2 * K);
	  k += query(i, j, i + K, j + K);
	  k += query(i + K, j + K, 2 * K, 2 * K);
      answer = max(answer,max(k,N-k));
    }
  }
  cout << answer;
}

Measured memory_bytes: 19188
#include "bits/stdc++.h"

using namespace std;

using ll = long long;
using ld = long double;
using P = pair<int, int>;
constexpr ld EPS = 1e-12;
constexpr int INF = numeric_limits<int>::max() / 2;
constexpr int MOD = 1e9 + 7;

template <typename T>
void printv(const vector<T> &v)
{
    int sz = v.size();
    for (int i = 0; i < sz; i++)
    {
        cout << v[i] << " \n"[i == sz - 1];
    }
}

template <typename T>
void coordinateCompression(std::vector<T> &a)
{
    int N = a.size();
    std::vector<T> xs = a;
    sort(xs.begin(), xs.end());
    xs.erase(unique(xs.begin(), xs.end()), xs.end());
    for (int i = 0; i < N; i++)
    {
        a[i] = lower_bound(xs.begin(), xs.end(), a[i]) - xs.begin();
    }
}

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

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

    int n;
    while (cin >> n, n)
    {
        vector<int> x(2 * n), y(2 * n);
        for (int i = 0; i < n; i++)
        {
            int l, t, r, b;
            cin >> l >> t >> r >> b;
            x[i] = l;
            x[i + n] = r;
            y[i] = t;
            y[i + n] = b;
        }
        coordinateCompression(x);
        // printv(x);
        coordinateCompression(y);
        // printv(y);
        vector<vector<int>> v(400, vector<int>(400, 0));
        for (int i = 0; i < n; i++)
        {
            int l = x[i] + 1, t = y[i] + 1, r = x[i + n] + 1, b = y[i + n] + 1;
            l *= 2;
            t *= 2;
            r *= 2;
            b *= 2;
            for (int j = b; j <= t; j++)
            {
                v[l][j] = 1;
                v[r][j] = 1;
            }
            for (int j = l; j <= r; j++)
            {
                v[j][t] = 1;
                v[j][b] = 1;
            }
        }
        int ret = 0;
        /*
        for (int i = 4*n; i >= 0; i--)
        {
            for (int j = 0; j < 4 * n; j++)
            {
                cout << (v[i][j] ? "*" : " ");
            }
            cout << endl;
        }
        */
        for (int i = 0; i < 400; i++)
        {
            for (int j = 0; j < 400; j++)
            {
                if (v[i][j])
                    continue;
                queue<P> que;
                ret++;
                v[i][j] = 1;
                que.push(P(i, j));
                while (!que.empty())
                {
                    int sx, sy;
                    tie(sx, sy) = que.front();
                    que.pop();
                    for (int k = 0; k < 4; k++)
                    {
                        int nx = sx + dx[k], ny = sy + dy[k];
                        if (nx < 0 || 400 <= nx || ny < 0 || 400 <= ny)
                            continue;
                        if (v[nx][ny])
                            continue;
                        v[nx][ny] = 1;
                        que.push(P(nx, ny));
                    }
                }
            }
        }
        cout << ret << endl;
    }
}



Measured memory_bytes: 3564
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn=1e5;
char s[maxn+5];
int main()
{
    scanf("%s",s+1);
    int len=strlen(s+1);
    for (int i=1;i<len;i++)
    if (s[i]==s[i+1]) {
        printf("%d %d\n",i,i+1);
        return 0;
    }
    for (int i=1;i+2<=len;i++)
    if (s[i]==s[i+2]) {
        printf("%d %d\n",i,i+2);
        return 0;
    }
    printf("-1 -1\n");
    return 0;
}



Measured memory_bytes: 384
import sys

N = int(input())
R = [0]*N
C = [0]*N
for i in range(N):
    R[i], C[i] = map(int, input().split())

INF = 10**18
m = [[INF]*N for i in range(N)]
for i in range(N):
    m[i][i] = 0
for l in range(1, N):
    for i in range(N-l):
        a0 = R[i]
        c0 = C[i+l]
        m[i][i+l] = min(a0*C[j]*c0 + m[i][j] + m[j+1][i+l] for j in range(i, i+l))
print(m[0][N-1])


Measured memory_bytes: 5664
#include <bits/stdc++.h>
using namespace std;
int main(){
    int n,a[1000],ali=0,bo=0;
    cin>>n;
    for(int i=0;i<n;i++){
		cin>>a[i];
	}
	sort(a,a+n);
	for(int j=n-1;j>=0;j--){
		if(j%2==0)ali+=a[j];
		else bo+=a[j];
	}
	cout<<abs(ali-bo)<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int M=2050,mod=924844033;

int fac[M],rfac[M],a[M],b[M],n,k,i,s;

int mul(int a,int b)
{
    return a*(ll)b%mod;
}
int ad(int a,int b)
{
    return(a+b)%mod;
}
int de(int a,int b)
{
    return(a-b)%mod;
}

int pow(int a,int b)
{
    int s=1;
    while(b)
    {
        if(b&1)s=mul(s,a);
        a=mul(a,a);
        b>>=1;
    }
    return s;
}
int rev[M],N,iN;
void pre(int n)
{
    int i,k;
    for(N=1,k=0; N<n; N<<=1)k++;
    for(i=0; i<N; i++)rev[i]=(rev[i>>1]>>1)|((i&1)<<(k-1));
    iN=pow(N,mod-2);
}
void ntt(int*a,int on)
{
    int i,j,k,t,w,wn;
    for(i=0; i<N; i++)
    {
        if(i<rev[i])swap(a[i],a[rev[i]]);
    }
    for(i=2; i<=N; i<<=1)
    {
        wn=pow(5,on==1?(mod-1)/i:mod-1-(mod-1)/i);
        for(j=0; j<N; j+=i)
        {
            w=1;
            for(k=0; k<i>>1; k++)
            {
                t=mul(w,a[i/2+j+k]);
                a[i/2+j+k]=de(a[j+k],t);
                a[j+k]=ad(a[j+k],t);
                w=mul(w,wn);
            }
        }
    }
    if(on==-1)
    {
        for(i=0; i<N; i++)a[i]=mul(a[i],iN);
    }
}

int C(int n,int k)
{
    return n<k?0:mul(fac[n],mul(rfac[k],rfac[n-k]));
}

int main()
{
    scanf("%d%d",&n,&k);
    fac[0]=1;
    for(i=1; i<=n; i++)fac[i]=mul(fac[i-1],i);
    rfac[n]=pow(fac[n],mod-2);
    for(i=n; i>0; i--)rfac[i-1]=mul(rfac[i],i);
    pre(n+1);
    for(i=0; i<=n; i++)
    {
        a[i]=C(n/k-i,i);
        b[i]=C(n/k+1-i,i);
    }
    ntt(a,1);
    ntt(b,1);
    for(i=0; i<N; i++)a[i]=mul(pow(a[i],(k-n%k)*2),pow(b[i],n%k*2));
    ntt(a,-1);
    for(i=0; i<=n; i++)(s+=(i&1?-1:1)*mul(fac[n-i],a[i]))%=mod;
    printf("%d",(s+mod)%mod);
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		String str;
		String sh_str;
		int sh_num;
		int[] sh;

		Scanner sc= new Scanner( System.in );

		while ( true) {
			sh_num = 0;
			str = sc.next();

			if ( str.equals("-") ) {
				break;
			}

			sh_num  = sc.nextInt();

			sh = new int[sh_num];

			for ( int i = 0 ; i < sh_num ; i++ ) {
				sh[i]= sc.nextInt();
			}

			for ( int i = 0 ; i < sh_num ; i++ ) {
				sh_str = "";

				sh_str += str.substring(sh[i],str.length());
				sh_str += str.substring(0,(sh[i]));

				str = sh_str;
			}
			System.out.println( str );
		}

		sc.close();
	}
}



Measured memory_bytes: 26184
using System;
using static System.Console;

class Program
{
    public static void Main()
    {
        string s = ReadLine();
        int ans = 0;
        for (int i = 0; i < 4; i++){
            char c = s[i];

            if (c == '+')
            {
                ans++;
            }
            else
            {
                ans--;
            }

        }
        WriteLine(ans);
    }
}


Measured memory_bytes: 11092
#include <iostream>
#include <cstring>
using namespace std;
char a[1000000],b[1000000];
int main(){
    cin>>a;
    int l=strlen(a);
    for(int i=0;i<l;i++){
        b[l-i-1]=a[i];
    }
    for(int i=0;i<l;i++){
        if(b[i]=='b')b[i]='d';
        else if(b[i]=='d')b[i]='b';
        else if(b[i]=='p')b[i]='q';
        else if(b[i]=='q')b[i]='p';
        if(b[i]!=a[i]){
            cout<<"No"<<endl;
            return 0;
        }
    }
    cout<<"Yes"<<endl;
    return 0;
}

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

#define REP(i,n) for(int i = 0; i < (n); ++i)
#define REP1(i,n) for(int i = 1; i <= (n); ++i)
#define RREP(i, n) for(int i = (n) - 1; i >= 0; --i)
#define ALL(a) begin(a), end(a)
#define MP(a,b) make_pair((a), (b))
#define ROUNDUP(a,b) ((a) / (b) + ((a) % (b) == 0 ? 0 : 1))
#define X first
#define Y second
#define DEBUG(a) cout << #a << ": " << a << "\n"
// #define DEBUG(a) {}

using namespace std;
using ll = long long;
using vi = vector<int>;
using pii = pair<int, int>;

constexpr int MOD = 1e9 + 7;
constexpr int INF = 1e9 + 1;
constexpr ll LLINF = 4 * 1e18 + 1;
// constexpr int INF = 2147483647; // 2 * 1e9
// constexpr ll LLINF = 9223372036854775807; // 9 * 1e18

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

template<typename T>
T debug(T x) {
	DEBUG(x);
	return x;
}

int main(){
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	int n;
	cin >> n;
	vi t(n + 1), x(n + 1), y(n + 1);
	t[0] = 0; x[0] = 0; y[0] = 0;
	REP1(i, n) cin >> t[i] >> x[i] >> y[i];
	REP1(i, n){
		if((abs(x[i] - x[i - 1]) + abs(y[i] - y[i - 1]) - (t[i] - t[i - 1])) > 0 || (abs(x[i] - x[i - 1]) + abs(y[i] - y[i - 1]) - (t[i] - t[i - 1])) % 2 != 0){
			cout << "No\n";
			return 0;
		}
	}
	cout << "Yes\n";
	return 0;
}


Measured memory_bytes: 1408
#include <bits/stdc++.h>
#define FI first
#define SE second
#define EPS 1e-9
#define ALL(a) a.begin(),a.end()
#define SZ(a) int((a).size())
#define MS(s, n) memset(s, n, sizeof(s))
#define FOR(i,a,b) for (int i = (a); i <= (b); i++)
#define FORE(i,a,b) for (int i = (a); i >= (b); i--)
#define FORALL(it, a) for (__typeof((a).begin()) it = (a).begin(); it != (a).end(); it++)
#define WHATIS(x) cout << #x << " is " << x << endl;
#define ERROR(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
//__builtin_ffs(x) return 1 + index of least significant 1-bit of x
//__builtin_clz(x) return number of leading zeros of x
//__builtin_ctz(x) return number of trailing zeros of x

using namespace std;
using ll = long long;
using ld = double;
typedef pair<int, int> II;
typedef pair<ll, II> III;
typedef complex<ld> cd;
typedef vector<cd> vcd;

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
    cout << *it << " = " << a << endl;
    err(++it, args...);
}

const ll MODBASE = 1000000007LL;
const int MAXN = 100010;
const int MAXM = 100010;
const int MAXK = 510;
const int MAXQ = 200010;

int n;
ll x, f[55], g[55];

ll solve(int n, ll x) {
    if (n == 0) return 1;
    if (x == 1) return 0;
    if (x == f[n]) return g[n];
    x--;
    if (x <= f[n-1]) return solve(n-1, x);
    if (x == f[n-1] + 1) return g[n-1] + 1;
    x -= f[n-1] + 1;
    return g[n-1] + 1 + solve(n-1, x);
}

int main() {
    ios::sync_with_stdio(0);
    cin.tie(nullptr);
    f[0] = 1;
    g[0] = 1;
    FOR(i,1,50) {
        f[i] = f[i-1] * 2 + 3;
        g[i] = g[i-1] * 2 + 1;
    }
    cin >> n >> x;
    cout << solve(n, x);
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (long long i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
const ll MOD = 1000000007;
const ll INF = 10000000000000;
#define all(v) v.begin(), v.end()


int main(){
  string S,T;
  ll ans=0;
  cin >> S >> T;
  rep(i,S.size()){
    if(S.at(i)!=T.at(i)){
      ans++;
    }
  }
  cout << ans << endl;
      
}

Measured memory_bytes: 3920
#include <bits/stdc++.h>
#define all(x) x.begin(), x.end()
#define reverse(x) reverse(x.begin(), x.end())
#define sort(x) sort(x.begin(), x.end())
#define pb push_back
#define pii pair<int, int>
#define pll pair<long long,long long>
#define f first
#define s second
typedef long long ll;
const int mod = 1e9+7;
using namespace std;
int a[100005], n, m;

int main(){
	int i, j=0;
	cin >> n >> m;
	while(n){
		n/= m;
		j++;
	}
	cout << j;
}


Measured memory_bytes: 256
n,m=map(int,raw_input().split())
lis=map(int,raw_input().split())
dic={}
c=0
dic[0]=1
#print lis
for i in xrange(n):
    c = (c+lis[i])%m
    #print c
    if c in dic:
        dic[c]+=1
    else:
        dic[c]=1
#print dic
ans=0
for i in dic:
    ans += (dic[i]*(dic[i]-1))/2
print ans

Measured memory_bytes: 11340
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <deque>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#define p(s) cout<<(s)<<endl
#define REP(i,n,N) for(int i=n;i<N;i++)
#define RREP(i,n,N) for(int i=N-1;i>=n;i--)
#define CK(n,a,b) ((a)<=(n)&&(n)<(b))
#define F first
#define S second
typedef long long ll;
using namespace std;
const int inf = 1e9;

int N,Y;

int main(){
    cin>>N>>Y;
    bool ok=false;
    REP(i,0,N+1){
        REP(j,0,N+1-i){
            int k=N-i-j;
            if(10000*i+5000*j+1000*k==Y){
                cout<<i<<" "<<j<<" "<<k<<endl;
                return 0;
            }
        }
    }
    cout<<-1<<" "<<-1<<" "<<-1<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
 
int main(){
  int a, b;
  cin >> a >> b;
  if (a%2 != b%2 || a == b ){
   cout << "IMPOSSIBLE" << endl;
  }
  else {
    cout << (a + b)/2 << 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 rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
using ll = long long;
using VI = vector<int>;
using VVI = vector<vector<int>>;
using P = pair<int, int>;

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

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long int lli;
#define MAX 300005
#define INF 1000005
#define endl "\n"
int arr[MAX];
lli f[4];
string c[] = {"AC", "WA", "TLE", "RE"};
int main(){
    lli N;
    cin>>N;
    for(int i = 0; i<N; i++){
        string s;
        cin>>s;
        for(int j = 0; j<4; j++){
            if(s == c[j])
                f[j]++;
        }
    }
    for(int i = 0; i<4; i++){
        cout<<c[i]<<" x "<<f[i]<<endl;
    }
    
}


Measured memory_bytes: 3628
#include "bits/stdc++.h"
using namespace std;

#define pb push_back
#define mp make_pair
#define F(i, a, n) for(int i=a;i<n;i++)
#define REP(i, n) F(i, 0, n)
#define REP1(i, n) for(int i=1;i<=n;i++)
#define PTR(it, x) for(auto it=x.begin();it!=x.end();++it)
#define MOD 1000000007

typedef long long ll;

const int MAX = 1e4 + 5;

string s,t;
int cnt = 0;
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	cin>>s>>t;
	REP(i, 3){
		if(s[i] == t[i])
			cnt++;
	}
	cout<<cnt;
	return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000


int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int X; cin >> X;
    REP(i, 1, 1000) {
        int lower = i * 100;
        int upper = i * 105;
        if (lower <= X && X <= upper) {
            cout << 1 << endl;
            return 0;
        }
    }
    cout << 0 << endl;


    return 0;
}


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

int main(){
	int n; cin >> n;
	int cnt = 0;
	for(int i = 0; i < n; i ++){
		int x; cin >> x;
		if(x & 1 && i % 2 == 0) cnt ++;
	}
cout << cnt << endl;
}

Measured memory_bytes: 3600
#include <bits/stdc++.h>
typedef long long ll;
#define pb push_back
using namespace std;
typedef pair<ll,ll> pll;
typedef long double ld;


ll n;
vector< pll > v;
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
inline ll f(ll X, ll Y)
{
        return (X*X + Y*Y);
}
ld g(pll X, pll Y)
{
        if(Y.first == 0 && Y.second == 0) return 0;
        ld m1 = f(X.first, X.second);
        ld m2 = f(Y.first, Y.second);
        return (ld)(((ld)(X.first*Y.first + X.second*Y.second)) / (m1 * m2));
}
int main()
{
        ios_base::sync_with_stdio(false);
        cin.tie(NULL); cout.tie(NULL);
        cout << setprecision(12) << fixed;
        cin >> n;
        ll ans = 0;
        ll X=0; ll Y=0;
        for(ll i=0;i<n;i++) {
                ll u,vv;
                cin >> u >> vv;
                v.pb(make_pair(u, vv));
                X += u;
                Y += vv;
                ans = max(ans , f(X, Y));
        }
        for(ll i=0;i<n;i++) {
                pll A = v[i];
                if(A.first==0 && A.second == 0) continue;
                vector< pair<ld, ll> > t;
                for(ll j=0;j<n;j++) {
                        t.pb(make_pair(g(A, v[j]), j));
                }
                sort(t.rbegin(), t.rend());
                ll X = 0;
                ll Y = 0;
                for(auto &j : t){
                        ll id = j.second;
                        if(f(X + v[id].first, Y + v[id].second) > f(X , Y)) {
                                X += v[id].first; Y += v[id].second;
                        }
                        ans = max(ans, f(X , Y));
                }
        }
        ld aa = ans; aa = sqrt(aa);
        cout << aa << endl;
        return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
const int N = 1e3+5;
int n, m, a, b, s[N][N];
int main()
{
    scanf("%d%d%d%d", &n, &m, &a, &b);
    for(int i = 1; i <= b; ++i) for(int j = 1; j <= a; ++j) s[i][j] = 1;
    for(int i = b+1; i <= n; ++i) for(int j = a+1; j <= m; ++j) s[i][j] = 1;
    for(int i = 1; i <= n; puts(""), ++i) for(int j = 1; j <= m; ++j) putchar(s[i][j]^48);
    return 0;
}

Measured memory_bytes: 7512
#include <bits/stdc++.h>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstring>
#include <chrono>
#include <complex>
#define endl "\n"
#define ll long long int
#define vi vector<int>
#define vll vector<ll>
#define vvi vector < vi >
#define pii pair<int,int>
#define pll pair<long long, long long>
#define mod 1000000007
#define inf 1000000000000000001;
#define all(c) c.begin(),c.end()
#define mp(x,y) make_pair(x,y)
#define mem(a,val) memset(a,val,sizeof(a))
#define eb emplace_back
  #define pb push_back
#define f first
#define s second
  #define MAXN 100005
using namespace std;
int arr[MAXN];
int main()
{
	std::ios::sync_with_stdio(false);
	int n,h,w;
	cin>>n>>h>>w;
	ll ans=(n-h+1)*(n-w+1);
	cout<<ans<<endl;



	return 0;
}


Measured memory_bytes: 256
#include <iostream> // cin, cout, cerr, clog
#include <algorithm> // min, max, sort, swap
#include <numeric> // iota, accumulate, inner_product
#include <cmath> // long, trig, pow
#include <string> // string, stoi, to_string
#include <vector> // vector
#include <queue> // queue, priority_queue
#include <deque> // deque
#include <stack> // stack
#include <map> // key-value pairs sorted by keys
#include <set> // set
#include <unordered_map> // hashed by keys
#include <unordered_set> // hashed by keys
#include <iomanip> // cout<<setprecision(n)
#include <functional> // std::function<void(int)>
using namespace std;
#define rep(i,n) rep1(i,0,n)
#define rep1(i,m,n) for(int i=m;i<(n);i++)
#define All(v) (v).begin(),(v).end()
using ll = long long;
const int inf = 1<<30;
const ll mod = 1000000007;
const ll INF = 100000000000000000LL;
const double PI = acos(-1);
int main(){
    int N;
    cin >> N;
    vector<int> a(N);
    rep(i, N) cin >> a[i];
    int res = 0;
    rep(i,N){
        while(a[i]%2==0){
            res++;
            a[i] /= 2;
        }
    }
    cout << res << endl;
}

Measured memory_bytes: 256
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 ) *} } ;}
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! {
      _s: String
   }
   let s = _s.as_bytes().to_vec();
   let mut score: i32 = 0;
   let mut g = 0;
   for b in s {
      if b == b'g' {
         g += 1;
      } else if g == 0 {
         score -= 1;
         g += 1;
      } else {
         g -= 1;
      }
   }
   score += g/2;
   println!("{}", score);
}


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

int main()
{
    long long int n;
    cin >> n;
    vector<long long int> v;
    for(long long int i=0;i<n;i++)
    {
        long long int k;
        cin >> k;
        v.push_back(k);
    }
    long long int max=0;
    for(long long int i=0;i<n;i++)
    {
        long long int j;
        long long int cur=v[i];
        for(j=i+1;j<n;j++)
        {
            if(cur<v[j])
            {
                //i=j-1;
                break;
            }
            else
            {
                cur=v[j];
            }
        }
        if(j-i-1>max)
        {
            max=j-i-1;
            i=j-1;
        }
    }
    cout << max << endl;
}

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

#define WLEN 32
#define SLEN 1000
#define W_MAX SLEN/WLEN+1

int main(void){
	int count[W_MAX], p=0, max, maxN, i;
	char *word[W_MAX], *t;
	
	/* init */
	for(i=0; i<W_MAX; i++) count[i]=0;
	
	/* input */
	while(t=malloc(WLEN), ~scanf("%s",t)){
		for(i=0; i<p; i++) if(!strcmp(t,word[i])) break;
		
		count[i]++;
		
		if(i!=p) free(t);
		else word[p++]=t;
	}
	
	/* most frequent word */
	for(max=0, i=0; i<p; i++)
		if(count[i]>max) max=count[i], maxN=i;
	printf("%s ",word[maxN]);
	
	/* longest word */
	for(max=0, i=0; i<p; i++)
		if(strlen(word[i])>max) max=strlen(word[i]), maxN=i;
	printf("%s\n",word[maxN]);
	
	return 0;
}

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

string s, t;

bool in_s[26];
int nxt[200100][26];

signed main() {

    cin >> s >> t;

    int len_s = s.size();
    int len_t = t.size();

    REP(i, len_s) {
        in_s[s[i] - 'a'] = true;
    }

    REP(i, len_t) {
        if (not in_s[t[i] - 'a']) {
            cout << -1 << endl;
            return 0;
        }
    }

    string db_s = s + s;
    // cerr << db_s << endl;

    // nxtをつくる
    REP(i, 26) {
        int tmp = -1;
        for (int j = len_s * 2 - 1; j >= 0; --j) {
            if (db_s[j] == 'a' + i) {
                tmp = j;
            }
            nxt[j][i] = tmp;
        }
    }

    // REP(i, len_s) {
    //     REP(j, 26) {
    //         if (nxt[i][j] != -1) cout << nxt[i][j] << ' ';
    //     }
    //     cout << endl;
    // }

    ll res1 = 0;
    ll res2 = 0;

    REP(i, len_t) {
        int cur = t[i] - 'a';
        int nx = nxt[res1][cur];
        if (nx >= len_s) {
            res2 += 1;
            nx -= len_s;
        }
        if (nx == len_s - 1) res2 += 1;
        res1 = (nx + 1) % len_s;
        // cout << res1 << ' ' << res2 << endl;
    }

    cout << res1 + res2 * len_s << endl;
    
}

Measured memory_bytes: 41344
from collections import defaultdict
n, m = map(int, input().split( ))
a = list(map(int, input().split( )))
mod = defaultdict(int)###defaultdict使用
a_sum = 0
for i in range(n):
    a_sum += a[i]
    a_sum %= m
    mod[a_sum] += 1
 
ans = mod[0]
for v in mod.values():
    ans += v*(v-1)//2

print(ans)

Measured memory_bytes: 62576
n=int(input())
h=list(map(int, input().split()))

ans=0
step=0
now=h[0]


for val in h[1:]:
    if val <= now:
        step+=1
    else:
        if ans < step:
            ans=step
        step=0
    now=val

if ans < step:
    ans=step


print(ans)

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

using namespace std;

int main() {
    deque<int> a;

    int q;
    cin >> q;
    while (q--) {
        int n;
        cin >> n;

        if (n == 0) {
            int d, x;
            cin >> d >> x;
            (d == 0) ? a.push_front(x) : a.push_back(x);
        } else if (n == 1) {
            int p;
            cin >> p;
            cout << a[p] << endl;
        } else if (n == 2) {
            int d;
            cin >> d;
            (d == 0) ? a.pop_front() : a.pop_back();
        }
    }
    return 0;
}


Measured memory_bytes: 4632
#include <bits/stdc++.h>
using namespace std;
int main()
{
int a,b,c;
cin>>a>>b>>c;
if(((a==b)&&(b!=c))||((b==c)&&(c!=a))||((c==a)&&(c!=b)))
{
cout<<2;
}
else
if((a==b)&&(b==c))
{
cout<<1;
}
else
cout<<3;
return 0;
}

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

class Main {

	void solve() {

		int a = inint(), b = inint(), x = inint();
		if (a<=x && x<=a+b) out.println("YES");
		else out.println("NO");

	}

	public static Scanner in = new Scanner(System.in);
	public static PrintWriter out = new PrintWriter(System.out);

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

	public int inint() {
		return in.nextInt();
	}

	public String instr() {
		return in.next();
	}

	public int[] inintar(int num) {
		int[] a = new int[num];
		for (int i=0; i<num; i++) {
			a[i] = in.nextInt();
		}
		return a;
	}

	public char[] incharar() {
		return in.next().toCharArray();
	}

}

Measured memory_bytes: 22740