akhauriyash/Code-Regression huggingface dataset:
import std.stdio, std.conv, std.functional, std.string;
import std.algorithm, std.array, std.container, std.typecons;
import std.numeric, std.math;
import core.bitop;

string FMT_F = "%.10f";

static string[] s_rd;
T RD(T = long)() { while(!s_rd.length) s_rd = readln.chomp.split; string res = s_rd[0]; s_rd.popFront; return res.to!T; }
string RDR()() { return readln.chomp; }
T[] ARR(T = long)(in string str, T fix = 0) { auto r = str.split.to!(T[]); r[] += fix; return r; }
size_t[] MAKE_IDX(alias less = "a < b", Range)(Range range) { auto idx = new size_t[](range.length); makeIndex!(less)(range, idx); return idx;}
size_t MIN_POS(alias less = "a < b", Range)(Range range) { auto r = minPos!(less)(range); return range.length - r.length; }

bool inside(T)(T x, T b, T e) { return x >= b && x < e; }
bool minimize(T)(ref T x, T y) { if (x > y) { x = y; return true; } else { return false; } }
bool maximize(T)(ref T x, T y) { if (x < y) { x = y; return true; } else { return false; } }

long mod = 10^^9 + 7;
void moda(ref long x, long y) { x = (x + y) % mod; }
void mods(ref long x, long y) { x = ((x + mod) - (y % mod)) % mod; }
void modm(ref long x, long y) { x = (x * y) % mod; }

void main()
{
	auto A = RD;
	auto B = RD;

	long[40] f(long x)
	{
		long[40] r;
		foreach (i; 0..40)
		{
			auto unit = pow(2LU, i);
			auto y    = x / unit / 2 * unit;
			if ((x / unit) % 2 == 1) y += x % unit;
			r[i] = y;
		}
		return r;
	}

	auto cnt_a = f(A);
	//stderr.writeln(cnt_a);
	auto cnt_b = f(B+1);
	//stderr.writeln(cnt_b);
	long ans;
	foreach (i; 0..40)
	{
		auto cnt = cnt_b[i] - cnt_a[i];
		if (cnt % 2 == 1)
			ans |= 1LU << i;
	}
	
	writeln(ans);
	stdout.flush();
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream>
#include <random>
#include <map>
#include <fstream>
#include <iomanip>
#include <time.h>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <assert.h>
#include <complex>
#include <omp.h>
using namespace std;
#define eps 0.000001
#define LONG_INF 100000000000000
#define GOLD 1.61803398874989484820458
#define seg_size 65536*4
#define REP(i,n) for(long long i = 0;i < n;++i)
unsigned long xor128() {
	static unsigned long x = time(NULL), y = 362436069, z = 521288629, w = 88675123;
	unsigned long t = (x ^ (x << 11));
	x = y; y = z; z = w;
	return (w = (w ^ (w >> 19)) ^ (t ^ (t >> 8)));
}
int main() {
	int n;
	cin >> n;
	int cnt[3] = {};
	int ans = 0;
	REP(i, n) {
		string a;
		cin >> a;
		for (int q = 0; q < a.length() - 1; ++q) {
			if (a[q] == 'A' && a[q + 1] == 'B') {
				ans++;
			}
		}
		if (a[0] == 'B' && a[a.length() - 1] == 'A') {
			cnt[2]++;
		}
		else if (a[0] == 'B') {
			cnt[0]++;
		}
		else if (a[a.length() - 1] == 'A') {
			cnt[1]++;
		}
	}
	if (cnt[1] != 0) {
		cnt[1]--;
		ans += cnt[2];
		cnt[2] = 0;
		if (cnt[0] != 0) {
			cnt[0]--;
			ans++;
		}
	}
	if (cnt[2] != 0) {
		ans += cnt[2] - 1;
		cnt[2] = 0;
		if (cnt[0] != 0) {
			cnt[0]--;
			ans++;
		}
	}
	ans += min(cnt[0], cnt[1]);
	cout << ans << endl;
}

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

int main(){
    ll n;
    cin>>n;
    vector<ll> sum(64);
    vector<ll> dat(n);
    rep(i,n){
        cin>>dat[i];
        rep(j,60){
            if((dat[i]>>j)&1) sum[j]++;
        }
    }
    ll now=n;
    ll ans=0;
    rep(i,60){
        n=now;
        rep(j,now-1){
            int num=1;
            rep(k,i) num=num*2%MOD;
            if((dat[j]>>i)&1){
                sum[i]--;
                n--;
                ans+=num*(n-sum[i])%MOD;
            }
            else{
                n--;
                ans+=num*(sum[i])%MOD;
            }
            ans%=MOD;
        }
    }
    cout<<ans<<endl;
}

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


int main(){
	bool checked[101]={};
	int a,b,c;
	cin >> a >> b >> c;
	checked[a] = true;
	checked[b] = true;
	checked[c] = true;
	int answer = 0;
	for(int i=1;i<101;i++){
		if(checked[i])answer++;
	}
	cout << answer << endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstring>
#include<cstdio>
using namespace std;
char a[100005],b[100005];
bool flag=false;
int main()
{
	cin>>a;
	//for(int i=0;i<strlen(a);i++)
	  //b[i]=a[strlen(a)-i-1];
	for(int i=0;i<strlen(a);i++){
		b[i]=a[strlen(a)-i-1];
		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';
	}
	for(int i=0;i<strlen(a);i++)
		if(a[i]!=b[i]) 
		  flag=true;
	if(flag==false) cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
	return 0;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
long long n,a,b;
int main()
{
    cin>>n>>a>>b;
    if(n>1&&b>=a||n==1&&a==b)
    {
	    cout<<(n-2)*(b-a)+1;
    } 
	else
    { 
        cout<<"0";
	} 
	return 0;
 } 

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

#define fi first
#define se second
#define pb push_back
#define int long long
#define all(x) (x).begin(), (x).end()

using LL = long long;
using LD = long double;
using pii = pair<int, int>;
using vii = vector<pii>;

const int INF = 1e18;
const int MOD = 1e9 + 7;
const int N = 1e5 + 5;

int a[11][1111];

int32_t main() {
    //ios::sync_with_stdio(false); cin.tie(nullptr);

    int n, m, k;
    cin >> n >> m >> k;

    for (int i = 0; i < n; i++) {
        string s;
        cin >> s;
        for (int j = 0; j < m; j++) {
            a[i][j] = s[j] - '0';
        }
    }

    int ans = n-1 + m-1;
    for (int mask = 0; mask < (1<<(n-1)); mask++) {
        int nn = __builtin_popcount(mask) + 1, till_now = 0, cnt = 0;
        vector<vector<int>> aa(nn,  vector<int>(m));
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < m; j++) {
                if (a[i][j] == 1) {
                    aa[till_now][j] += 1;
                }
            }
            if (mask & (1<<i)) till_now++;
        }
        int impossible = 0;
        for (int i = 0; i < nn and !impossible; i++) {
            for (int j = 0; j < m and !impossible; j++) {
                //cout << aa[i][j] << " ";
                if (aa[i][j] > k) {
                    impossible = 1;
                }
            }
            //cout << "\n";
        }
        if (impossible) {
        //cout << "impossible\n";
            continue;
        }
        //cout << "nn = " << nn << "\n";
        //cout << "mask = " << mask << "\n";
        vector<int> row_cnt(nn, 0);
        for (int col = 0; col < m; col++) {
            for (int row = 0; row < nn; row++) {
                row_cnt[row] += aa[row][col];
                if (row_cnt[row] > k) {
                    fill(all(row_cnt), 0);
                    col--;
                    cnt++;
                    break;
                }
            }
        }
        ans = min(ans, __builtin_popcount(mask) + cnt);
    }

    cout << ans << "\n";
}

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

int n,a[100005],b[100005],c[100005];
long long low[100005],hig[100005];

int main()
{
	ios::sync_with_stdio(false);
	
	cin>>n;
	
	for (register int i=1;i<=n;++i) cin>>a[i];
	for (register int i=1;i<=n;++i) cin>>b[i];
	for (register int i=1;i<=n;++i) cin>>c[i];
	
	sort(a+1,a+n+1); sort(b+1,b+n+1); sort(c+1,c+n+1);
	
	for (register int i=1;i<=n;++i)
		low[i]=(lower_bound(a+1,a+n+1,b[i])-a)-1;
	
	for (register int i=1;i<=n;++i)
		hig[i]=n+1-(upper_bound(c+1,c+n+1,b[i])-c);
	
	long long ans=0;
	
	for (register int i=1;i<=n;++i)
		ans+=low[i]*hig[i];
	
	cout<<ans<<endl;
	
	return 0;
}

Measured memory_bytes: 2944
#include<iostream>
using namespace std;
int main(){
  int n,m;
  int i,j,k;
  int mat[100][100]={{}};
  int ve[100]={};
  cin >> n >> m;
  for(i=0;i<n;i++){
    for(j=0;j<m;j++){
      cin >> mat[i][j];
    }
  }
  for(j=0;j<m;j++) cin >> ve[j];
  for(i=0;i<n;i++){
    int x=0;
    for(j=0;j<m;j++) x+=mat[i][j]*ve[j];
    cout << x << endl;		       
  }
  
  return 0;
}



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

#define f first
#define s second
#define pb push_back
#define ppb pop_back
#define mp make_pair
#define all(x) x.begin(), x.end()

using namespace std;

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
                                           	
const int N = 1e5 + 123, inf = 1e9 + 123, mod = 1e9 + 7;
const ll INF = 1e18;

ll w[N], v[N], dp[123][N];

int main() {
	cin.tie(0);  	
	cout.tie(0);
	ios_base::sync_with_stdio(0);
	int n, m;
	cin >> n >> m;
	for (int i = 1; i <= n; i++) {
		cin >> w[i] >> v[i];
	}
	dp[0][0] = 0;
	for (int i = 1; i <= n; i++) {
		for (int j = 1; j <= m; j++) {
			if (j >= w[i]) {
				dp[i][j] = max(dp[i - 1][j], dp[i - 1][j - w[i]] + v[i]);
			} else {
				dp[i][j] = dp[i - 1][j];
			}
		}
	}
	cout << dp[n][m];
	return 0;
}                                                

Measured memory_bytes: 81408
import fractions
a, b, c, d = map(int, input().split())

ans = b - (b // c + b//d - b//(c*d // fractions.gcd(c, d))) - ( a - 1  - ((a-1) // c + (a-1)//d - (a-1)//(c * d //fractions.gcd(c, d))))  

print(ans)

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

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

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

using namespace std;
using ll = long long;
using ld = long double;

#define st first
#define nd second

const int MAXN = 5e3 + 5, inf = 1e9;
const ll INF = 1e18;
const ld PI = 3.1415926535897932384626433832795;

int cnt[MAXN];
ll dp[MAXN], tab[MAXN];
bool vis[MAXN], used[MAXN];

vector<int> G[MAXN];
vector<ll> V;
set<ll> S;
map<ll, int> M;
stack<ll> St;
queue<ll> Q;

int LCS[MAXN][MAXN];

string calcLCS(string a, string b)
{
    int n = a.size(), m = b.size();
    for (int i = 1; i <= n; i++)
    {
        for (int j = 1; j <= m; j++)
        {
            LCS[i][j] = max(LCS[i - 1][j], LCS[i][j - 1]);
            if (a[i - 1] == b[j - 1])
            {
                LCS[i][j] = LCS[i - 1][j - 1] + 1;
            }
        }
    }

    //return LCS[n][m];

    string res;
    int x = n, y = m;
    while (x && y)
    {
        if (a[x - 1] == b[y - 1])
        {
            res += a[x - 1];
            x--, y--;
        }
        else
        {
            LCS[x - 1][y] > LCS[x][y - 1] ? x-- : y--;
        }
    }

    reverse(res.begin(), res.end());
    return res;
}

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout << setprecision(13) << fixed;

    //////////////////////////////////////////
    //////////////////////////////////////////

    string a, b;
    cin >> a >> b;
    cout << calcLCS(a, b) << "\n";
}


Measured memory_bytes: 59392
// Working program using Reader Class 
import java.io.*; 
import java.util.*; 

public class Main
{ 
	static class Reader 
	{ 
		final private int BUFFER_SIZE = 1 << 16; 
		private DataInputStream din; 
		private byte[] buffer; 
		private int bufferPointer, bytesRead; 

		public Reader() 
		{ 
			din = new DataInputStream(System.in); 
			buffer = new byte[BUFFER_SIZE]; 
			bufferPointer = bytesRead = 0; 
		} 

		public Reader(String file_name) throws IOException 
		{ 
			din = new DataInputStream(new FileInputStream(file_name)); 
			buffer = new byte[BUFFER_SIZE]; 
			bufferPointer = bytesRead = 0; 
		} 

		public String readLine() throws IOException 
		{ 
			byte[] buf = new byte[64]; // line length 
			int cnt = 0, c; 
			while ((c = read()) != -1) 
			{ 
				if (c == '\n') 
					break; 
				buf[cnt++] = (byte) c; 
			} 
			return new String(buf, 0, cnt); 
		} 

		public int nextInt() throws IOException 
		{ 
			int ret = 0; 
			byte c = read(); 
			while (c <= ' ') 
				c = read(); 
			boolean neg = (c == '-'); 
			if (neg) 
				c = read(); 
			do
			{ 
				ret = ret * 10 + c - '0'; 
			} while ((c = read()) >= '0' && c <= '9'); 

			if (neg) 
				return -ret; 
			return ret; 
		} 

		public long nextLong() throws IOException 
		{ 
			long ret = 0; 
			byte c = read(); 
			while (c <= ' ') 
				c = read(); 
			boolean neg = (c == '-'); 
			if (neg) 
				c = read(); 
			do { 
				ret = ret * 10 + c - '0'; 
			} 
			while ((c = read()) >= '0' && c <= '9'); 
			if (neg) 
				return -ret; 
			return ret; 
		} 

		public double nextDouble() throws IOException 
		{ 
			double ret = 0, div = 1; 
			byte c = read(); 
			while (c <= ' ') 
				c = read(); 
			boolean neg = (c == '-'); 
			if (neg) 
				c = read(); 

			do { 
				ret = ret * 10 + c - '0'; 
			} 
			while ((c = read()) >= '0' && c <= '9'); 

			if (c == '.') 
			{ 
				while ((c = read()) >= '0' && c <= '9') 
				{ 
					ret += (c - '0') / (div *= 10); 
				} 
			} 

			if (neg) 
				return -ret; 
			return ret; 
		} 

		private void fillBuffer() throws IOException 
		{ 
			bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE); 
			if (bytesRead == -1) 
				buffer[0] = -1; 
		} 

		private byte read() throws IOException 
		{ 
			if (bufferPointer == bytesRead) 
				fillBuffer(); 
			return buffer[bufferPointer++]; 
		} 

		public void close() throws IOException 
		{ 
			if (din == null) 
				return; 
			din.close(); 
		} 
	} 

	public static void main(String[] args) throws IOException 
	{ 
		//Scanner sc=new Scanner(System.in);
		Reader sc=new Reader();
		PrintWriter out=new PrintWriter(System.out);
		int k=sc.nextInt();
		long curr=7;
		boolean pos=false;
		for(int i=1;i<=k+1;i++){
		   // System.out.println(curr);
		    if(curr%k==0){
		        pos=true;
		        out.println(i);
		        break;
		    }
		    curr=curr*10+7;
		    curr=curr%k;
		}
		if(!pos){
		    out.println(-1);
		}
		out.flush();
	}
}


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

int main()
{
  long long  N;
  cin >> N;
  int ret = 20;
  for(long long a=1;(a*a)<=N;a++)
  {
    if(N%a == 0)
    {
      int c = 0;
      long long b = N/a;
      if(a > b) b = a;
      while(b != 0)
      {
        b /= 10;
        c++;
      }
      if(ret > c) ret = c;
    }
  }
  cout << ret << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
using namespace std;
#ifdef _DEBUG
#define dlog(str) cout << "====" << str << endl;
#else
#define dlog(str)
#endif
#define INF 999999999
#define MOD 1000000007
#define REP(i, n) for(int i = 0, i##_l = (n); i < i##_l; i++)
#define FOR(i, s, e) for(int i = s, i##_l = (e); i < i##_l; i++)
#define LLI long long int
#define _min(a, b) ((a < b) ? a : b)
#define _max(a, b) ((a < b) ? b : a)
#define chmax(a, b) a = _max(a, b)
#define chmin(a, b) a = _min(a, b)
#define bit(a, shift) ((a>>shift)&1))
#define pm(a) ((a) ? 1 : -1)
#define SORT(v) sort(v.begin(), v.end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
// int 2.14E±9    lli 9.2E±18    double 1.7E±380

int main() {
	string s;
	cin >> s;
	int st = 0;
	int ed = 0;
	REP(i, s.size()) {
		if (s[i] == 'A') {
			st = i;
			break;
		}
	}
	for (int i = s.size() - 1;0 <= i;i--) {
		if (s[i] == 'Z') {
			ed = i;
			break;
		}
	}
	cout << ed - st + 1;
	return 0;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
int a[100005],b[100005],n;
int main(){
	scanf("%d",&n);
	for(int i = 1;i <= n;i++){
		scanf("%d",&a[i]);
		b[a[i]] = i;
	}
	for(int i = 1;i < n;i++)
		printf("%d ",b[i]);
	printf("%d\n",b[n]);
	return 0;
}		

Measured memory_bytes: 1536
import java.util.*;
import java.io.*;
import static java.lang.Math.*;
import static java.util.Arrays.*;
import static java.util.Collections.*;

public class Main implements Runnable
{
//    static int dx[]={-1,0,1,0};
//    static int dy[]={0,-1,0,1};
    static long mod=1000000007;
    
    public static void main(String[] args) {        
        new Thread(null, new Main(), "", 200 * 1024 * 1024).start();        
    }

    public void run() {
        Reader sc = new Reader(System.in);
        PrintWriter out=new PrintWriter(System.out);

//        int n=sc.nextInt();


        out.println(sc.nextString().substring(0,3));
     	out.flush();
    }
        
    static void ret(String ans) {
    	System.out.println(ans);
    	System.exit(0);
    }

    static void ret(long ans) {
    	System.out.println(ans);
    	System.exit(0);
    }
    
    static boolean validpos(int x,int y,int r, int c){
        return x<r && 0<=x && y<c && 0<=y;
    }

    static void db(Object... os){
        System.err.println(Arrays.deepToString(os));
    }
}

class P {
	int x,y,c;
	P(int  x, int y, int c) {
	  this.x=x;
	  this.y=y;
	  this.c=c;
	}
}

//
//class P implements Comparable<P>{
//	int x,c;long s;
//	P(int  x, int c, long s) {
//	  this.x=x;
//	  this.c=c;
//	  this.s=s;
//	}
//
//    public int compareTo(P p){
//        return Long.signum(s-p.s);
//    }
//}

class Reader
{ 
    private BufferedReader x;
    private StringTokenizer st;
    
    public Reader(InputStream in)
    {
        x = new BufferedReader(new InputStreamReader(in));
        st = null;
    }
    public String nextString()
    {
        while( st==null || !st.hasMoreTokens() )
			try {
				st = new StringTokenizer(x.readLine());
			} catch (IOException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
        return st.nextToken();
    }
    public int nextInt()
    {
        return Integer.parseInt(nextString());
    }
    public int[] nextIntArray(int size) {
        int r[] = new int[size];
        for (int i = 0; i < size; i++) {
            r[i] = this.nextInt(); 
        }
        return r;
    }
    public long[] nextLongArray(int size) {
        long r[] = new long[size];
        for (int i = 0; i < size; i++) {
            r[i] = this.nextLong(); 
        }
        return r;
    }
    public char[] getCharSet() {
        return this.nextString().toCharArray();
    }    
    public long nextLong()
    {
        return Long.parseLong(nextString());
    }
    public double nextDouble() throws IOException
    {
        return Double.parseDouble(nextString());
    }
}


Measured memory_bytes: 32904
#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 ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
constexpr ll  MOD = (1e9+7);
constexpr int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
constexpr int lcm(int a, int b) { return a / gcd(a, b) * b; }

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;
}
ll factorial(ll n, ll m=2) {
    // calculate n!
    m = max(2LL, m);
    ll rtn = 1;
    for (ll i=m; i<=n; i++) {
        rtn = (rtn * i) % MOD;
    }
    return rtn;
}
ll modinv(ll a, ll m) {
    ll b = m, u = 1, v = 0;
    while (b) {
        ll t = a / b;
        a -= t * b;
        swap(a, b);
        u -= t * v;
        swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}
ll modpow(ll a, ll n) {
    ll res = 1;
    while (n > 0) {
        if (n & 1)
            res = res * a % MOD;
        a = a * a % MOD;
        n >>= 1;
    }
    return res;
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n; cin >> n;
    vector<int> s(n);
    rep(i, n) cin >> s[i];
    sort(ALL(s));
    int ans = accumulate(ALL(s), 0);
    if (ans % 10 != 0) {
        cout << ans << endl;
        return 0;
    }
    rep(i, n) {
        if (s[i] % 10 != 0) {
            ans -= s[i];
            cout << ans << endl;
            return 0;
        }
    }
    cout << 0 << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
long gcd(long x,long y){
  if(x%y==0)return y;
  return gcd(y,x%y);
}
int main(){
  long A,B;cin>>A>>B;
  long g=gcd(A,B);
  if(g==1){cout<<1;return 0;}
  //最大公約数
  //最大公約数の素因数の数
  long ans=1;
  long tmp=2;
  while(tmp*tmp<=g){
    //cout<<g<<" "<<ans<<endl;
    if(g%tmp==0)ans++;
    while(g%tmp==0)g/=tmp;
    tmp++;
  }
  if(g!=1)ans++;
  cout<<ans;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#include <cmath>
#include <bitset>
#include <iomanip>
#include <stack>
#include <list>
#include <map>
#include <unordered_map>
#include <chrono>
#include <numeric>
using namespace std;
using ll = long long;
const ll INF = (ll)1e18+1;
const ll DIV = 1000000007;
//#define TEST
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
#ifdef TEST
    chrono::system_clock::time_point start, end;
    start = chrono::system_clock::now();
#endif
    long N;
    cin >> N;
    ll count = 0;
    vector<long> p(N);
    for(size_t i=0;i<N; i++)
    {
        cin >> p[i];
        if(p[i] != i+1) count++;
    }
    if(count==0 || count==2) cout << "YES" << endl;
    else cout << "NO" << endl;
#ifdef TEST
    end = chrono::system_clock::now();
    cerr << static_cast<double>(chrono::duration_cast<chrono::microseconds>(end - start).count() / 1000.0) << "[ms]" << endl;
#endif
    return 0;
}

Measured memory_bytes: 3640
x1, y1, x2, y2 = map(int, input().split())

dx = x2 - x1
dy = y2 - y1

x3 = x2 - dy
y3 = y2 + dx
x4 = x1 - dy
y4 = y1 + dx

print(x3, y3, x4, y4)

Measured memory_bytes: 3060
import java.util.Scanner;

class Main{
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int bunbo=0;
		int bunsi=0;
		int kurai=0;
		while(sc.hasNext()){
			bunsi=Integer.parseInt(sc.next());
			bunbo=Integer.parseInt(sc.next());
			kurai=Integer.parseInt(sc.next());
			int kotae=wa(bunsi,bunbo,kurai,0);
			System.out.println(kotae);
		}

	}

	public static int wa(int a,int b,int c ,int d) {
		int souwa=d;
		a=a%b;
		int res=(a*10)/b;
		a=(10*a)%b;
		if(c==0) {return souwa;}
		else{souwa+=res+wa(a,b,c-1,souwa);
		return souwa;
		}
	}
}


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

int sum(int x){
  int s = 0;
  while(x > 0){
    s += x % 10;
    x /= 10;
  }
  return s;
}

int main(){
  int n; cin >> n;
  
  int m = 1000000;
  for(int i = 1; i < n; i++){
    int a = i; int b = n-i;
    if(sum(a) + sum(b) < m) m = sum(a) + sum(b);
  }
  cout << m << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const long long INF = 1LL << 60; //intじゃ扱えないことに注意！
#define mod 1000000007
#define rep(i, n) for(int i = 0; i < (int)(n); i++) //範囲外参照とループの初期化に注意！

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

  int a,b;
  vector<int> P(N),Q(N);
  for(int i = 0; i < N; i++){
    cin >> P[i];
  }
  for(int i = 0; i < N; i++){
    cin >> Q[i];
  }
  
  vector<int> c(N);
  for(int i = 0; i < N; i++){
    c[i] += i+1;
  }
  
  int j = 0;
  do{
    if(c==P){
      a = j;
    }
    if(c==Q){
      b = j;
    }
    j++;
  }while(next_permutation(c.begin(), c.end()));

  cout << abs(a-b) << endl;

}

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

#define rep(i, n) for (int i = 0; i < int(n); i++)
#define rrep(i, n) for (int i = int(n) - 1; i >= 0; i--)
#define reps(i, n) for (int i = 1; i <= int(n); i++)
#define rreps(i, n) for (int i = int(n); i >= 1; i--)
#define repc(i, n) for (int i = 0; i <= int(n); i++)
#define rrepc(i, n) for (int i = int(n); i >= 0; i--)
#define repi(i, a, b) for (int i = int(a); i < int(b); i++)
#define repic(i, a, b) for (int i = int(a); i <= int(b); i++)
#define each(x, y) for (auto &x : y)
#define all(a) (a).begin(), (a).end()
#define bit(b) (1ll << (b))

using namespace std;

using i32 = int;
using i64 = long long;
using u64 = unsigned long long;
using f80 = long double;
using vi32 = vector<i32>;
using vi64 = vector<i64>;
using vu64 = vector<u64>;
using vf80 = vector<f80>;
using vstr = vector<string>;

inline void yes() { cout << "Yes" << '\n'; exit(0); }
inline void no() { cout << "No" << '\n'; exit(0); }
inline i64 gcd(i64 a, i64 b) { if (min(a, b) == 0) return max(a, b); if (a % b == 0) return b; return gcd(b, a % b); }
inline i64 lcm(i64 a, i64 b) { return a / gcd(a, b) * b; }
inline u64 xorshift() { static u64 x = 88172645463325252ull; x = x ^ (x << 7); return x = x ^ (x >> 9); }
void solve(); int main() { ios::sync_with_stdio(0); cin.tie(0); cout << fixed << setprecision(16); solve(); return 0; }
template <typename T> class pqasc : public priority_queue<T, vector<T>, greater<T>> {};
template <typename T> class pqdesc : public priority_queue<T, vector<T>, less<T>> {};
template <typename T> inline void amax(T &x, T y) { if (x < y) x = y; }
template <typename T> inline void amin(T &x, T y) { if (x > y) x = y; }
template <typename T> inline T power(T x, i64 n, T e = 1) { T r = e; while (n > 0) { if (n & 1) r *= x; x *= x; n >>= 1; } return r; }
template <typename T> istream& operator>>(istream &is, vector<T> &v) { each(x, v) is >> x; return is; }
template <typename T> ostream& operator<<(ostream &os, vector<T> &v) { rep(i, v.size()) { if (i) os << ' '; os << v[i]; } return os; }
template <typename T, typename S> istream& operator>>(istream &is, pair<T, S> &p) { is >> p.first >> p.second; return is; }
template <typename T, typename S> ostream& operator<<(ostream &os, pair<T, S> &p) { os << p.first << ' ' << p.second; return os; }

i64 dp[410][410];
i64 co[410][410];

void solve() {
  int n; cin >> n;
  vi32 a(n); cin >> a;
  for (int l = 0; l <= n; l++) {
    for (int r = 0; r <= n; r++) {
      dp[l][r] = 1e18;
      co[l][r] = 1e18;
    }
  }
  for (int l = 0, r = 1; r <= n; l++, r++) {
    dp[l][r] = a[l];
    co[l][r] = 0;
  }
  for (int s = 2; s <= n; s++) {
    for (int l = 0, r = s; r <= n; l++, r++) {
      for (int m = l + 1; m < r; m++) {
        dp[l][r] = min(dp[l][r], dp[l][m] + dp[m][r]);
        co[l][r] = min(co[l][r], dp[l][r] + co[l][m] + co[m][r]);
      }
    }
  }
  cout << co[0][n] << '\n';
}


Measured memory_bytes: 2816
from sys import stdout
printn = lambda x: stdout.write(str(x))
inn = lambda : int(input())
inl   = lambda: list(map(int, input().split()))
inm   = lambda:      map(int, input().split())
ins = lambda : input().strip()
DBG = True # and False
BIG = 999999999
R = 10**9 + 7

def ddprint(x):
  if DBG:
    print(x)

n = inn()
a = []
for i in range(n):
    a.append(inl())
c = [[True]*n for i in range(n)]
for i in range(n-2):
    for j in range(i+1,n-1):
        for k in range(j+1,n):
            if a[i][j] > a[i][k]+a[k][j] or \
               a[i][k] > a[i][j]+a[j][k] or \
               a[k][j] > a[k][i]+a[i][j]:
                print(-1)
                exit()
            elif a[i][j] == a[i][k]+a[k][j]:
                c[i][j] = False
            elif a[i][k] == a[i][j]+a[j][k]:
                c[i][k] = False
            elif a[k][j] == a[k][i]+a[i][j]:
                c[j][k] = False
sm = 0
for i in range(n-1):
    for j in range(i+1,n):
        if c[i][j]:
            sm += a[i][j]
print(sm)


Measured memory_bytes: 45020
scount=Array.new
hcount=Array.new
ccount=Array.new
dcount=Array.new
for i in 1..13 do
  scount[i]=0
  hcount[i]=0
  ccount[i]=0
  dcount[i]=0
end
n=gets.chomp.to_i
for i in 1..n do
  input=gets.chomp
  line=input.split
  if line[0]=='S' then
    scount[line[1].to_i]=1
  elsif line[0]=='H' then
    hcount[line[1].to_i]=1
  elsif line[0]=='C' then
    ccount[line[1].to_i]=1
  elsif line[0]=='D' then
    dcount[line[1].to_i]=1
  end
end
for i in 1..13 do
  if scount[i]==0
    puts "S #{i}"
  end
end
for i in 1..13 do
  if hcount[i]==0
    puts "H #{i}"
  end
end
for i in 1..13 do
  if ccount[i]==0
    puts "C #{i}"
  end
end
for i in 1..13 do
  if dcount[i]==0
    puts "D #{i}"
  end
end

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

using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
using pint = pair<int, int>;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

int main() {
    int n;
    cin >> n;
    map<string, int> s;
    for (int i = 0; i < n; ++i) {
        string str;
        cin >> str;
        s[str];
    }
    cout << s.size() << endl;
    return 0;
}

Measured memory_bytes: 19128
#include <bits/stdc++.h>
using namespace std;
#define all(n) begin(n), end(n)
const long long INF = numeric_limits<long long>::max();
typedef long long ll;
typedef vector<int> vint;
typedef vector<vector<int>> vvint;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef unsigned long long ull;
template <class T>
bool chmax(T &a, const T &b)
{
    if (a < b)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T &a, const T &b)
{
    if (b < a)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <typename T>
vector<T> make_v(size_t a) { return vector<T>(a); }

template <typename T, typename... Ts>
auto make_v(size_t a, Ts... ts)
{
    return vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...));
}
template <typename T, typename V>
typename enable_if<is_class<T>::value == 0>::type
fill_v(T &t, const V &v) { t = v; }

template <typename T, typename V>
typename enable_if<is_class<T>::value != 0>::type
fill_v(T &t, const V &v)
{
    for (auto &e : t)
        fill_v(e, v);
}
int main()
{
    ll D;
    cin >> D;
    vll c(26+1);
    for (size_t i = 1; i <= 26; i++)
    {
        cin >> c[i];
    }
    auto s = make_v<ll>(D+1, 26+1);
    for (size_t i = 1; i <= D; i++)
    {
        for (size_t j = 1; j <= 26; j++)
        {
            cin >> s[i][j]; //s[i][j] := i日目にコンテストjを開催したときの満足度の増加量
        }
    }
    vll t(D+1);
    auto last = make_v<ll>(D+1, 26+1);
    for (size_t i = 1; i <= D; i++)
    {
        cin >> t[i];
        last[i][t[i]]=i; //i日目以前にタイプt[i]のコンテストを開催した最後の日
        for (size_t j = 0; j <= 26; j++)
        {
            if(j==t[i])continue;

            chmax(last[i][j],last[i-1][j]);
        }
    }

    ll score = 0;

    for (int i = 1; i <= D; i++)
    {
        score += s[i][t[i]];
        ll decrease = 0;
        for (int j = 1; j <= 26; j++)
        {
            decrease += c[j]*(i-last[i][j]);
        }
        score -= decrease;
        cout<<score<<endl;
    }

    return 0;
}

Measured memory_bytes: 3808
N, *P = map(int, input().split())
L = [int(input()) for _ in range(N)]

mp = sum(P) - 30

minmp = 1e10
Pcnt = [0] * 3
Ks = [-1] * N

while True:

    i = N-1
    while i >= 0:
        pre = cur = Ks[i]
        cur += 1
        if cur >= 3:
            cur = -1
        Ks[i] = cur

        for d, x in ((-1, pre), (1, cur)):

            if x >= 0:
                Pcnt[x] += d
                mp -= abs(P[x])
                P[x] -= d * L[i]
                mp += abs(P[x]) + d * 10

        if cur >= 0:
            break
        i -= 1
    else:
        break

    if min(Pcnt) > 0:
        minmp = min(minmp, mp)

print(minmp)


Measured memory_bytes: 3064
S=input()
l=[]

def func(a):
    return True if a!='' else False

for start in range(len(S)):
    for end in range(0,len(S)):
       l.append(S[start:end+1])

l = list(filter(func,l))

o=[]
r=[]
for m in l:
    for n in m:
        if n!='A' and n!='C' and n!='G' and n!='T':
            o.append(m)
            break

for p in o:
    l.remove(p)

for q in l:
    r.append(len(q))


if len(r)==0:
    print(0)
else:
    print(max(r))


Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define debug cerr << __LINE__ << endl
using namespace std;
typedef long long int ll;
typedef vector<int> vi;
typedef vector<vi> vvi;



ll k;
int main(void){
	cin >> k;
	for(int i=1;i<10;i++){
		cout << i << endl;
		k--; if (k==0) return 0;
	}
	for(int i=19;i<100;i+=10){
		cout << i << endl;
		k--; if (k==0) return 0;
	}


	/*for(int i=2;;i++){
		string base = "";
		if (i<12){
			for(int j=0;j<i-1;j++) base += "9";
			for(int j=1;j<10;j++){
				cout << j << base << endl;
				k--; if (k==0) return 0;
			}
		}else{
			for(int j=0;j<i-2;j++) base += "9";
			for(int j=10;j<100;j++){
				cout << j << base << endl;
				k--; if (k==0) return 0;
			}			
		}
	}*/
	ll power = 1;
	for(int p=0;;p++){
		for(ll a=1;a<10;a++){
			for(ll b=0;b<10;b++){
				for(ll c=0;c<10;c++){
					//try (a*100+b*10+c) * 10^p + 999...999(10^p-1)
					ll numer = (a*100+b*10+c) * power + power - 1, denom = a + b + c + 9*p;
					if (c!=9 && denom * power < numer) continue;
					if (b!=9 && denom * power*10 < numer) continue;
					if (a!=9 && denom * power*100 < numer) continue;
					cout << numer << endl;
					k--; if (k==0) return 0;
				}
			}
		}
		power *= 10;
	}

	return 0;
}


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

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

  for (int i = a; i <= min(b, a+k-1); i++) printf("%d\n", i);
  for (int i = max(b-k+1, a+k); i <= b; i++) printf("%d\n", i);
}

Measured memory_bytes: 3764
import java.util.*;
import java.io.*;
public class Main{
	public static void main(String[] args) {
		Scanner scn=new Scanner(System.in);
		int N = scn.nextInt();
		String S = scn.next();
		int[] visited1 = new int[26];
		int[] visited2 = new int[26];
		int c1=0, c2=0, max=-1;
		for(int i=0;i<N;i++){
			char ch=S.charAt(i);
			if ( visited1[ch-'a'] == 0){
				c1++;
			}
			visited1[ch-'a']++;
			
		}
		for(int i=0;i<N;i++){
			char ch=S.charAt(i);
			visited1[ch-'a']--;
			if ( visited1[ch-'a'] == 0){
				c1--;
			}
			if ( visited2[ch-'a'] == 0){
				c2++;
			}
			visited2[ch-'a']++;
			max=Math.max(max, countSame(visited1, visited2));
		}
		System.out.println(max);
	}
	static int countSame(int[] visited1, int[] visited2){
		int rv= 0;
		for(int i=0;i<26;i++){
			if(visited1[i]!=0 && visited2[i]!=0)
				rv++;
		}
		return rv;
	}
}


//gxdqkzhyutjlpt fxocrylqjnmubi

Measured memory_bytes: 20948
i;j;M;m;main(N,q){
int c[9]={};
for(scanf("%d",&N);i++<N;){
	scanf("%d",&q);
  	q/=400;
  	q<8?c[q]=1:M++;
}
for(;j<8;j++)M+=c[j],m+=c[j];
m?:m++;
printf("%d %d",m,M);
}

Measured memory_bytes: 1696
import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        int N = S.length();
        char[] cArray = S.toCharArray();

        long weight = 0;
	long cnt = 0;
	for(int i = N-1; i>=0; i--) {
            if(cArray[i] == 'W') weight++;
            if(cArray[i] == 'B') cnt = cnt + weight;
        }

	System.out.println(cnt);
    }
}

Measured memory_bytes: 25940
v[2][12];n,j,c,t;main(i){for(;scanf("%d",&n)*n;){for(;j<n;)scanf("%d",*v+j++);for(;memcmp(v,v+1,n*4);++c)for(i=n;i--;v[~c&1][i]=t)for(j=t=n;j--;)t-=v[c&1][i]!=v[c&1][j];for(printf("%d\n",c-1);++i<n;)printf("%d%c",v[j=c=0][i],n+~i?32:10);}}

Measured memory_bytes: 0
import itertools

N = int(input())
xy = [[0.0, 0.0]] * N
for i in range(N):
  xy[i] = list(map(int, input().split()))

def distance(a, b):
  res = (a[0]-b[0])**2 + (a[1]-b[1])**2
  return res ** 0.5
  
ans = 0.0
cnt = 0
perms = itertools.permutations(range(N))
for perm in perms:
  cnt += 1
  for j in range(N-1):
    a = perm[j]
    b = perm[j+1]
    ans += distance(xy[a], xy[b])

ans /= cnt
print(ans)


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

int main() {
  long long N, K;
  cin >> N >> K;
  
  vector<long long> A(N);
  for (long long i = 0; i < N; i++) {
    cin >> A[i];
  }
  
  unordered_map<int, int> teleport;
  
  long long idx = 1;
  long long count = 1;
  long long prev_idx = 0;
  for (; count <= K; count++) {
    idx = A[idx-1];
    if(teleport.find(idx) == teleport.end()) {
      teleport.insert(pair<int, int>(idx, count));
    } else {
      prev_idx = teleport[idx];
      break;
    }
  }
  //cerr << count << endl;  
  //cerr << prev_idx << endl;
  
  long long mod = (K-count)%(count-prev_idx);
  for (long long i = 0; i < mod; i++) {
    idx = A[idx-1];
  }
  
  cout << idx << endl;
  return 0;
}

Measured memory_bytes: 11880
#pragma GCC optimize "O3"

#define F first
#define S second

#include<bits/stdc++.h>

using namespace std;

typedef long long LL;

const int N = 8100;

string str;
int n, tx, ty;
vector<int> v[2];
bitset<2*N+1> vis[2];

bool check(const vector<int> &vi, int t) {
  vis[0].reset();
  bool cur = false;
  vis[0][N] = true;
  for(int x : vi) {
    cur = !cur;
    vis[cur] = (vis[!cur] << x) | (vis[!cur] >> x);
  }
  return vis[cur][t + N];
}

bool solve() {
  cin >> str >> tx >> ty;
  n = str.size();
  int i = 0;
  while(i < n && str[i] == 'F') {
    ++i;
  }
  tx -= i;
  bool d = false;
  while(i < n) {
    int tcnt = 0;
    while(i < n && str[i] == 'T') {
      ++tcnt;
      ++i;
    }
    if(i == n)
      break;
    if(tcnt & 1)
      d = !d;
    int fcnt = 0;
    while(i < n && str[i] == 'F') {
      ++fcnt;
      ++i;
    }
    v[d].push_back(fcnt);
  }
  return check(v[0], abs(tx)) && check(v[1], abs(ty));
}

int main() {
  puts(solve() ? "Yes" : "No");
}


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

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

signed main() {
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);

  string s, t;
  cin >> s >> t;

  int a, b;
  cin >> a >> b;

  string u;
  cin >> u;

  if ( u == s ) a--;
  if ( u == t ) b--;
  cout << a << " " << b << endl;
  
  return 0;
}


Measured memory_bytes: 256
import sys
import numpy as np

def main():

    # sys.stdin = open('input_b.txt')
    input = sys.stdin.readline

    n, k = map(int, input().split())
    h = tuple(map(int, input().split()))

    # dp = [0] + [float('inf')] * (n - 1)
    dp = np.zeros(n, dtype=int)
    h = np.array(h)


    for i in range(1, n):
        start = max(0, i-k)
        
        dp[i] = min(dp[start: i] + np.abs(h[i] - h[start : i]))

    print(dp[n-1])



if __name__ == '__main__':
    main()


Measured memory_bytes: 23260
IDENTIFICATION DIVISION.
PROGRAM-ID. 158D.
ENVIRONMENT DIVISION.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
  SELECT STDIO ASSIGN TO KEYBOARD. 
*>
DATA DIVISION.
FILE SECTION.
FD STDIO.
01 INP        PIC X(100000).
*>
WORKING-STORAGE SECTION.
01 IN2        PIC X(20).
01 Q          PIC 9(6).
01 POS1       PIC 9(6) COMP.
01 POS2       PIC 9(6) COMP.
01 POS1W      PIC 9(6) COMP.
01 POS2W      PIC 9(6) COMP.
01 FORMA.
   03 FILLER  PIC X(200000).
   03 S       PIC X(100000).
   03 FILLER  PIC X(200000).
01 FORMA-R    REDEFINES FORMA.
   03 S-R     PIC X(1) OCCURS 500000.
01 T          PIC 9(1).
01 F          PIC 9(1).
01 C          PIC X(1).
01 W          PIC X(1).
01 I          PIC 9(6) COMP.
01 F-T        PIC S9(1).
*> 
PROCEDURE DIVISION.
MAIN-001.
  OPEN INPUT STDIO.
  READ STDIO.
  CLOSE STDIO.
*>
  UNSTRING INP DELIMITED BY ALL ' '
      INTO S COUNT POS2.
  COMPUTE POS1 = 1    + 200000.
  COMPUTE POS2 = POS2 + 200000.
*>  
  ACCEPT Q.
*>
  MOVE 1 TO F-T.
  PERFORM VARYING I FROM 1 BY 1
            UNTIL I > Q
    ACCEPT IN2
    UNSTRING IN2 DELIMITED BY ALL ' '
        INTO T F C
*>
    IF (T = 1)
      COMPUTE F-T = F-T * -1
      MOVE POS1  TO POS1W
      MOVE POS2  TO POS1
      MOVE POS1W TO POS2
    ELSE
      IF (F = 1)
        COMPUTE POS1 = POS1 - F-T
        MOVE C           TO S-R(POS1)
      ELSE
        COMPUTE POS2 = POS2 + F-T
        MOVE C           TO S-R(POS2)
      END-IF
    END-IF
  END-PERFORM.
 
  IF (F-T = -1)
    MOVE POS1  TO      POS1W
    MOVE POS2  TO POS1 POS2W
    MOVE POS1W TO POS2
*>
    PERFORM UNTIL (POS1W <= POS2W)
      MOVE S-R(POS1W) TO W
      MOVE S-R(POS2W) TO S-R(POS1W)
      MOVE W          TO S-R(POS2W)
      COMPUTE POS1W = POS1W - 1
      COMPUTE POS2W = POS2W + 1
    END-PERFORM
  END-IF.
*>
  DISPLAY FORMA(POS1:POS2 - POS1 + 1).
*>
MAIN-EXIT.
  STOP RUN.

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

int main() {
	int N, T, A;
	cin >> N >> T >> A;
	vector<int> hight(N);
	vector<double> temp(N);
	for (int i = 0; i < N; i++) {
		cin >> hight.at(i);
		temp.at(i) = abs(T - hight.at(i) * 0.006 - A);
	}
	vector<double> mini = { 1,temp.at(0) };
	for (int i = 1; i < N; i++) {
		if (temp.at(i) < mini.at(1))
			mini = { i + 1,temp.at(i) };
	}

	cout << mini.at(0) << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ

		Scanner sc = new Scanner(System.in);
		double a = sc.nextInt();
		double b = sc.nextInt();
		double x = 0;

		if((a + b) % 2 == 0)
			x = (a + b) / 2;
		else
			x = ((a + b) / 2) + 1;

		System.out.println((int)x);

		sc.close();
	}

}

Measured memory_bytes: 21844
//#include<bits/stdc++.h>
#include<iostream>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>

/*
#include<boost/multiprecision/cpp_int.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/rational.hpp>
namespace mp = boost::multiprecision;
using Real = mp::number<mp::cpp_dec_float<1024>>;
using Bint = mp::cpp_int;
*/

using namespace std;

#define int long long
#define REP(i,s,e) for((i)=(s);(i)<(e);(i)++)
#define RREP(i,s,e) for((i)=((s)-1);(i)>=(e);(i)--)
#define FOR(i,n) for((i)=(0);(i)<(n);(i)++)
#define RFOR(i,n) for((i)=((n)-1);(i)>=(0);(i)--)
#define MOD 1000000007
#define NMAX 200000

signed main(){   
    int x;
    for(int i=1;i<=5;i++){
        cin>>x;
        if(x==0){
            cout<<i<<endl;
        }
    }
}


Measured memory_bytes: 3120
#include <stdio.h>
#include <math.h>

int time(int a, int b) {
	if ((long long int)a * b >= 0) return (abs(a) > abs(b)) ? abs(a) : abs(b);
	else return (2 * b - a > b - 2 * a) ? b - 2 * a : 2 * b - a;
}

int main() {
	int i, n, k, x[100010], r, l, t, min_t;
	scanf("%d%d", &n, &k);
	for (i = 0; i < n; i++) scanf("%d", &x[i]);
	for (i = 0; i + k - 1 < n; i++) {
		l = i; r = i + k - 1;
		t = time(x[l], x[r]);
		if (i == 0) min_t = t;
		if (min_t > t) min_t = t;
	}
	printf("%d", min_t);
	return 0;
}

Measured memory_bytes: 512
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scanner = new Scanner(System.in);
		
		int m =scanner.nextInt();
		String a = scanner.next();
		int n= a.length();
		
		char[] c = a.toCharArray();
		
		for(int i = 0 ;i<n;i++) {
			if(i>m-1) {
				if(n>m) {
				System.out.println("...");
				}
				break;
			}
			System.out.print(c[i]);
		}		
	}
}

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

using namespace std;

#define frei(i,a,b) for (int i = (a), _b = (b); i <= _b; i++)
#define fred(i,a,b) for (int i = (a), _b = (b); i >= _b; i--)
#define fri(i,n) for (int i = 0, _n = (n); i < _n; i++)
#define frd(i,n) for (int i = (n) - 1; i >= 0; i--)
#define foreach(it, ar) for ( typeof(ar.begin()) it = ar.begin(); it != ar.end(); it++ )

#define uint64 unsigned long long
#define int64 long long
#define all(ar) ar.begin(), ar.end()
#define pb push_back
#define pf push_front
#define mp make_pair
#define ff first
#define ss second
#define pr pair

#define BIT(n) (1<<(n))
#define AND(a,b) ((a) & (b))
#define OR(a,b) ((a) | (b))
#define XOR(a,b) ((a) ^ (b))
#define sqr(x) ((x) * (x))

typedef pair<int, int> pii;
typedef pair<int, pii> piii;
typedef vector<pii> vii;
typedef vector<int> vi;

#define PI 3.1415926535897932385
#define INF 1000111222
#define eps 1e-7
#define maxN 5005

const int nax = 1e5 + 5;
vector<int> g[nax];
int dist[nax];
int in_degree[nax];
bool visited[nax];

void dfs(int u) {
    visited[u] = true;
    for(auto next : g[u]) {
        dist[next] = max(dist[next], dist[u] + 1);
        --in_degree[next];
        if(in_degree[next] == 0) dfs(next);
    }
}

int main(int argc, char const *argv[])
{
    /* code */
    int n, m;
    cin >> n >> m;
    while(m--) {
        int a, b;
        cin >> a >> b;
        g[a].push_back(b);
        ++in_degree[b];
    }
    for(int i = 1; i <= n; i++) {
        if(!visited[i] && in_degree[i] == 0) {
            dfs(i);
        }
    }
    int ans = 0;
    for(int i = 1; i <= n; i++) ans = max(ans, dist[i]);
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 9728
#include<stdio.h>
int mini(int x, int y){ return x < y ? x : y; }
int main(){
  int i,j,k,l,n;
  int o[100],p[100][100];
  scanf("%d", &n);
  for ( i = 1; i <= n; i++ ){
    scanf("%d %d", &o[i-1], &o[i]);
  }
  for ( i = 1; i <= n; i++ ) p[i][i] = 0;
  for ( l = 2; l <= n; l++ ){
    for ( i = 0; i <= n-l+1; i++ ){
      j = i+l-1;
      p[i][j] = (1<<21);
      for ( k = i; k <= j-1; k++ ){
	p[i][j] = mini(p[i][j],p[i][k]+p[k+1][j]+o[i-1]*o[k]*o[j]);
      }
    }
  }
  printf("%d\n",p[1][n]);
  return 0;
}



Measured memory_bytes: 2032
#include <iostream>
using namespace std;
int selectionSort(int A[],int N){
	int sw=0,mini=0,t,i,j;//swap?????°????¨?????????????
	for(int i=0;i<N-1;i++){
		mini=i;
		for(int j=i;j<N;j++){
			
			if(A[j]<A[mini]){
				mini=j;
			}
		}
		t=A[i];A[i]=A[mini];A[mini]=t;
		if(i!=mini)sw++;
	}
	return sw;

}

int main(){
	int A[100],N,sw;
	cin >> N;
	for(int i=0;i<N;i++)cin >> A[i];

		sw=selectionSort(A,N);//??¢??°??????????????????????????????
		for(int i=0;i<N;i++){
			if(i)cout << " ";
			cout <<A[i];

		}
	cout <<endl;
	cout <<sw << endl;

	return 0;
	

}

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

#define int long long

#define rep(i,n) for(int i=0;i<(n);i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;

template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}

int N;
int x[111],y[111],h[111];

signed main(){
    cin>>N;
    rep(i,N){
        cin>>x[i]>>y[i]>>h[i];
    }

    for(int xx=0;xx<=100;xx++){
        for(int yy=0;yy<=100;yy++){
            int hh;
            rep(i,N)if(h[i]){
                hh=abs(x[i]-xx)+abs(y[i]-yy)+h[i];
                break;
            }
            bool ok=true;
            rep(i,N)if(max(hh-abs(xx-x[i])-abs(yy-y[i]),0ll)!=h[i])ok=false;
            if(ok){
                cout<<xx<<" "<<yy<<" "<<hh<<endl;
                return 0;
            }
        }
    }
    return 0;
}


Measured memory_bytes: 256