Go: package main

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

var scanner = bufio.NewScanner(os.Stdin)

func main() {
	scanner.Scan()
	n, _ := strconv.Atoi(scanner.Text())
	for i := 0; i < n; i++ {
		scanner.Scan()
		seed, _ := strconv.Atoi(scanner.Text())
		fmt.Printf("Case %d:\n", i+1)
		for j := 0; j < 10; j++ {
			tmp := fmt.Sprintf("%08d", seed*seed)
			seed, _ = strconv.Atoi(tmp[2:6])
			fmt.Println(seed)
		}
	}
}

Python: def main():
    d = int(input())
    a = []
    for _ in range(d):
        a.append(int(input()))

    for x in range(len(a)):
        print("Case ",end = "")
        print(x+1, end = "")
        print(":")
        for _ in range(10):
            a[x] = str("{0:08d}".format(a[x] ** 2))
            hoge = ""
            for y in range(2, 6):
                hoge += a[x][y]
            hoge = int(hoge)
            a[x] = hoge
            print(a[x])


if __name__ == "__main__":
    main()

Python: 
def f(s):
  for j in range(10):
    s = s*s
    s = int(s/100)
    s = s%10000
    print(s)
    

n = int(input())
t = [int(input()) for i in range(n)]
for i in range(n):
  print("Case {0}:".format(i+1))
  f(t[i])

Python: k = int(raw_input())

for j in range(k):
	x = int(raw_input())

	print("Case " + str(k + 1))
	for i in range(10):
		x = "00000000" + str(x**2)
		x = int(x[-6:-2])
		print(x)

Python: import sys
def main():
    for line in sys.stdin:
        n = int(line)
        for x in range(1, n + 1):
            s = int(input())
            a = [] #answer
            for _ in range(10):
                s = "{0:08d}".format(s ** 2)
                s = list(s)
                hoge = ""
                for y in range(2, 6):
                    hoge += s[y]
                s = int(hoge)
                a.append(s)
            else:
                print("Case", x,end = "")
                print(":")
                for y in a:
                    print(y)


if __name__ == "__main__":
    main()

Python: for lp in range(1, int(input()) + 1):

    num = int(input())

    print("Case " + str(lp) + ":")

    for _ in range(10):
        num **= 2
        num = str(num)
        num = "0" * (8 - len(num)) + num
        num = num[2:-2]
        num = int(num)
        print(num)

Python: n = int(input())

for i in range(n):
    print("Case " + str(i + 1) + ":")
    num = int(input())
    for j in range(0,10):
        # 2乗
        num *= num
        sn = str(num)
        # 8桁にする
        if len(sn) < 8:
            d = 8 - len(sn)
            for k in range(d):
                sn = "0" + sn
        # 中央から値を取り出す
        num = int(sn[2:6])
        print(num)

C++: #include <iostream>
#include <string>
#include <iomanip>
using namespace std;
int main(){
	int d,cnt;
	long long s,y;
	string str,ans="",x="";
	cin>>d;
	for(int i=1;i<=d;i++){
		cin>>s;
		cout<<"Case "<<i<<":"<<endl;
		for(int o=1;o<=10;o++){
			y=s*s;
			str=std::to_string(y);
			if(str.size()!=8){
				int num=8-str.size();
				for(int p=0;p<num;p++){
					ans+='0';
				}
				ans+=str;
			}else{
				ans=str;
			}
			if(ans.size()%2==0){
				cnt=ans.size()/2-2;
			}else{
				cnt=ans.size()/2-3;
			}
			for(int k=cnt;k<cnt+4;k++){
				x+=ans[k];
			}
			s=stoi(x);
			cout<<s<<endl;
			ans="";
			x="";
		}
	}
	return 0;
}

C++: #include<iostream>
using namespace std;
int main(){
  int n,ans,o,d,k;
  cin >> o;
  for(int i=1;i<=o;i++){
    cin >> n;
    cout << "Case " << i << ":" << endl;
    for(int i=0;i<10;i++){
      ans = 0;
      d = 100000;
      k = 1000;
      n *= n;
      for(int j=0;j<4;j++){
	ans += n/d%10*k;
	d /=10;
	k /= 10;
      }
      n = ans;
      cout << ans << endl;
    }
  }
    return 0;
}

C++: #include <bits/stdc++.h>

using namespace std;
#define rep(x,to) for(int (x)=0;(x)<(to);(x)++)
typedef int64_t ll;

int main()
{
	int zn;
	cin >>zn;
	rep(i,zn){
		int s;
		cin >> s;
		printf("Case %d:\n", i+1);
		rep(j, 10){
			s = (s*s / 100) % 10000;
			printf("%d\n", s);
		}
	}
	
	

}

C++: #include<bits/stdc++.h>
using namespace std;

int parse(string a){
	int s=0;
	for(char b:a){
		s*=10;
		s+=b-48;
	}
	return s;
	}
int middle(int a){
	a*=a;
string b=to_string(a);
int o=b.length();
for(int c=0;c<8-o;c++)b="0"+b;
string c="    ";
for(int f=0;f<4;f++)c[f]=b[f+2];
return parse(c);
}
int main(){
int a;
cin>>a;
for(int b=0;b<a;b++){
	printf("Case %d:\n",b+1);
	int c;
	cin>>c;
	for(int d=0;d<10;d++){
		c=middle(c);
		printf("%d\n",c);
	}
}
}

C++: #include <stdio.h>
int main(){
	int s=0,n,x,i,e[8]={};
	scanf("%d",&n);
	for(i=1;i<=n;i++){
		scanf("%d",&x);
		printf("Case %d:\n",i);
		for(int j=0;j<10;j++){
			for(int q=0;q<8;q++){
				e[q]=0;
			}
			int g=7;
			int y=x*x;
			while(y){
				e[g]=y%10;
				y/=10;
				g--;
			}
			for(int k=2;k<6;k++){
				if(e[k]==0 & s==0){
				}else{
					printf("%d",e[k]);
				s=1;}
			}if(s==0){printf("0");}s=0;
			printf("\n");
			x=e[2]*1000+e[3]*100+e[4]*10+e[5];
		}
	}
return 0;
}

C++: #include <iostream>

using namespace std;
int main(){
  int n, t=1;
  cin >> n;
  while(n--){
    int s;
    cin >> s;
    cout << "Case " << t++ << ":" <<endl;
    for(int i=0; i<10; i++){
      s = s*s;
      s/=100;
      s%=10000;
      cout << s << endl;
    }

  }
  return 0;
}

C++: #include <stdio.h>
int main(){
	int s=0,n,x,i,e[8]={};
	scanf("%d",&n);
	for(i=1;i<=n;i++){
		scanf("%d",&x);
		printf("Case %d:\n",i);
		for(int j=0;j<10;j++){
			int g=7;
			int y=x*x;
			while(y){
				e[g]=y%10;
				y/=10;
				g--;
			}
			for(int k=2;k<6;k++){
				if(e[k]==0 & s==0){
				}else{
					printf("%d",e[k]);
				s=1;}
			}s=0;
			printf("\n");
			x=e[2]*1000+e[3]*100+e[4]*10+e[5];
		}
	}
return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;
using Int = long long;
signed main(){
  int d;
  cin>>d;
  for(int x=0;x<d;x++){
    cout<<"Case "<<x+1<<":"<<endl;
    int n;
    cin>>n;
    for(int i=0;i<10;i++){
      string s=to_string(n*n);
      while(s.size()<8) s='0'+s;
      n=stol(s.substr(2,4));
      cout<<n<<endl;
    }
  }
  return 0;
}

C++: #include <iostream>
#include <string>
using namespace std;



int MyRandom(int n, int m){
	string str = "";
	int num = 0;
	n *= n;

	while(1){
		str.insert( str.begin() , (n%10) + '0' );
		n /= 10;
		if( str.size() == 2*m ) break;
	}
	str = str.substr( m/2 , m );

	for(int i=0 ; i<str.size() ; i++){
		num *= 10;
		num += str[i] - '0';
	}

	return num;
}

int main(){
	int n, a, r;
	const int m = 4;

	cin >> n;
	for(int i=0 ; i<n ; i++){
		cin >> r;
		cout << "Case " << (i+1) << ":" << endl;
		for(int j=0 ; j<10 ; j++){
			if( j != 0 ){
				r = MyRandom( r , m );
			}
			cout << MyRandom( r , m ) << endl;
		}
	}
}