Go: package main

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

var scanner= bufio.NewScanner(os.Stdin)

func main() {
	for scanner.Scan() {
		n, _ := strconv.Atoi(scanner.Text())
		if n%39 == 0 {
			fmt.Println(fmt.Sprintf("3C%02d", 39))
			continue
		}
		fmt.Println(fmt.Sprintf("3C%02d", n%39))
	}
}

C++: // #define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <cmath>
#include <cstdlib>
#include <functional>
#include <locale>
#include <cctype>
#include <sstream>	// istringstream
using namespace std;

typedef long long LL;
typedef vector<int> VI;
typedef vector<VI> VVI;

#define MP make_pair
#define fastIO	cin.tie(0); ios::sync_with_stdio(false);
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
//for gcc (未test)
// #define FOREACH_IT(it,c)	for(typeof(c)::iterator it=(c).begin(); it!=(c).end(); ++it)
//for Visual Studio
#define foreach_it(type,it,c) for(type::iterator it=c.begin(); it!=c.end(); ++it)

int main(){
	int n, ans = 0;
	while (cin >> n){
		ans = n % 39;
		if (ans == 0)	ans = 39;
		printf("3C%02d\n", ans);
	}
	return 0;
}

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

using namespace std;

int main() {
  int n;
  while (cin >> n) {
    n %= 39;
    if (n == 0) n = 39;
    printf("3C%02d\n", n);
  }
}

C++: #include<iostream>
using namespace std;
int main() {
	int x;
	while (cin >> x) {
		x %= 39;
		if (x == 0)cout << "3C39";
		else cout << "3C" << x;
		cout << endl;
	}
}

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

using namespace std;
 
int main() {
    int candy = 0;
       
    while (true){
    cin >> candy;
    if (candy == EOF) {
        break;
    }
     
    cout << candy % 39 << endl;
     
    }
}

C++: #include<iostream>
using namespace std;
int main(){
    int n;
    while(cin >>n){
        if(n%39 ==0) cout << "3C39"<<endl;
        else if(n%39 <10) cout << "3C0" << n%39<<endl;
        else cout << "3C" << n%39<<endl; 
    }
}

C++: #include<iostream>
#include<math.h>
#include<vector>
#include<algorithm>
#include<cstdio>
#include <string>
using namespace std;
 
int main(){
   int n;
   while(cin>>n){
       int ans;
       ans=n%39;
if(ans==0) ans=39;
       if(ans<10) cout<<"3C0"<<ans<<endl;
       else cout<<"3C"<<ans<<endl;
   }
    return 0;
}

C++: #include<stdio.h>
int main(void)
{
int a,b,x;
b=39;
scanf("%d",&a);
if(a<b)
{
	b=b-a;
}
else
{
	x=a%b;
	if(a%b==0)
	{
		x=39;
	}
	b=0;
	b=b+x;
}
if(b<10)
{
	printf("3C0%d\n",b);
}
else
{
	printf("3C%d\n",b);
}
return 0;
}

C++: //Name: Candy and Class Flag
//Level: 1
//Category: やるだけ
//Note: 

/**
 * 剰余を取ればよい。
 *
 * オーダーは O(1)。
 */
#include <iostream>

using namespace std;

bool solve(bool first) {
    int N;
    if(!(cin >> N)) return false;

    cout << "3C";
    cout.width(2);
    cout.fill('0');
    cout << ((N-1)%39+1) << endl;
    return true;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout.setf(ios::fixed);
    cout.precision(10);

    bool first = true;
    while(solve(first)) {
        first = false;
    }
    return 0;
}

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

int main()
{
  while(true)
  {
    int candy;
    cin >> candy;
    if ( cin.eof() ) break;
    int student_num = ( candy%39 == 0 )? 39 : candy%39;
    printf("3C%02d\n", student_num);
  }
}

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

int main(){
	int n,count;
	while(1){
		cin>>n;
		if(n==EOF)break;
		count=n%39;
		if(count==0)count=39;
		cout<<"3C"<<count<<endl;
	}
	return 0;
}

C++: #include<stdio.h>
int main(void)
{
	int c;
	while(scanf("%d",&c)!=EOF){
		if(c>=40){
			c=c%39;
			if(c==0){
				printf("3C39\n");
			}
			else if(c>0 && c<10){
				printf("3C0%d\n",c);
			}
			else{
				printf("3C%d\n",c);
			}
		}
		else if(c>0 && c<10){
			printf("3C0%d\n",c);
		}
		else {
			printf("3C%d\n",c);
		}
	}
	return 0;
}

C++: #include <map>
#include <set>
#include <list>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdio>
#include <string>
#include <vector>
#include <complex>
#include <cstdlib>
#include <cstring>
#include <numeric>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <functional>

#define mp       make_pair
#define pb       push_back
#define all(x)   (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define repi(i,a,b) for(int i = (a); i < (b); i++)

using namespace std;

typedef    long long          ll;
typedef    unsigned long long ull;
typedef    vector<bool>       vb;
typedef    vector<int>        vi;
typedef    vector<vb>         vvb;
typedef    vector<vi>         vvi;
typedef    pair<int,int>      pii;
typedef    pair<int,pair<int,string> >    P;
const int INF=1<<29;
const double EPS=1e-9;

const int dx[]={1,0,-1,0},dy[]={0,-1,0,1};
int n;
int main(){
	string team;
	vector<P> data;

	int w,l,d;
	int c =0;
	while(cin>>n,n){
		if(c!=0){
			cout <<endl;
		}
		data.clear();
		for(int i =0;i <n;i++){
			cin>>team>>w>>l>>d;
			int sum =w*3+d*1;
			data.push_back(P(sum,mp(-i,team)));
		}
		sort(data.begin(),data.end(),greater<P>());
		for(int i =0;i <data.size();i++){
			string out =data[i].second.second;
			int score =data[i].first;
			cout <<out<<","<<score<<endl;
		}
		c++;
	}
	return 0;
}

C++: #include <map>
#include <set>
#include <list>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdio>
#include <string>
#include <vector>
#include <complex>
#include <cstdlib>
#include <cstring>
#include <numeric>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <functional>

#define mp       make_pair
#define pb       push_back
#define all(x)   (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define repi(i,a,b) for(int i = (a); i < (b); i++)

using namespace std;

typedef    long long          ll;
typedef    unsigned long long ull;
typedef    vector<bool>       vb;
typedef    vector<int>        vi;
typedef    vector<vb>         vvb;
typedef    vector<vi>         vvi;
typedef    pair<int,int>      pii;
typedef    pair<int,pair<int,string> >    P;
const int INF=1<<29;
const double EPS=1e-9;

const int dx[]={1,0,-1,0},dy[]={0,-1,0,1};
int n;
int main(){
	string team;
	vector<P> data;

	int w,l,d;
	int c =0;
	while(cin>>n,n){
		if(c!=0){
			cout <<endl;
		}
		data.clear();
		for(int i =0;i <n;i++){
			cin>>team>>w>>l>>d;
			int sum =w*3+d*1;
			data.push_back(P(sum,mp(-i,team)));
		}
		sort(data.begin(),data.end(),greater<P>());
		for(int i =0;i <data.size();i++){
			string out =data[i].second.second;
			int score =data[i].first;
			cout <<out<<","<<score<<endl;
		}
		c++;
	}
	return 0;
}

C++: #include<cstdio>
using namespace std;
int main(void)
{
	int i,c,cnt;
	while(scanf("%d",&c)!=EOF){
		cnt=1;
		for(i=1;i<c;i++){
			cnt++;
			if(cnt==40){
				cnt=1;
			}
		}
		if(cnt<10){
			printf("3C0%d\n",cnt);
		}
		else{
			printf("3C%d\n",cnt);
		}
	}
	return 0;
}

C++: #include <iostream>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
int main(){
	int n;
	while(cin >> n){
		cout << "3C" << ((n-1)%39+1<10?"0":"") << (n-1)%39+1 << endl;
	}
}

C++: #include<stdio.h>
int main(void)
{
	int x,g;
	while (scanf("%d",&g)!=EOF){
		x=g%39;
		if(x==0) printf("3C39\n");
		else if(x<=9) printf("3C0%d\n",x);
		else printf("3C%d\n",x);
	}
	return 0;
}

C++: #include<iostream>
#include<string>
#include<algorithm>	
#include<cmath>
#include<map>
#include<vector>
#define int long long
using namespace std;
int test[51];
signed main() {
    int n;
    while (cin >> n) {
        cout << "3C";
        if (n % 39 == 0) {
            cout << 39 << endl;
        }
        else if (n % 39 <= 9) {
            cout << 0 << n % 39 << endl;
        }
        else {
            cout << n % 39 << endl;
        }
    }
}

C++: i;main(n){for(;i=~scanf("%d",&n);printf("3C%02d\n",n))n=(n%39)?n%39:39;}

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

int main(void){
    int n;
    
    while(cin >> n){
        cout << "3C" << n%39 << endl;
    }
    
    return 0;
}