akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
#define RREP(i,n) for(int i=n;i>=0;i--)
#define FOR(i,m,n) for(int i=m;i<n;i++)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
using namespace std;
typedef long long ll;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
//const ll INF = 1LL << 60;
//const int INF = 1001001001;

int main(void){
    int x;
    cin >> x;
    REP(i,1000){
        REP(j,1000){
            if(pow(i,5)-pow(j,5)==x){
                cout << i << " " << j;
                return 0;
            }
            if(pow(i,5)+pow(j,5)==x){
                cout << i << " " << -j;
                return 0;
            }
        }
    }

    return 0;
}

Measured memory_bytes: 4112
#include<bits/stdc++.h>
using namespace std;
long long a,b,z;
int main()
{
	cin>>a>>b;
	if(a>0&&b>0)cout<<"Positive"<<endl;else
	if(a<=0&&0<=b)cout<<"Zero"<<endl;else
	{
		if((b-a+1)%2)cout<<"Negative"<<endl;
		else cout<<"Positive"<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-9;
const ll mod=1e9+7;
const int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};

int n;
vi dp(3);

int main(){
	cin>>n;
	for(int i=0;i<n;i++){
		int A,B,C;
		cin>>A>>B>>C;
		vi DP(3);
		DP[0]=max(dp[1],dp[2])+A;
		DP[1]=max(dp[0],dp[2])+B;
		DP[2]=max(dp[0],dp[1])+C;
		dp=DP;
	}
	cout<<max({dp[0],dp[1],dp[2]})<<endl;
}

Measured memory_bytes: 256
n, m = map(int, input().split())
ab = set([i for i in range(1, n+1)])
a = []
b = []
for _ in range(m):
    aa, bb = map(int, input().split())
    a.append(aa)
    b.append(bb)

for i in ab:
    print(a.count(i) + b.count(i))

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

int main(){
    int a,b,d,r;
    float f;
    cin >> a >> b;
    d = a/b;
    r = a%b;
    f = a/b;
    
   
    printf("%d %d %lf\n",d,r,(double)a/b);



}


Measured memory_bytes: 3204
n=int(input())
a=list(map(int,input().split()))

sum1=0
for x in range(n-1):
  sum1+=abs(a[x]-a[x+1])
  
sum1+=abs(a[0])+abs(a[n-1])
for y in range(n):
  if y==0:
    print(sum1-abs(a[0])-abs(a[1]-a[0])+abs(a[1]))
  elif y==n-1:
    print(sum1-abs(a[n-1]-a[n-2])-abs(a[n-1])+abs(a[n-2]))
  else:
    print(sum1-abs(a[y]-a[y-1])-abs(a[y]-a[y+1])+abs(a[y-1]-a[y+1]))
    



Measured memory_bytes: 20580
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <math.h>
#include <numeric>
#include <list>
using namespace std;

int main()
{
    int N;
    cin >> N;
    vector<int> dist(N);
    for (int i = 0; i < N; i++)
    {
        cin >> dist[i];
    }
    sort(dist.begin(), dist.end());
    int sum = 0;
    for (int i = 1; i < dist.size(); i++)
    {
        sum += (dist[i] - dist[i - 1]);
    }
    cout << sum << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.*;
import java.io.*;
import static java.lang.Math.*;

class Main {

    public static void main( final String[] args ) {

		final Scanner stdin = new Scanner( System.in );

		while ( true ) {

			final int n = stdin.nextInt();
			final int m = stdin.nextInt();
			if ( n == 0 && m == 0 ) break;

			final int[] ns = new int[ n ];
			for ( int i = 0; i < n; i++ ) {
				ns[ i ] = stdin.nextInt();
			}
			Arrays.sort( ns );
			final int[] ms = new int[ m ];
			for ( int i = 0; i < m; i++ ) {
				ms[ i ] = stdin.nextInt();
			}
			Arrays.sort( ms );

			final int nsum = sum( ns );
			final int msum = sum( ms );
			boolean success = false;

			for ( final int val : ns ) {
				final int findVal = msum + 2 * val - nsum;
				if ( findVal % 2 == 0 ) {
					final int mindex = Arrays.binarySearch( ms, findVal / 2 );
					if ( mindex >= 0 ) {
						success = true;
						System.out.printf( "%d %d\n", val, ms[ mindex ] );
						break;
					}
				}
			}
			if ( !success ) {
				System.out.println( -1 );
			}
		}	
    }

	static int sum( final int[] array ) {
		int sum = 0;
		for ( final int val : array ) {
			sum += val;
		}
		return sum;
	}
}

Measured memory_bytes: 21044
#include <bits/stdc++.h>
#define fi first
#define se second
#define mp make_pair
#define lo long long 
#define inf 1000000000
#define md 1000000007
#define pb push_back
#define li 1005
using namespace std;
lo int A[5];
int main(){
	for(int i=1;i<=3;i++) scanf("%lld",&A[i]);
	sort(A+1,A+4,greater<int>());
	lo int yar1=A[1]/2;
	lo int yar2=A[1]-yar1;
	if(yar1==yar2){
		printf("0\n");
	}
	else printf("%lld\n",A[2]*A[3]);
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#define _USE_MATH_DEFINES
#include <cmath>
#include <iomanip>
using namespace std;
//---------------------------------------
//---------------------------------------

int main(void)
{
	double len_a, len_b, angle_c;
	cout << fixed <<setprecision(4);  //???????°???°????¬¬4????????§??¨?????????(iomanip)
	
	cin >> len_a;
	cin >> len_b;
	cin >> angle_c;
	
	
	double h = len_b * sin(angle_c * M_PI / 180);
	
	//??¢???S
	cout << len_a * h * 1 / 2 << endl;
	
	//??¨?????????L
	cout << sqrt(pow(len_a, 2) + pow(len_b, 2)
	             - 2 * len_a * len_b * cos(angle_c * M_PI / 180)) 
	        + len_a + len_b
	     << endl;
	
	//??????h
	cout << h << endl;
	
	
	return 0;
	
}

Measured memory_bytes: 3508
#include<deque>
#include<queue>
#include<vector>
#include<algorithm>
#include<iostream>
#include<set>
#include<cmath>
#include<tuple>
#include<string>
#include<chrono>
#include<functional>
#include<iterator>
#include<random>
#include<unordered_set>
#include<unordered_map>
#include<array>
#include<map>
#include<iomanip>
using namespace std;
typedef long long int llint;
typedef long double lldo;
#define mp make_pair
#define mt make_tuple
#define pub push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
#define fir first
#define sec second
#define res resize
#define ins insert
#define era erase
#define dme cout<<-1<<endl;return 0
//ios::sync_with_stdio(false);
//<< setprecision(20)
const int mod=1e9+7;
const llint big=1e12+100;
const long double pai=3.141592653589793238462643383279502884197;
const long double ena=2.71828182845904523536;
const long double eps=1e-7;
template <class T,class U>void mineq(T& a,U b){if(a>b){a=b;}}
template <class T,class U>void maxeq(T& a,U b){if(a<b){a=b;}}
llint gcd(llint a,llint b){if(a%b==0){return b;}else return gcd(b,a%b);}
llint lcm(llint a,llint b){return a/gcd(a,b)*b;}
int main(void){
	int x;cin>>x;
	int gen=0;
	for(int i=1;i<=x;i++){
		gen+=i;
		if(gen>=x){cout<<i<<endl;return 0;}
	}
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<string.h>
//if(strcmp(s[i],"AC")==0)
//if(s[l]=='#')
int W_Length(char *str){
	int length = 0;
	while(*str++ != '\0')
		length++;
	return length;
}

void swap(int *a, int *b){
  int temp;
  temp=*a;
  *a=*b;
  *b=temp;
}
//swap(&a, &b)

double deg(double theta){//deg to theta
return theta*(2*3.14159265359)/360;
}

int cmp( const void *p, const void *q ) {
    return *(int*)p - *(int*)q;
}//ちいさい順
//qsort(a,n,sizeof(int),cmp);
//char s[n][11]

int cmp_s(const void * left, const void * right)
{
	char *left_char = (char *)left;
  char *right_char = (char *)right;
  return strcmp(left_char, right_char);
}
//qsort(s,n,sizeof(s[0]),cmp_s);


int main (void)
{
	int a[210000],b,c,n,i;

scanf("%d",&n);
  b=10-n/200;
  
  printf("%d",b);
	
return 0;
}


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

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

    int i, j, s;
    int A[100][100];
    int b[100];

    for(i = 0; i < n; i++){
        for(j = 0; j < m; j++) cin >> A[i][j];        
    }

    for(j = 0; j < m; j++) cin >> b[j];

    for(i = 0; i < n; i++){
        s = 0;
        for(j = 0; j < m; j++) s = s + A[i][j] * b[j];
        cout << s << endl;
    }

    return 0;
}

Measured memory_bytes: 1200
n,k = map(int,input().split())
ans = k
mod = 10**9+7
v = [[0] for i in range(n+1)]
for i in range(n-1):
    a,b = map(int,input().split())
    v[a].append(b)
    v[b].append(a)
if n == 1:
    print(k)
elif n == 2:
    print(k*(k-1))
else:
    q = [1]
    v[1][0] = 1
    # print(v)
    while q:
        t = q.pop()
        # print(t,ans,len(v[t]))
        cnt = 2-(t==1)
        for i in range(1,len(v[t])):
            # print(i)
            if v[v[t][i]][0] == 0:
                q.append(v[t][i])
                v[v[t][i]][0] = 1
                ans = (ans*(k-cnt)) % mod
                cnt += 1
                # if cnt == k+1:
                #     print(t,i,"Err")
    # print(v)
    print(ans)

Measured memory_bytes: 23952
#include<bits/stdc++.h>
using namespace std;
using ll = int64_t;
int main(){
	ll n, k;
	cin >> n >> k;
	ll ans = 0;
	if(k == 0){
		cout << n * n << endl;
		return 0;
	}
	for(ll b = k + 1; b <= n; b++){
		ll left = k;
		ll right = b - left;
		ll len = left + right;
		ans += (n + 1) / len * right;
		if((n + 1) / len) ans += max<ll>((n + 1) % len - left, 0);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;

// region template
#define rep(i, a, b) for (int i = (a); i < (b); ++i)
#define trav(a, x) for (auto &a : x)
#define all(x) begin(x), end(x)
#define sz(x) (ll)(x).size()
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef vector<int> vi;

ll gcd(ll a, ll b) { return __gcd(a, b); }

ll euclid(ll a, ll b, ll &x, ll &y) {
    if (b) {
        ll d = euclid(b, a % b, y, x);
        return y -= a / b * x, d;
    }
    return x = 1, y = 0, a;
}

typedef unsigned long long ull;
typedef long double ld;
ull mod_mul(ull a, ull b, ull M) {
    ll ret = a * b - M * ull(ld(a) * ld(b) / ld(M));
    return ret + M * (ret < 0) - M * (ret >= (ll)M);
}
ull mod_pow(ull b, ull e, ull mod) {
    ull ans = 1;
    for (; e; b = mod_mul(b, b, mod), e /= 2)
        if (e & 1)
            ans = mod_mul(ans, b, mod);
    return ans;
}

const ll mod = 1000000007;
struct Mod {
    ll x;
    Mod(ll xx) : x(xx) {}
    Mod operator+(Mod b) { return Mod((x + b.x) % mod); }
    Mod operator-(Mod b) { return Mod((x - b.x) % mod); }
    Mod operator*(Mod b) { return Mod((x * b.x) % mod); }
    Mod operator/(Mod b) { return *this * invert(b); }
    Mod invert(Mod a) {
        ll x, y, g = euclid(a.x, mod, x, y);
        assert(g == 1);
        return Mod((x + mod) % mod);
    }
    Mod operator^(ll e) {
        if (!e)
            return Mod(1);
        Mod r = *this ^ (e / 2);
        r = r * r;
        return e & 1 ? *this * r : r;
    }
};
// endregion

int main() {
    cin.sync_with_stdio(0);
    cin.tie(0);
    cin.exceptions(cin.failbit);

    for (;;) {
        string s1, s2;
        cin >> s1;
        if (s1 == ".") break;
        cin >> s2;

        int st = 0; // 0 = same, 1 = close, >2 = different

        int p1 = 0, p2 = 0;
        while (p1 < s1.length() && p2 < s2.length()) {
            // cout << p1 << " " << p2 << endl;
            if (s1[p1] != s2[p2]) {st = 2, ++p1, ++p2; break; }
            else if (s1[p1] == s2[p2]) {
                if (s1[p1] == '"') {
                    // cout << p1 << " " << p2 << endl;
                    ++p1, ++p2;
                    string buf1, buf2;
                    while (s1[p1] != '"') buf1.push_back(s1[p1++]); ++p1;
                    while (s2[p2] != '"') buf2.push_back(s2[p2++]); ++p2;
                    if (buf1 != buf2) st++;
                } else ++p1, ++p2;
            }
        }

        if (p1 != s1.length() || p2 != s2.length()) st = 2;

        cout << (st == 0 ? "IDENTICAL" : st == 1 ? "CLOSE" : "DIFFERENT") << endl;
    }
}



Measured memory_bytes: 3212
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstdlib>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

using namespace std;

#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i, s, n) for(int i = s, i##_len=(n); i < i##_len; ++i)
#define FORS(i, s, n) for(int i = s, i##_len=(n); i <= i##_len; ++i)
#define VFOR(i, s, n) for(int i = s; i < (n); ++i)
#define VFORS(i, s, n) for(int i = s; i <= (n); ++i)
#define REP(i, n) FOR(i, 0, n)
#define REPS(i, n) FORS(i, 0, n)
#define VREP(i, n) VFOR(i, 0, n)
#define VREPS(i, n) VFORS(i, 0, n)
#define RFOR(i, s, n) for(int i = s, i##_len=(n); i >= i##_len; --i)
#define RFORS(i, s, n) for(int i = s, i##_len=(n); i > i##_len; --i)
#define RREP(i, n) RFOR(i, n, 0)
#define RREPS(i, n) RFORS(i, n, 0)
#define ALL(v) (v).begin(), (v).end()
#define SORT(v) sort(ALL(v))
#define RSORT(v) sort(ALL(v), greater<decltype(v[0])>())
#define SZ(x) ((int)(x).size())
#define PB push_back
#define MP make_pair
#define MT make_tuple
#define BIT(n) (1LL<<(n))
#define UNIQUE(v) v.erase(unique(ALL(v)), v.end())

using ll = long long;
using PII = pair<int, int>;
using VI = vector<int>;
using VD = vector<double>;
using VLL = vector<ll>;
using VS = vector<string>;
using VC = vector<char>;
using VB = vector<bool>;

const int MOD = 1000000007;
const int INF = 1000000000;

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



int main(){
    string s, t; cin >> s >> t;
    int ls = s.length(), lt = t.length();
    // sのi文字目, tのj文字まで
    vector<VI> dp(ls+1, VI(lt+1, 0));
    FORS(i, 1, ls) FORS(j, 1, lt){
        if(s[i-1] == t[j-1]) dp[i][j] = dp[i-1][j-1]+1;
        else dp[i][j] = max(dp[i-1][j], dp[i][j-1]);
    }
    int i = ls, j = lt;
    string ans = "";
    while(i && j){
        if(s[i-1] == t[j-1]){
            ans = s[i-1] + ans;
            --i; --j;
        }
        else if(dp[i][j] == dp[i-1][j]) --i;
        else --j;
    }
    cout << ans << "\n";
    return 0;
}


Measured memory_bytes: 35584
#include<iostream>
using namespace std;
int main() {
	char str[500000];
	cin >> str;
	long long int flag, i, a, b, a2, b2;
	long long int counter;
	flag = 0;
	i = 0;
	a = 0;
	b = 0;
	a2 = 0;
	b2 = 0;
	counter = 0;

	while ((str[i] == '<') || (str[i] == '>')) {

		if (flag == 0) {
			if (str[i] == '<') {
				a++;
			}
			else {
				b++;
				flag = 1;
			}
			
		}
		else if (flag == 1) {
			if (str[i] == '>') {
				b++;
			}
			else {
				flag = 0;
				if (a > b) {
					a2 = a; b2 = b;
				}
				else {
					a2 = b; b2 = a;
				}
				a = 1;
				b = 0;
				counter = counter + a2 * (a2 + 1) / 2 + b2 * (b2 - 1) / 2;
			}
		}
		i++;

	}
	if (flag == 0) {
		counter = counter + a * (a + 1) / 2;
	}
	else {
		if (a > b) {
			a2 = a; b2 = b;
		}
		else {
			a2 = b; b2 = a;
		}
		counter = counter + a2 * (a2 + 1) / 2 + b2 * (b2 - 1) / 2;
	}


	cout << counter;
	return 0;
}

Measured memory_bytes: 768
N,A,B=map(int, input().split())
if abs(A-B)%2==0:
  print( abs(A-B)//2 )
else:
  if N-B > A-1:
    print( A-1+1+(B-A-1)//2 )
  else:
    print( N-B+1+(B-A-1)//2 )



Measured memory_bytes: 2940
#include <iostream>
#include <vector>

#define rep(i,a) for(int i = 0 ; i < a ; i ++)
#define loop(i,a,b) for(int i = a ; i < b ; i ++)
using namespace std;
int field[1000][1000];
int Hiryo[1000][1000];
int check[1000][1000]={0};
    
int main(void){
  int W,H,T;
  int p;
  int i,j,k,l;
  int a=0;
  int b=0;
  int sum=0;


  cin>>W>>H>>T;
  cin>>p;
  for(i=0;i<p;i++){
    for(j=0;j<3;j++){
      cin>>Hiryo[i][j];
    }
  }
  for(i=0;i<H;i++){
    for(j=0;j<W;j++){
    cin>>field[i][j];
  }
}

const int x = 0;
const int y = 1;
const int t = 2;
for(int i = 0 ; i < p ; i ++){
  int nx = Hiryo[i][x];
  int ny = Hiryo[i][y];
  /*
  rep(i,H){
    rep(j,W){
      if(nx==i && ny==j){
        cout<<"m";
      }else{
        cout<<field[i][j];
      }
    }
    cout<<endl;
  }cout<<endl;
//*/
  if(field[ny][nx] == 1){
    sum ++;
  }
}

/*
for(j=0;j<T;j++){
  for(i=0;i<p;i++){
    if(Hiryo[i][2]==0){
      a=Hiryo[i][0];
      b=Hiryo[i][1];
      if(field[b][a]>0 && check[b][a]==0){
        field[b][a]++;
        check[b][a]++;

      }
    }
  }

for(k=0;k<H;k++)
  for(l=0;l<W;l++)
    check[k][l]=0;
}
for(i=0;i<H;i++){
  for(j=0;j<W;j++){
    if(field[i][j]>0)
      sum+=field[i][j]-1;
  }
}
//*/
cout<<sum<<endl;
return 0;
}

Measured memory_bytes: 7304
use std::io::Read;
use std::cmp::{max, min};

fn main() {
    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).unwrap();

    let answer = solve(&buf);

    println!("{}", answer);
}

fn solve(input: &str) -> String {
    let mut iterator = input.split_whitespace();

    let h: usize = iterator.next().unwrap().parse().unwrap();
    let n: usize = iterator.next().unwrap().parse().unwrap();
    let mut a: Vec<usize> = Vec::new();
    let mut b: Vec<usize> = Vec::new();
    for _ in 0..n {
        a.push(iterator.next().unwrap().parse().unwrap());
        b.push(iterator.next().unwrap().parse().unwrap());
    }

    const INF: usize = 1_000_000_000;
    let mut dp: Vec<usize> = vec![INF; h + 1];
    dp[0] = 0;
    for i in 0..h {
        for j in 0..n {
            let k = min(h, i + a[j]);
            dp[k] = min(dp[k], dp[i] + b[j]);
        }
    }

    return dp[h].to_string();
}


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

int W, H;
vector<string> str;
bool used[70][70];
string memo[70][70];
const int dx[] = { 1, 0 };
const int dy[] = { 0, 1 };


bool Comp(const string& l, const string& r) {
	return l.size() == r.size() ? l < r : l.size() < r.size();
}

string MAX(const string& l, const string& r) {
	return Comp(l, r) ? r : l;
}

string dfs(int x, int y) {
	if (memo[x][y] != "") return memo[x][y];
	string res[2];
	for (int i = 0; i < 2; i++) {
		int tx = x + dx[i], ty = y + dy[i];
		if (tx >= 0 && tx < H && ty >= 0 && ty < W && str[tx][ty] >= '0' && str[tx][ty] <= '9') {
			res[i] = dfs(tx, ty);
		}
	}
	used[x][y] = true;
	return memo[x][y] = str[x][y] + MAX(res[0], res[1]);
}

int main()
{
	while (cin >> W >> H, W || H) {
		for (int i = 0; i < H; i++) {
			for (int j = 0; j < W; j++) {
				used[i][j] = false;
				memo[i][j].clear();
			}
		}
		str.resize(H);
		for (int i = 0; i < H; i++) {
			cin >> str[i];
		}
		string res;
		for (int i = 0; i < H; i++) {
			for (int j = 0; j < W; j++) {
				if (!used[i][j] && str[i][j] >= '1' && str[i][j] <= '9') {
					res = MAX(res, dfs(i, j));
				}
			}
		}
		cout << res << endl;
	}
	return 0;
}

Measured memory_bytes: 3364
s = input()
s = s.replace("BC", "X")
#"AX" -> "XA"

cnt = 0
ans = []
for i in range(len(s)):
    if s[i] == "A": cnt += 1
    elif s[i] == "X": ans.append(cnt)
    else: cnt = 0
print(sum(ans))

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

int main(){
  int n;
  cin >> n;
  int a[n];
  for(int i=0; i<n; i++){
    cin >> a[i];
  }
  int cnt=0,ans=0;
  int i=0, j=0;
  while(i<n-1){
    if(a[i+1]<=a[i]){
      for(int j=i; j<n; j++){
        if(a[j+1]>a[j]){
          ans = max(ans,cnt);
          cnt=0;
          i=j+1;
          break;
        }else if(j==n-1){
          ans = max(ans,cnt);
          i=j;
        }else{
          cnt++;
        }
      }
    }else{
      i++;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 640
import sys
input = sys.stdin.readline


def max2(x,y):
    return x if x > y else y

class DiGraph:
    def __init__(self, n, decrement=True, edges=[]):
        """
        incs[p]: 頂点 p に流入するリンク数
        """
        self.n = n
        self.decrement = decrement
        self.edges = [set() for _ in range(self.n)]
        self.incs = [0]*self.n
        for _from, _to in edges:
            self.add_edge(_from,_to)

    def add_edge(self, _from, _to):
        if self.decrement:
            _from -= 1
            _to -= 1
        self.edges[_from].add(_to)
        self.incs[_to] += 1

    def topological_sort_depth(self):
        """
        :return 各作業に１日かかると仮定したときに、最短で何日かかるかを返す
        """
        next_set = {p for p, inc in enumerate(self.incs) if inc == 0}
        res = []
        depth = [1]*self.n
        while next_set:
            p = next_set.pop()
            d = depth[p] + 1
            res.append(p+self.decrement)
            for q in self.edges[p]:
                self.incs[q] -= 1
                depth[q] = max2(d, depth[q])
                if self.incs[q] == 0:
                    next_set.add(q)
        if len(res) == self.n:
            return max(depth)
        else:
            return -1

    def draw(self):
        """
        :return: グラフを可視化
        """
        import matplotlib.pyplot as plt
        import networkx as nx

        G = nx.DiGraph()
        for x in range(self.n):
            for y in self.edges[x]:
                G.add_edge(x + self.decrement, y + self.decrement)

        pos = nx.spring_layout(G)
        nx.draw_networkx(G, pos)
        plt.axis("off")
        plt.show()

################################################################################

N = int(input())
graph = DiGraph(N*N, decrement=True)
visited = set()
for i in range(1,N+1):
    p0 = -1
    for j in map(int, input().split()):
        p = i*N + j if j > i else j*N + i
        if p0 != -1:
            graph.add_edge(p0, p)
        p0 = p
print(graph.topological_sort_depth())

Measured memory_bytes: 337836
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
// #include "prettyprint.hpp"

int main() {
  long Q;
  cin >> Q;

  priority_queue<long, vector<long>, less<long>> maxPQ;
  priority_queue<long, vector<long>, greater<long>> minPQ;
  long maxPQSum = 0;
  long minPQSum = 0;
  long bSum = 0;

  for (long i = 0; i < Q; i++) {
    long flag;
    cin >> flag;

    if (flag == 1) {
      // cout << "first!" << endl;
      long a, b;
      cin >> a >> b;
      bSum += b;

      if (maxPQ.size() == 0 || a < maxPQ.top()) {
        maxPQ.push(a);
        maxPQSum += a;

        if ((long)(maxPQ.size() - minPQ.size()) > 1) {
          long i = maxPQ.top();
          maxPQ.pop();
          maxPQSum -= i;
          // cout << "max to min: " << i << endl;

          minPQ.push(i);
          minPQSum += i;
        }
      } else {
        minPQ.push(a);
        minPQSum += a;

        if ((long)(maxPQ.size() - minPQ.size()) < 0) {
          long i = minPQ.top();
          minPQ.pop();
          minPQSum -= i;

          maxPQ.push(i);
          maxPQSum += i;
        }
      }
    } else {
      // cout << "second!" << endl;
      // cout << "===" << endl;
      // cout << maxPQ.top() << endl;
      // cout << maxPQ.size() << endl;
      // cout << minPQ.size() << endl;
      // cout << "maxPQSum: " << maxPQSum << endl;
      // cout << "minPQSum: " << minPQSum << endl;
      // cout << "bSum: " << bSum << endl;
      // cout << "===" << endl;
      long x = maxPQ.top();
      long long fx =
          x * maxPQ.size() - maxPQSum + minPQSum - x * minPQ.size() + bSum;
      cout << x << " " << fx << endl;
    }
  }
  return 0;
}

Measured memory_bytes: 3828
#include <iostream>
#include <cmath>
#include <stdio.h>

using namespace std;

int main() {
	long long int A, B, K;
	cin >> A >> B >> K;
	
	if (A <= K && A+B >= K) {
		long long int KA = K - A;
		A = 0;
		B = B - KA;
	}
	else if(A+B < K){
		A = 0;
		B = 0;

	}
	else {
		A = A - K;
	}
	
	cout << A << " " <<  B << endl;

	return 0;
}

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

int N,M,p,y;
string S[100010];

int main(){
	cin >> N >> M;
	vector<vector<pair<int,int>>> v(N+1);
	for(int i=0;i<M;i++){
		cin >> p >> y;
		v[p].push_back({y,i});
	}
	for(int i=1;i<=N;i++){
		sort(v[i].begin(),v[i].end());
		for(int j=0;j<v[i].size();j++){
			string l =to_string(i),r = to_string(j+1);
			while(l.size()<6) l = '0'+l;
			while(r.size()<6) r = '0'+r;
			S[v[i][j].second] = l+r;
		}
	}
	for(int i=0;i<M;i++){
		cout << S[i] << endl;
	}
}

Measured memory_bytes: 12416
#include <iostream>

int main ()
{
    int a,b,c,d,e;

    std::cin >> a;
    std::cin >> b;
    std::cin >> c;
    std::cin >> d;
    std::cin >> e;

    int cost_a,cost_b;

    cost_a = a * e;

    if (c < e) {
        cost_b = b + (e - c) * d;
    } else {
        cost_b = b;
    }

    if (cost_a < cost_b) {
        std::cout << cost_a << std::endl;
    } else {
        std::cout << cost_b << std::endl;
    }



    return 0;
}

Measured memory_bytes: 1160
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <stdlib.h>
#include <string.h>
#include <cmath>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <stdio.h>
#define int long long
#define rep(i, n) for (int i = 0; i < (n); i++)
#define P pair<long,long>
#define INF 1000000000000000000
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const long long MOD = 1000000007;
using namespace std;
typedef long long ll;
map<int, int> mp;
//最大公約数
ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}
//最小公倍数
ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}
class Union_Find {
private:
	vector<int> par;
	vector<int> rank;
public:
	Union_Find(int n) {
		rep(i, n) {
			par.push_back(i);
			rank.push_back(0);
		}
	}
	int find(int x) {
		if (par.at(x) == x) return x;
		else return par.at(x) = find(par.at(x));
	}
	void unite(int x, int y) {
		x = find(x);
		y = find(y);
		if (x == y) return;
		if (rank.at(x) < rank.at(y)) {
			par.at(x) = y;
		}
		else {
			par.at(y) = x;
			if (rank.at(x) == rank.at(y)) rank.at(x)++;
		}
	}
	bool same(int x, int y) {
		return find(x) == find(y);
	}
};

signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int n; cin >> n;
	vector<int>a(n); rep(i, n)cin >> a[i];
	int maxv = -INF;
	int minv = a[0];
	for (int i = 1; i <= n - 1; i++) {
		maxv = max(maxv, a[i] - minv);
		minv = min(minv, a[i]);
	}
	cout << maxv << endl;
	return 0;
}


Measured memory_bytes: 4316
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, acos, atan, asin, log, log10, gcd
from itertools import permutations, combinations, product, accumulate, combinations_with_replacement
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
#from fractions import gcd
def debug(*args):
    if debugmode:
        print(*args)
def input(): return sys.stdin.readline().strip()
def STR(): return input()
def INT(): return int(input())
def FLOAT(): return float(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
def lcm(a, b): return a * b // gcd(a, b)
sys.setrecursionlimit(10 ** 9)
inf = sys.maxsize
mod = 10 ** 9 + 7
dx = [0, 1, 0, -1, 1, -1, -1, 1]
dy = [1, 0, -1, 0, 1, -1, 1, -1]
debugmode = True

t = 10 ** 18

n = INT()
a = LIST()
ans = 1
a.sort(reverse=True)
if a[-1] == 0:
    print(0)
    exit()
for i in a:
    ans *= i
    if ans > t:
        print(-1)
        exit()
print(ans)


Measured memory_bytes: 86232
#include<iostream>

using namespace std;

int main(){
    int n;
    cin >> n;
    n %= 10;
    if(n==3)
    {
        cout << "bon" << endl;
    }
    else if (n==0 ||n ==1||n==6||n==8)
    {
         cout << "pon" << endl;
    }
    else
    {
         cout << "hon" << endl;
    }
    return 0;
}

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

int main() {
  int N, M;
  cin >> N >> M;
  vector<int> ab(N);
  int a,b;
  
  for(int i=0; i<M; i++){
    cin >> a >> b;
    ab.at(a-1)++;
    ab.at(b-1)++;
  }
  for(int i=0; i<N; i++) cout << ab.at(i) << endl; 
}

Measured memory_bytes: 256
void main()
{
    long n, k;
    rdVals(n, k);
    long[] a = rdRow;


    Edge[long] list;
    long pos;
    long l;
    long rem = k;

    if (k <= n)
    {
        foreach (i; 0 .. k)
        {
            pos = a[pos] - 1;
        }
    }
    else
    {
        foreach (i; 0 .. k)
        {
            if (pos in list)
            {
                rem -= list[pos].cost;
                l = i - list[pos].cost;
                break;
            }
            else
            {
                list[pos] = Edge(a[pos]-1, i);
                pos = a[pos] - 1;
            }
        }

        rem %= l;
        foreach (i; 0 .. rem)
        {
            pos = list[pos].to;
        }
    }

    pos += 1;

    pos.writeln;
}

struct Edge
{
    long to, cost;
}

enum long mod = 10^^9 + 7;
enum long inf = 1L << 60;
enum double eps = 1.0e-9;

T rdElem(T = long)()
if (!is(T == struct))
{
    return readln.chomp.to!T;
}

alias rdStr = rdElem!string;
alias rdDchar = rdElem!(dchar[]);

T rdElem(T)()
if (is(T == struct))
{
    T result;
    string[] input = rdRow!string;
    assert(T.tupleof.length == input.length);
    foreach (i, ref x; result.tupleof)
    {
        x = input[i].to!(typeof(x));
    }
    return result;
}

T[] rdRow(T = long)()
{
    return readln.split.to!(T[]);
}

T[] rdCol(T = long)(long col)
{
    return iota(col).map!(x => rdElem!T).array;
}

T[][] rdMat(T = long)(long col)
{
    return iota(col).map!(x => rdRow!T).array;
}

void rdVals(T...)(ref T data)
{
    string[] input = rdRow!string;
    assert(data.length == input.length);
    foreach (i, ref x; data)
    {
        x = input[i].to!(typeof(x));
    }
}

void wrMat(T = long)(T[][] mat)
{
    foreach (row; mat)
    {
        foreach (j, compo; row)
        {
            compo.write;
            if (j == row.length - 1) writeln;
            else " ".write;
        }
    }
}

import std.stdio;
import std.string;
import std.array;
import std.conv;
import std.algorithm;
import std.range;
import std.math;
import std.numeric;
import std.mathspecial;
import std.traits;
import std.container;
import std.functional;
import std.typecons;
import std.ascii;
import std.uni;
import core.bitop;

Measured memory_bytes: 23132
#include <algorithm>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <memory>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>

using namespace std;

typedef long long ll;

#define sz size()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(c) (c).begin(), (c).end()
#define rep(i,a,b) for(ll i=(a);i<(b);++i)
#define per(i,a,b) for(ll i=b-1LL;i>=(a);--i)
#define clr(a, b) memset((a), (b) ,sizeof(a))
#define ctos(c) string(1,c)
#define print(x) cout<<#x<<" = "<<x<<endl;

#define MOD 1000000007

ll d[200100];

int main() {
  clr(d,0);
  ll n;
  cin>>n;
  vector<ll> v;
  rep(i,0,n){
    ll a;
    cin>>a;
    v.pb(a);
  }
  vector<ll> ans;
  per(i,1,n+1){
    vector<ll> v1;
    for(ll j = 1; j*j <= i; j++){
      if(i%j==0){
        ll a = j;
        ll b = i/j;
        v1.pb(a);
        if(a!=b){
          v1.pb(b);
        }
      }
    }
    if(v[i-1]%2!=d[i]%2){
      ans.pb(i);
      rep(j,0,v1.sz){
        d[v1[j]]++;
      }
    }
  }
  cout << ans.sz << endl;
  rep(i,0,ans.sz){
    cout << ans[i];
    if(i!=ans.sz-1)cout << " ";
  }
  if(ans.sz!=0)cout << endl;
  return 0;
}

Measured memory_bytes: 6128
/*   _/                _/                 _/_/_/   _/
  _/_/_/_/   _/_/   _/_/_/_/   _/_/    _/       _/_/
   _/     _/    _/   _/     _/    _/  _/_/_/     _/
  _/     _/    _/   _/     _/    _/  _/    _/   _/
   _/_/   _/_/       _/_/   _/_/      _/_/     _/ */
#include<iostream>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<set>
#include<map>
#include<queue>
#include<vector>
using namespace std;
using ll=long long;
const int MOD=1e9+7;
const double pi=3.14159265358979323846;
const int inf=2e9;
const ll INF=1e18;
using P=pair<int,int>;
int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};
int main() {
  cin.tie(0),cout.tie(0);
  ios::sync_with_stdio(false);
  int n,cnta=0,cntb=0,cntab=0,cnt=0;
  string s;
  cin >> n;
  for(int i=0; i<n; i++) {
    cin >> s;
    if(s[0]=='B'&&s[s.size()-1]=='A') {
      cntab++;
    }
    else if(s[0]=='B') {
      cntb++;
    }
    else if(s[s.size()-1]=='A') {
      cnta++;
    }
    for(int j=0; j<s.size()-1; j++) {
      if(s[j]=='A'&&s[j+1]=='B') {
        cnt++;
      }
    }
  }
  if(cntab==0) {
    cout << cnt+min(cnta,cntb) << endl;
  }
  else if(cnta+cntb) {
    cout << cnt+cntab+min(cnta,cntb) << endl;
  }
  else {
    cout << cnt+cntab-1 << endl;
  }
}

Measured memory_bytes: 256
N, K = map(int, input().split())
S = input()
nums = []
now = 1
cnt = 0
for i in range(N):
    if S[i] == str(now):
        cnt += 1
    else:
        nums.append(cnt)
        now = 1 - now
        cnt = 1
if cnt != 0:
    nums.append(cnt)
if len(nums) % 2 == 0:
    nums.append(0)

add = 2 * K + 1
ans = 0
left = 0
right = 0
tmp = 0
for i in range(0, len(nums), 2):

    next_left = i
    next_right = min(i + add, len(nums))

    while next_left > left:
        tmp -= nums[left]
        left += 1

    while next_right > right:
        tmp += nums[right]
        right += 1

    ans = max(ans, tmp)
print(ans)

Measured memory_bytes: 4212
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define P pair<ll,ll>
#define FOR(I,A,B) for(ll I = (A); I < (B); ++I)
#define FORR(I,A,B) for(ll I = ((B)-1); I >= (A); --I)
#define TO(x,t,f) ((x)?(t):(f))
#define SORT(x) (sort(x.begin(),x.end())) // 0 2 2 3 4 5 8 9
#define REV(x) (reverse(x.begin(),x.end())) //reverse
ll gcd(ll a,ll b){if(a<b)swap(a,b);if(a%b==0)return b;return gcd(b,a%b);}
ll lcm(ll a,ll b){ll c=gcd(a,b);return ((a/c)*(b/c)*c);}//saisyo kobaisu
#define NEXTP(x) next_permutation(x.begin(),x.end())
const ll INF=1e18+7;
const ll MOD=1e9+7;
#define pri(a) cout << (a) << endl


int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	ll A,B,K;
	cin >> A >> B >> K;
	ll j = 0;
	while(K){
		j++;
		if(j == K+1)break;
		if(j%2){
			if(A%2)A--;
			A /= 2;
			B += A;
		}else{
			if(B%2)B--;
			B /= 2;
			A += B;
		}
	}
	cout << A << " " << B << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
void solve()
{
int k;
  cin>>k;
  int count=0;
  for(int i=1;i<1e7;i++)
  {
   
    count=(count*10+7)%k;
    if(count==0)
    {
    cout<<i;
      return;
    }
  } 
 cout<<-1;
}

int main()
{
solve();
  
}


Measured memory_bytes: 3628
N,A,B = list(map(int, input().split()))
X = list(map(int, input().split()))
otsukare = 0

for i in range(N - 1):
    kyo = X[i+1] - X[i]
    otu = kyo * A 
    if otu > B:
        otsukare = otsukare + B
    else:
        otsukare = otsukare + otu
print(otsukare)

Measured memory_bytes: 14252
#include <bits/stdc++.h>
using ll=long long;
using namespace std;
ll INF=10000000000;
ll mod=10007;
ll i,j,k,l;

int main() {
    ll h,n;
    cin>>h>>n;
    vector<ll> ATK(n),MP(n);
    for(i=0;i<n;i++){cin>>ATK[i]>>MP[i];}
    
    vector<vector<ll>> dp(n+1,vector<ll>(h+1,INF));
    dp[0][0]=0;//使用する魔法の種類　ダメージ
    //dp:MPのmin

    for(i=0;i<n;i++){
        for(j=0;j<=h;j++){
            dp[i+1][j]=min(dp[i+1][j],dp[i][j]);//i種類だけ使う場合と比較
            dp[i+1][min(j+ATK[i],h)]=min(dp[i+1][min(j+ATK[i],h)],dp[i+1][j]+MP[i]);
            /*j+ATK[i]減らしたいときの消費MPは、j減らしたMPとMP[i]の和(ただし、i+1の魔法は1回使った)*/
            //他のパターンでj+ATK[i]減らす可能性もあるので比較
        }
    }

    cout<<dp[n][h]<<endl;
}

Measured memory_bytes: 78592
using System;using System.Linq;namespace a{class b{static void Main(){Console.WriteLine(Enumerable.Range(1,1).Select(x => Console.ReadLine().Split(' ')).Select(x=>x.Select(y=>int.Parse(y)).ToList()).Select(x=>x[0]<x[1]&&x[1]<x[2]?"Yes":"No").First());}}}

Measured memory_bytes: 9448
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define sz(x) int(x.size())
#define show(x) {for(auto i: x){cout << i << " ";} cout << endl;}
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main() {
  int N, L;
  cin >> N >> L;
  vector<int> A;
  for (int i = 1; i <= N; i++) {
    A.push_back(L+i-1);
  }
  sort(A.begin(), A.end(), [](int x, int y) {
    return abs(x) < abs(y);
  });
  int total = 0;
  for (int i = 1; i < N; i++) {
    total += A[i];
  }
  cout << total << '\n';
  return 0;
}

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

typedef struct _Node {
  int key;
  struct _Node *next, *prev;
} Node;

Node *nil;

Node* listSearch(int key) {
  Node *cur = nil->next;
  while(cur != nil && cur->key != key) {
    cur = cur->next;
  }
  return cur;
}

void init(void) {
  nil = (Node *)malloc(sizeof(Node));
  nil->next = nil;
  nil->prev = nil;
}

void printList(void) {
  Node *cur = nil->next;
  int isf = 0;
  while(1) {
    if(cur == nil) break;
    if(isf++>0) printf(" ");
    printf("%d",cur->key);
    cur = cur->next;
  }
  printf("\n");
}

void deleteNode(Node *t) {
  if(t==nil) return;
  t->prev->next = t->next;
  t->next->prev = t->prev;
  free(t);
}

void deleteFirst(void) {
  deleteNode(nil->next);
}

void deleteLast(void) {
  deleteNode(nil->prev);
}

void deleteKey(int key) {
  deleteNode(listSearch(key));
}

void insert(int key) {
  Node *x = (Node *)malloc(sizeof(Node));
  x->key = key;
  x->next = nil->next;
  nil->next->prev = x;
  nil->next = x;
  x->prev = nil;
}

int main(void) {
  int key, n, i;
  int size = 0;
  int np = 0, nd = 0;
  char com[20];
  scanf("%d", &n);
  init();
  for(i=0;i<n;i++) {
    scanf("%s%d",com, &key);
    if (com[0] == 'i') {
      insert(key);
      np++;
      size++;
    } else if(com[0] == 'd') {
      if(strlen(com) > 6) {
        if(com[6] == 'F')
          deleteFirst();
        else if(com[6] == 'L')
          deleteLast();
      } else {
        deleteKey(key);
        nd++;
      }
      size--;
    }
  }
  printList();
  return 0;
}



Measured memory_bytes: 32952
#include<stdio.h>
#include<cstring>
#include<algorithm>
#include<vector>
#include<map>
#include<assert.h>
#include<set>
#include<cmath>
#include<queue>
#include<cstdlib>
#include<iostream>
#include<bitset>
#define pii pair<int,int>
#define fi first
#define se second
#define pb push_back
#define rep(i,j,k) for(int i=(int)(j);i<=(int)(k);i++)
#define per(i,j,k) for(int i=(int)(j);i>=(int)(k);i--)
using namespace std;
typedef long long LL;
//template
typedef double db;
const db eps=1e-10;
const db pi=acosl(-1.0);
int sign(db x){if(x<-eps)return -1;if(x>eps)return 1;return 0;}
int cmp(db x,db y){return sign(x-y);}
struct po{
	db x,y;
	po(db _x=0,db _y=0):x(_x),y(_y){}
};
po operator +(const po &a,const po &b){return po(a.x+b.x,a.y+b.y);}
po operator -(const po &a,const po &b){return po(a.x-b.x,a.y-b.y);}
po operator *(const po &a,const db &b){return po(a.x*b,a.y*b);}
po operator /(const po &a,const db &b){return po(a.x/b,a.y/b);}
db operator *(const po &a,const po &b){return a.x*b.x+a.y*b.y;}
db operator ^(const po &a,const po &b){return a.x*b.y-a.y*b.x;}
db mo2(po a){return a*a;}
db mo(po a){return sqrt(a*a);}
po proj(po x,po y){//proj x to y
	return y*((x*y)/mo2(y));
}
po refl(po x,po y){//refl x from y
	return proj(x,y)*2-x;
}
//template
int main(){
	po p1,p2;
	scanf("%lf%lf%lf%lf",&p1.x,&p1.y,&p2.x,&p2.y);
	int t;scanf("%d",&t);
	while(t--){
		po x;scanf("%lf%lf",&x.x,&x.y);
		po rp=refl(x-p1,p2-p1)+p1;
		printf("%.10lf %.10lf\n",rp.x,rp.y);
	}
	return 0;
}












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

public static class Program {
    static int mod=1000000007;
    public static void Main() {
        String s=Console.ReadLine();
        int n=s.Length;
        int[]a=new int[n];
        for(int i=0;i<n;i++){
            a[i]=s[i]-'0';
        }
        int d=int.Parse(Console.ReadLine());
        int[,]dp=new int[d,2];
        dp[0,0]=1;
        for(int i=0;i<n;i++){
            int[,]swp=new int[d,2];
            for(int j=0;j<d;j++){
                Add(ref swp[(j+a[i])%d,0], dp[j,0]);
                for(int k=0;k<a[i];k++){
                    Add(ref swp[(j+k)%d,1],dp[j,0]);
                }
                for(int k=0;k<10;k++){
                    Add(ref swp[(j+k)%d,1], dp[j,1]);
                }
            }
            dp=swp;
        }
        Console.WriteLine((dp[0,0]+dp[0,1]+mod-1)%mod);
    }
    public static void Add(ref int x, int y){
        x+=y;
        if(mod<=x)x-=mod;
    }
}


Measured memory_bytes: 17264
#include<stdio.h>
int main() {
	int n, a[3], i , x;
	scanf("%d", &n);
	a[0] = n / 100;
	a[1] = (n % 100) / 10;
	a[2] = n % 10;

	for (i = 1; i < 10; i++) {
		x = 100 * i + 10 * i + i;
		if (x >= n)break;
	}
	printf("%d\n", x);
	return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#define pi 3.141592653589793238
#define int long long
using namespace __gnu_pbds;
using namespace std;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

// mt19937 gen_rand_int(chrono::steady_clock::now().time_since_epoch().count());
// mt19937_64 gen_rand_ll(chrono::steady_clock::now().time_since_epoch().count());
// mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

long long power(long long a, long long b,long long m) {
    long long res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a %m;
        a = a * a %m;
        b >>= 1;
    }
    return res;
}

int pp[50];
signed main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);  
cout.tie(0);   

#ifndef ONLINE_JUDGE
    if(fopen("INPUT.txt","r"))
    {
    freopen ("INPUT.txt" , "r" , stdin);
    freopen ("OUTPUT.txt" , "w" , stdout);
    }
#endif  

    pp[0]=1;
    for(int i=1;i<=35;i++)
        pp[i]=(pp[i-1]*2);
    int n,k;
    cin>>n>>k;
    int a[n],b[n];
    for(int i=0;i<n;i++)
        cin>>a[i]>>b[i];
    int mx=0;
    for(int j=0;j<n;j++)
    {
        if((k&a[j])==a[j])
            mx+=b[j];        
    }

    for(int i=0;i<31;i++)
    {
        if(k&(pp[i]))
        {
            int tot=0;
            for(int j=0;j<n;j++)
            {
                int z=(k&a[j]);
                z=a[j]-z;
                if(z<pp[i] && (a[j]&pp[i])==0)
                {
                    tot+=b[j];
                }
            }
            mx=max(mx,tot);
        }
    }
    cout<<mx;
  
} 
    


Measured memory_bytes: 5136
#include <stdio.h>
#include <string.h>

char base[80];
char s1[80];
char s2[80];
char newstr[80];
char renketsu[10000][80];
int count;

void separate(int n,char str[])//分割
{
	int i,j;
	
	for(i=0;i<n;i++){
		s1[i]=str[i];
	}
	s1[i]='\0';
	for(j=0;str[i+j]!='\0';j++){
		s2[j]=str[i+j];
	}
	s2[j]='\0';
}
void append(char a[],char b[])//結合
{
	int i,j;
	
	for(i=0;a[i]!='\0';i++)newstr[i]=a[i];
	for(j=0;b[j]!='\0';j++)newstr[i+j]=b[j];
	newstr[i+j]='\0';
}
void reverse(char str[])
{
	int i;
	int lenght=strlen(str);
	char tmp;
	
	for(i=0;i<lenght/2;i++){
		tmp=str[i];
		str[i]=str[lenght-i-1];
		str[lenght-i-1]=tmp;
	}
}
int compare(char str[])
{
	int i;
	int flag=0;
	
	for(i=0;i<count;i++){
		if(strcmp(renketsu[i],str)==0){
			flag++;
		}
	}
	if(flag==0){
		return 1;
	}
	else{
		return 0;
	}
}
int check(char str[])
{
	int i,j;
	int len=strlen(str);
	
	for(i=1;i<len;i++){
		separate(i,str);
		
		append(s1,s2);//case1
		if(compare(newstr)==1){
			strcpy(renketsu[count],newstr);
			count++;
		}
		
		append(s2,s1);//case2
		if(compare(newstr)==1){
			strcpy(renketsu[count],newstr);
			count++;
		}
		
		reverse(s1);//case3
		append(s1,s2);
		if(compare(newstr)==1){
			strcpy(renketsu[count],newstr);
			count++;
		}
		
		append(s2,s1);//case4
		if(compare(newstr)==1){
			strcpy(renketsu[count],newstr);
			count++;
		}
		
		reverse(s2);//case5
		append(s1,s2);
		if(compare(newstr)==1){
			strcpy(renketsu[count],newstr);
			count++;
		}
		
		append(s2,s1);//case6
		if(compare(newstr)==1){
			strcpy(renketsu[count],newstr);
			count++;
		}
		
		reverse(s1);//case7
		append(s1,s2);
		if(compare(newstr)==1){
			strcpy(renketsu[count],newstr);
			count++;
		}
		
		append(s2,s1);//case8
		if(compare(newstr)==1){
			strcpy(renketsu[count],newstr);
			count++;
		}
	}
	
	return count;
}
int main(void)
{
	int num;
	int i;
	
	scanf("%d",&num);
	for(i=0;i<num;i++){
		scanf("%s",base);
		count=0;
		printf("%d\n",check(base));
	}
	
	return 0;
}


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

using namespace std;
static const int MAX = 200000;

int main()
{
  int R[MAX], n;

  cin >> n;

  for(int i = 0; i < n; i++)
		cin >> R[i];

	int maxv = -2000000000;
	int minv = R[0];

	for(int i = 1; i < n; i++)
	{
		maxv = max(maxv, R[i] - minv);
		minv = min(minv, R[i]);
	}

	cout << maxv << endl;

	return 0;
}	

Measured memory_bytes: 3836
#include <bits/stdc++.h>
#define ALL(A) (A).begin(), (A).end()
#define ll long long
#define rep(i, n) for (int i = 0; i < (n); i++)

const ll mod = 1e9 + 7;
const ll INF = -1 * ((1LL << 63) + 1);
const int inf = -1 * ((1 << 31) + 1);

using namespace std;

int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);
    int N,X;
    cin >> N >> X;
    vector<int> x(N);
    rep(i,N){
        cin >> x[i];
        x[i] -= X;
        x[i] = abs(x[i]);
    }
    int ans = x[0];
    rep(i,N) ans = __gcd(ans,x[i]);
    cout << ans << endl;
}

Measured memory_bytes: 640
import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String keyence = "keyence";
    String str = sc.next();
    boolean judge = false;
    char[] carr = str.toCharArray();
    char[] key =keyence.toCharArray();
    for(int i=0;i<keyence.length();i++){
      if(carr[i]==key[i]){
        if(i==keyence.length()-1){
          judge = true;
        }
        continue;
      }else{
  //      for(int j=i+1;j<str.length();j++){
  //        if(carr[j]!=key[i]){
  //          continue;
  //        }else{
            if(keyence.substring(i).equals(str.substring(str.length()-(keyence.length()-i-1)-1))){
              judge = true;
            }
  //          break;
  //        }
  //      }
        break;
      }
    }
if(judge){
  System.out.println("YES");
}else{
  System.out.println("NO");
}
  }
}


Measured memory_bytes: 22612
input()
n = list(map(int, input().split()))
c = 0
odd = False
while(True):
    for i in n:
        if(i % 2 != 0):
            odd = True
    if(odd == False):
        n = [i/2 for i in n]
        c += 1
        continue
    break
print(c)

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




void bubble_sort(double a[],int n){
    double tmp;
    int i,j;
    
    for(i=0;i<n;i++){
        for(j=n-1;j>i;j--){
            if(a[j]<a[j-1]){
                tmp = a[j-1];
                a[j-1]=a[j];
                a[j] = tmp;
            }
        }
    }
}
int main(void){
    // Your code here!
    int n,i;
    double ans=0.0;
    cin >> n;
    double a[50];
    
    for(i=0;i<n;i++)
        cin>>a[i];
        
   
    bubble_sort(a,n);
    

    ans=a[0];
    for(i=0;i<n;i++){
        ans+=pow(2.0,i)*a[i+1];
    }
    ans /=pow(2.0,n-1);
    cout << ans;
}

Measured memory_bytes: 256