kazuyamaa/multi-language-messages-01 huggingface dataset:
Task: Matrix multiplication
C#: public class Matrix
{
	int n;
	int m;
	double[,] a;

	public Matrix(int n, int m)
	{
		if (n <= 0 || m <= 0)
			throw new ArgumentException("Matrix dimensions must be positive");
		this.n = n;
		this.m = m;
		a = new double[n, m];
	}

	
	public double this[int i, int j]
	{
		get { return a[i - 1, j - 1]; }
		set { a[i - 1, j - 1] = value; }
	}

	public int N { get { return n; } }
	public int M { get { return m; } }

	public static Matrix operator*(Matrix _a, Matrix b)
	{
		int n = _a.N;
		int m = b.M;
		int l = _a.M;
		if (l != b.N)
			throw new ArgumentException("Illegal matrix dimensions for multiplication. _a.M must be equal b.N");
		Matrix result = new Matrix(_a.N, b.M);
		for(int i = 0; i < n; i++)
			for (int j = 0; j < m; j++)
			{
				double sum = 0.0;
				for (int k = 0; k < l; k++)
					sum += _a.a[i, k]*b.a[k, j];
				result.a[i, j] = sum;
			}
		return result;
	}
}

Java: public static double[][] mult(double a[][], double b[][]){
   if(a.length == 0) return new double[0][0];
   if(a[0].length != b.length) return null; 

   int n = a[0].length;
   int m = a.length;
   int p = b[0].length;

   double ans[][] = new double[m][p];

   for(int i = 0;i < m;i++){
      for(int j = 0;j < p;j++){
         for(int k = 0;k < n;k++){
            ans[i][j] += a[i][k] * b[k][j];
         }
      }
   }
   return ans;
}
Task: Matrix multiplication
C#: public class Matrix
{
	int n;
	int m;
	double[,] a;

	public Matrix(int n, int m)
	{
		if (n <= 0 || m <= 0)
			throw new ArgumentException("Matrix dimensions must be positive");
		this.n = n;
		this.m = m;
		a = new double[n, m];
	}

	
	public double this[int i, int j]
	{
		get { return a[i - 1, j - 1]; }
		set { a[i - 1, j - 1] = value; }
	}

	public int N { get { return n; } }
	public int M { get { return m; } }

	public static Matrix operator*(Matrix _a, Matrix b)
	{
		int n = _a.N;
		int m = b.M;
		int l = _a.M;
		if (l != b.N)
			throw new ArgumentException("Illegal matrix dimensions for multiplication. _a.M must be equal b.N");
		Matrix result = new Matrix(_a.N, b.M);
		for(int i = 0; i < n; i++)
			for (int j = 0; j < m; j++)
			{
				double sum = 0.0;
				for (int k = 0; k < l; k++)
					sum += _a.a[i, k]*b.a[k, j];
				result.a[i, j] = sum;
			}
		return result;
	}
}

VB: Function matrix_multiplication(a As Variant, b As Variant) As Variant
    matrix_multiplication = WorksheetFunction.MMult(a, b)
End Function
Task: Matrix multiplication
Java: public static double[][] mult(double a[][], double b[][]){
   if(a.length == 0) return new double[0][0];
   if(a[0].length != b.length) return null; 

   int n = a[0].length;
   int m = a.length;
   int p = b[0].length;

   double ans[][] = new double[m][p];

   for(int i = 0;i < m;i++){
      for(int j = 0;j < p;j++){
         for(int k = 0;k < n;k++){
            ans[i][j] += a[i][k] * b[k][j];
         }
      }
   }
   return ans;
}

Python: a=((1,  1,  1,   1), 
     (2,  4,  8,  16),
     (3,  9, 27,  81),
     (4, 16, 64, 256))

b=((  4  , -3  ,  4/3.,  -1/4. ), 
     (-13/3., 19/4., -7/3.,  11/24.),
     (  3/2., -2.  ,  7/6.,  -1/4. ),
     ( -1/6.,  1/4., -1/6.,   1/24.))



def MatrixMul( mtx_a, mtx_b):
    tpos_b = zip( *mtx_b)
    rtn = [[ sum( ea*eb for ea,eb in zip(a,b)) for b in tpos_b] for a in mtx_a]
    return rtn


v = MatrixMul( a, b )

print 'v = ('
for r in v:
    print '[', 
    for val in r:
        print '%8.2f '%val, 
    print ']'
print ')'


u = MatrixMul(b,a)

print 'u = '
for r in u:
    print '[', 
    for val in r:
        print '%8.2f '%val, 
    print ']'
print ')'
Task: Infinity
C: #include <math.h>	
#include <stdio.h>	

double inf(void) {
  return HUGE_VAL;
}

int main() {
  printf("%g\n", inf());
  return 0;
}

C#: using System;

class Program
{
    static double PositiveInfinity()
    {
        return double.PositiveInfinity;
    }

    static void Main()
    {
        Console.WriteLine(PositiveInfinity());
    }
}
Task: Infinity
C: #include <math.h>	
#include <stdio.h>	

double inf(void) {
  return HUGE_VAL;
}

int main() {
  printf("%g\n", inf());
  return 0;
}

C++: #include <limits>

double inf()
{
  if (std::numeric_limits<double>::has_infinity)
    return std::numeric_limits<double>::infinity();
  else
    return std::numeric_limits<double>::max();
}
Task: Infinity
C: #include <math.h>	
#include <stdio.h>	

double inf(void) {
  return HUGE_VAL;
}

int main() {
  printf("%g\n", inf());
  return 0;
}

Java: double infinity = Double.POSITIVE_INFINITY; 
Double.isInfinite(infinity);
Task: Infinity
C: #include <math.h>	
#include <stdio.h>	

double inf(void) {
  return HUGE_VAL;
}

int main() {
  printf("%g\n", inf());
  return 0;
}

Python: >>> float('infinity')
inf
Task: Infinity
C#: using System;

class Program
{
    static double PositiveInfinity()
    {
        return double.PositiveInfinity;
    }

    static void Main()
    {
        Console.WriteLine(PositiveInfinity());
    }
}

C++: #include <limits>

double inf()
{
  if (std::numeric_limits<double>::has_infinity)
    return std::numeric_limits<double>::infinity();
  else
    return std::numeric_limits<double>::max();
}
Task: Infinity
C++: #include <limits>

double inf()
{
  if (std::numeric_limits<double>::has_infinity)
    return std::numeric_limits<double>::infinity();
  else
    return std::numeric_limits<double>::max();
}

VB: Declare CustomType Library "inf"
    Function inf#
End Declare

Print inf
Task: Infinity
C#: using System;

class Program
{
    static double PositiveInfinity()
    {
        return double.PositiveInfinity;
    }

    static void Main()
    {
        Console.WriteLine(PositiveInfinity());
    }
}

Go: package main

import (
    "fmt"
    "math"
)


func posInf() float64 {
    return math.Inf(1) 
}

func main() {
    x := 1.5 
    
    
    x = posInf()                     
    fmt.Println(x, math.IsInf(x, 1)) 
}
Task: Infinity
C#: using System;

class Program
{
    static double PositiveInfinity()
    {
        return double.PositiveInfinity;
    }

    static void Main()
    {
        Console.WriteLine(PositiveInfinity());
    }
}

Python: >>> float('infinity')
inf
Task: Infinity
Go: package main

import (
    "fmt"
    "math"
)


func posInf() float64 {
    return math.Inf(1) 
}

func main() {
    x := 1.5 
    
    
    x = posInf()                     
    fmt.Println(x, math.IsInf(x, 1)) 
}

Java: double infinity = Double.POSITIVE_INFINITY; 
Double.isInfinite(infinity);
Task: Infinity
Java: double infinity = Double.POSITIVE_INFINITY; 
Double.isInfinite(infinity); 

VB: Declare CustomType Library "inf"
    Function inf#
End Declare

Print inf
Task: Infinity
Go: package main

import (
    "fmt"
    "math"
)


func posInf() float64 {
    return math.Inf(1) 
}

func main() {
    x := 1.5 
    
    
    x = posInf()                     
    fmt.Println(x, math.IsInf(x, 1)) 
}

Python: >>> float('infinity')
inf
Task: Infinity
Go: package main

import (
    "fmt"
    "math"
)


func posInf() float64 {
    return math.Inf(1) 
}

func main() {
    x := 1.5 
    
    
    x = posInf()                     
    fmt.Println(x, math.IsInf(x, 1)) 
}

VB: Declare CustomType Library "inf"
    Function inf#
End Declare

Print inf
Task: Infinity
C: #include <math.h>	
#include <stdio.h>	

double inf(void) {
  return HUGE_VAL;
}

int main() {
  printf("%g\n", inf());
  return 0;
}

VB: Declare CustomType Library "inf"
    Function inf#
End Declare

Print inf
Task: Infinity
C++: #include <limits>

double inf()
{
  if (std::numeric_limits<double>::has_infinity)
    return std::numeric_limits<double>::infinity();
  else
    return std::numeric_limits<double>::max();
}

Go: package main

import (
    "fmt"
    "math"
)


func posInf() float64 {
    return math.Inf(1) 
}

func main() {
    x := 1.5 
    
    
    x = posInf()                     
    fmt.Println(x, math.IsInf(x, 1)) 
}
Task: Infinity
C#: using System;

class Program
{
    static double PositiveInfinity()
    {
        return double.PositiveInfinity;
    }

    static void Main()
    {
        Console.WriteLine(PositiveInfinity());
    }
}

Java: double infinity = Double.POSITIVE_INFINITY; 
Double.isInfinite(infinity);
Task: Infinity
C: #include <math.h>	
#include <stdio.h>	

double inf(void) {
  return HUGE_VAL;
}

int main() {
  printf("%g\n", inf());
  return 0;
}

Go: package main

import (
    "fmt"
    "math"
)


func posInf() float64 {
    return math.Inf(1) 
}

func main() {
    x := 1.5 
    
    
    x = posInf()                     
    fmt.Println(x, math.IsInf(x, 1)) 
}
Task: Infinity
C++: #include <limits>

double inf()
{
  if (std::numeric_limits<double>::has_infinity)
    return std::numeric_limits<double>::infinity();
  else
    return std::numeric_limits<double>::max();
}

Java: double infinity = Double.POSITIVE_INFINITY; 
Double.isInfinite(infinity);
Task: Infinity
C++: #include <limits>

double inf()
{
  if (std::numeric_limits<double>::has_infinity)
    return std::numeric_limits<double>::infinity();
  else
    return std::numeric_limits<double>::max();
}

Python: >>> float('infinity')
inf
Task: Infinity
C#: using System;

class Program
{
    static double PositiveInfinity()
    {
        return double.PositiveInfinity;
    }

    static void Main()
    {
        Console.WriteLine(PositiveInfinity());
    }
}

VB: Declare CustomType Library "inf"
    Function inf#
End Declare

Print inf
Task: Infinity
C: #include <math.h>	
#include <stdio.h>	

double inf(void) {
  return HUGE_VAL;
}

int main() {
  printf("%g\n", inf());
  return 0;
}

PHP: INF
Task: Infinity
C#: using System;

class Program
{
    static double PositiveInfinity()
    {
        return double.PositiveInfinity;
    }

    static void Main()
    {
        Console.WriteLine(PositiveInfinity());
    }
}

PHP: INF
Task: Infinity
C++: #include <limits>

double inf()
{
  if (std::numeric_limits<double>::has_infinity)
    return std::numeric_limits<double>::infinity();
  else
    return std::numeric_limits<double>::max();
}

PHP: INF
Task: Infinity
Go: package main

import (
    "fmt"
    "math"
)


func posInf() float64 {
    return math.Inf(1) 
}

func main() {
    x := 1.5 
    
    
    x = posInf()                     
    fmt.Println(x, math.IsInf(x, 1)) 
}

PHP: INF
Task: CUSIP
C: #include<stdlib.h>
#include<stdio.h>

int cusipCheck(char str[10]){
	int sum=0,i,v;
	
	for(i=0;i<8;i++){
		if(str[i]>='0'&&str[i]<='9')
			v = str[i]-'0';
		else if(str[i]>='A'&&str[i]<='Z')
			v = (str[i] - 'A' + 10);
		else if(str[i]=='*')
			v = 36;
		else if(str[i]=='@')
			v = 37;
		else if(str[i]=='#')
			v = 38;
		if(i%2!=0)
			v*=2;
		
		sum += ((int)(v/10) + v%10);
	}
	return ((10 - (sum%10))%10);
}

int main(int argC,char* argV[])
{
	char cusipStr[10];
	
	int i,numLines;
	
	if(argC==1)
		printf("Usage : %s <full path of CUSIP Data file>",argV[0]);
	
	else{
		FILE* fp = fopen(argV[1],"r");
	
		fscanf(fp,"%d",&numLines);
		
		printf("CUSIP       Verdict\n");
		printf("-------------------");
		
		for(i=0;i<numLines;i++){
		
			fscanf(fp,"%s",cusipStr);
		
			printf("\n%s : %s",cusipStr,(cusipCheck(cusipStr)==(cusipStr[8]-'0'))?"Valid":"Invalid");
		}
	
		fclose(fp);
	}
	return 0;
}

C#: using System;
using System.Collections.Generic;

namespace CUSIP {
    class Program {
        static bool IsCusip(string s) {
            if (s.Length != 9) return false;
            int sum = 0;
            for (int i = 0; i <= 7; i++) {
                char c = s[i];

                int v;
                if (c >= '0' && c <= '9') {
                    v = c - 48;
                }
                else if (c >= 'A' && c <= 'Z') {
                    v = c - 55;  
                }
                else if (c == '*') {
                    v = 36;
                }
                else if (c == '#') {
                    v = 38;
                }
                else {
                    return false;
                }
                if (i % 2 == 1) v *= 2;  
                sum += v / 10 + v % 10;
            }
            return s[8] - 48 == (10 - (sum % 10)) % 10;
        }

        static void Main(string[] args) {
            List<string> candidates = new List<string>() {
                "037833100",
                "17275R102",
                "38259P508",
                "594918104",
                "68389X106",
                "68389X105"
            };
            foreach (var candidate in candidates) {
                Console.WriteLine("{0} -> {1}", candidate, IsCusip(candidate) ? "correct" : "incorrect");
            }
        }
    }
}
Task: CUSIP
C: #include<stdlib.h>
#include<stdio.h>

int cusipCheck(char str[10]){
	int sum=0,i,v;
	
	for(i=0;i<8;i++){
		if(str[i]>='0'&&str[i]<='9')
			v = str[i]-'0';
		else if(str[i]>='A'&&str[i]<='Z')
			v = (str[i] - 'A' + 10);
		else if(str[i]=='*')
			v = 36;
		else if(str[i]=='@')
			v = 37;
		else if(str[i]=='#')
			v = 38;
		if(i%2!=0)
			v*=2;
		
		sum += ((int)(v/10) + v%10);
	}
	return ((10 - (sum%10))%10);
}

int main(int argC,char* argV[])
{
	char cusipStr[10];
	
	int i,numLines;
	
	if(argC==1)
		printf("Usage : %s <full path of CUSIP Data file>",argV[0]);
	
	else{
		FILE* fp = fopen(argV[1],"r");
	
		fscanf(fp,"%d",&numLines);
		
		printf("CUSIP       Verdict\n");
		printf("-------------------");
		
		for(i=0;i<numLines;i++){
		
			fscanf(fp,"%s",cusipStr);
		
			printf("\n%s : %s",cusipStr,(cusipCheck(cusipStr)==(cusipStr[8]-'0'))?"Valid":"Invalid");
		}
	
		fclose(fp);
	}
	return 0;
}

C++: #include <iostream>
#include <vector>

bool isCusip(const std::string& s) {
    if (s.size() != 9) return false;

    int sum = 0;
    for (int i = 0; i <= 7; ++i) {
        char c = s[i];

        int v;
        if ('0' <= c && c <= '9') {
            v = c - '0';
        } else if ('A' <= c && c <= 'Z') {
            v = c - '@';
        } else if (c = '*') {
            v = 36;
        } else if (c = '#') {
            v = 38;
        } else {
            return false;
        }
        if (i % 2 == 1) {
            v *= 2;
        }
        sum += v / 10 + v % 10;
    }
    return s[8] - '0' == (10 - (sum % 10)) % 10;
}

int main() {
    using namespace std;

    vector<string> candidates{
        "037833100",
        "17275R102",
        "38259P508",
        "594918104",
        "68389X106",
        "68389X105"
    };

    for (auto str : candidates) {
        auto res = isCusip(str) ? "correct" : "incorrect";
        cout << str.c_str() << " -> " << res << "\n";
    }

    return 0;
}
Task: CUSIP
C: #include<stdlib.h>
#include<stdio.h>

int cusipCheck(char str[10]){
	int sum=0,i,v;
	
	for(i=0;i<8;i++){
		if(str[i]>='0'&&str[i]<='9')
			v = str[i]-'0';
		else if(str[i]>='A'&&str[i]<='Z')
			v = (str[i] - 'A' + 10);
		else if(str[i]=='*')
			v = 36;
		else if(str[i]=='@')
			v = 37;
		else if(str[i]=='#')
			v = 38;
		if(i%2!=0)
			v*=2;
		
		sum += ((int)(v/10) + v%10);
	}
	return ((10 - (sum%10))%10);
}

int main(int argC,char* argV[])
{
	char cusipStr[10];
	
	int i,numLines;
	
	if(argC==1)
		printf("Usage : %s <full path of CUSIP Data file>",argV[0]);
	
	else{
		FILE* fp = fopen(argV[1],"r");
	
		fscanf(fp,"%d",&numLines);
		
		printf("CUSIP       Verdict\n");
		printf("-------------------");
		
		for(i=0;i<numLines;i++){
		
			fscanf(fp,"%s",cusipStr);
		
			printf("\n%s : %s",cusipStr,(cusipCheck(cusipStr)==(cusipStr[8]-'0'))?"Valid":"Invalid");
		}
	
		fclose(fp);
	}
	return 0;
}

Java: import java.util.List;

public class Cusip {
    private static Boolean isCusip(String s) {
        if (s.length() != 9) return false;
        int sum = 0;
        for (int i = 0; i <= 7; i++) {
            char c = s.charAt(i);

            int v;
            if (c >= '0' && c <= '9') {
                v = c - 48;
            } else if (c >= 'A' && c <= 'Z') {
                v = c - 55;  
            } else if (c == '*') {
                v = 36;
            } else if (c == '@') {
                v = 37;
            } else if (c == '#') {
                v = 38;
            } else {
                return false;
            }
            if (i % 2 == 1) v *= 2;  
            sum += v / 10 + v % 10;
        }
        return s.charAt(8) - 48 == (10 - (sum % 10)) % 10;
    }

    public static void main(String[] args) {
        List<String> candidates = List.of(
                "037833100", "17275R102", "38259P508", "594918104", "68389X106", "68389X105", "EXTRACRD8",
                "EXTRACRD9", "BADCUSIP!", "683&9X106", "68389x105", "683$9X106", "68389}105", "87264ABE4"
        );
        for (String candidate : candidates) {
            System.out.printf("%s -> %s%n", candidate, isCusip(candidate) ? "correct" : "incorrect");
        }
    }
}
Task: CUSIP
C: #include<stdlib.h>
#include<stdio.h>

int cusipCheck(char str[10]){
	int sum=0,i,v;
	
	for(i=0;i<8;i++){
		if(str[i]>='0'&&str[i]<='9')
			v = str[i]-'0';
		else if(str[i]>='A'&&str[i]<='Z')
			v = (str[i] - 'A' + 10);
		else if(str[i]=='*')
			v = 36;
		else if(str[i]=='@')
			v = 37;
		else if(str[i]=='#')
			v = 38;
		if(i%2!=0)
			v*=2;
		
		sum += ((int)(v/10) + v%10);
	}
	return ((10 - (sum%10))%10);
}

int main(int argC,char* argV[])
{
	char cusipStr[10];
	
	int i,numLines;
	
	if(argC==1)
		printf("Usage : %s <full path of CUSIP Data file>",argV[0]);
	
	else{
		FILE* fp = fopen(argV[1],"r");
	
		fscanf(fp,"%d",&numLines);
		
		printf("CUSIP       Verdict\n");
		printf("-------------------");
		
		for(i=0;i<numLines;i++){
		
			fscanf(fp,"%s",cusipStr);
		
			printf("\n%s : %s",cusipStr,(cusipCheck(cusipStr)==(cusipStr[8]-'0'))?"Valid":"Invalid");
		}
	
		fclose(fp);
	}
	return 0;
}

VB: Private Function Cusip_Check_Digit(s As Variant) As Integer
    Dim Sum As Integer, c As String, v As Integer
    For i = 1 To 8
        c = Mid(s, i, 1)
        If IsNumeric(c) Then
            v = Val(c)
        Else
            Select Case c
                Case "a" To "z"
                    v = Asc(c) - Asc("a") + 10
                Case "A" To "Z"
                    v = Asc(c) - Asc("A") + 10
                Case "*"
                    v = 36
                Case "@"
                    v = 37
                Case "#"
                    v = 38
                Case Else
                    Debug.Print "not expected"
            End Select
        End If
        If i Mod 2 = 0 Then v = v * 2
        Sum = Sum + Int(v \ 10) + v Mod 10
    Next i
    Cusip_Check_Digit = (10 - (Sum Mod 10)) Mod 10
End Function
Task: CUSIP
C#: using System;
using System.Collections.Generic;

namespace CUSIP {
    class Program {
        static bool IsCusip(string s) {
            if (s.Length != 9) return false;
            int sum = 0;
            for (int i = 0; i <= 7; i++) {
                char c = s[i];

                int v;
                if (c >= '0' && c <= '9') {
                    v = c - 48;
                }
                else if (c >= 'A' && c <= 'Z') {
                    v = c - 55;  
                }
                else if (c == '*') {
                    v = 36;
                }
                else if (c == '#') {
                    v = 38;
                }
                else {
                    return false;
                }
                if (i % 2 == 1) v *= 2;  
                sum += v / 10 + v % 10;
            }
            return s[8] - 48 == (10 - (sum % 10)) % 10;
        }

        static void Main(string[] args) {
            List<string> candidates = new List<string>() {
                "037833100",
                "17275R102",
                "38259P508",
                "594918104",
                "68389X106",
                "68389X105"
            };
            foreach (var candidate in candidates) {
                Console.WriteLine("{0} -> {1}", candidate, IsCusip(candidate) ? "correct" : "incorrect");
            }
        }
    }
}

Go: package main

import "fmt"

func isCusip(s string) bool {
    if len(s) != 9 { return false }
    sum := 0
    for i := 0; i < 8; i++ {
        c := s[i]
        var v int
        switch {
            case c >= '0' && c <= '9':
                v = int(c) - 48
            case c >= 'A' && c <= 'Z':
                v = int(c) - 55
            case c == '*':
                v = 36
            case c == '@':
                v = 37
            case c == '#':
                v = 38
            default:
                return false
        }
        if i % 2 == 1 { v *= 2 }  
        sum += v/10 + v%10
    }
    return int(s[8]) - 48 == (10 - (sum%10)) % 10
}

func main() {
    candidates := []string {
        "037833100",
        "17275R102",
        "38259P508",
        "594918104",
        "68389X106",
        "68389X105",
    }

    for _, candidate := range candidates {
        var b string
        if isCusip(candidate) {
            b = "correct"
        } else {
            b = "incorrect"
        }
        fmt.Printf("%s -> %s\n", candidate, b)
    }
}
Task: CUSIP
C#: using System;
using System.Collections.Generic;

namespace CUSIP {
    class Program {
        static bool IsCusip(string s) {
            if (s.Length != 9) return false;
            int sum = 0;
            for (int i = 0; i <= 7; i++) {
                char c = s[i];

                int v;
                if (c >= '0' && c <= '9') {
                    v = c - 48;
                }
                else if (c >= 'A' && c <= 'Z') {
                    v = c - 55;  
                }
                else if (c == '*') {
                    v = 36;
                }
                else if (c == '#') {
                    v = 38;
                }
                else {
                    return false;
                }
                if (i % 2 == 1) v *= 2;  
                sum += v / 10 + v % 10;
            }
            return s[8] - 48 == (10 - (sum % 10)) % 10;
        }

        static void Main(string[] args) {
            List<string> candidates = new List<string>() {
                "037833100",
                "17275R102",
                "38259P508",
                "594918104",
                "68389X106",
                "68389X105"
            };
            foreach (var candidate in candidates) {
                Console.WriteLine("{0} -> {1}", candidate, IsCusip(candidate) ? "correct" : "incorrect");
            }
        }
    }
}

Java: import java.util.List;

public class Cusip {
    private static Boolean isCusip(String s) {
        if (s.length() != 9) return false;
        int sum = 0;
        for (int i = 0; i <= 7; i++) {
            char c = s.charAt(i);

            int v;
            if (c >= '0' && c <= '9') {
                v = c - 48;
            } else if (c >= 'A' && c <= 'Z') {
                v = c - 55;  
            } else if (c == '*') {
                v = 36;
            } else if (c == '@') {
                v = 37;
            } else if (c == '#') {
                v = 38;
            } else {
                return false;
            }
            if (i % 2 == 1) v *= 2;  
            sum += v / 10 + v % 10;
        }
        return s.charAt(8) - 48 == (10 - (sum % 10)) % 10;
    }

    public static void main(String[] args) {
        List<String> candidates = List.of(
                "037833100", "17275R102", "38259P508", "594918104", "68389X106", "68389X105", "EXTRACRD8",
                "EXTRACRD9", "BADCUSIP!", "683&9X106", "68389x105", "683$9X106", "68389}105", "87264ABE4"
        );
        for (String candidate : candidates) {
            System.out.printf("%s -> %s%n", candidate, isCusip(candidate) ? "correct" : "incorrect");
        }
    }
}